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