00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef NETADDRESS_H
00016 #define NETADDRESS_H
00017
00018 #include "pandabase.h"
00019 #include "numeric_types.h"
00020 #include "socket_address.h"
00021
00022
00023
00024
00025
00026
00027 class EXPCL_PANDA_NET NetAddress {
00028 PUBLISHED:
00029 NetAddress();
00030 NetAddress(const Socket_Address &addr);
00031
00032 bool set_any(int port);
00033 bool set_localhost(int port);
00034 bool set_host(const string &hostname, int port);
00035
00036 void clear();
00037
00038 int get_port() const;
00039 void set_port(int port);
00040 string get_ip_string() const;
00041 PN_uint32 get_ip() const;
00042 PN_uint8 get_ip_component(int n) const;
00043
00044 const Socket_Address &get_addr() const;
00045
00046 void output(ostream &out) const;
00047
00048 private:
00049 Socket_Address _addr;
00050 };
00051
00052 INLINE ostream &operator << (ostream &out, const NetAddress &addr) {
00053 addr.output(out);
00054 return out;
00055 }
00056
00057 #endif
00058