Panda3D
 All Classes Functions Variables Enumerations
socket_address.h
1 #ifndef SOCKET_ADDRESS_H
2 #define SOCKET_ADDRESS_H
3 
4 #include "pandabase.h"
5 #include "numeric_types.h"
6 #include "socket_portable.h"
7 
8 ///////////////////////////////////
9 // Class : Socket_Address
10 //
11 // Description: A simple place to store and munipulate tcp and port address for
12 // communication layer
13 //
14 //////////////////////////////
15 class EXPCL_PANDA_NATIVENET Socket_Address {
16 public:
17  typedef struct sockaddr_in AddressType;
18  Socket_Address(const AddressType &inaddr);
19  AddressType &GetAddressInfo() { return _addr; }
20  const AddressType &GetAddressInfo() const { return _addr; }
21 
22 PUBLISHED:
23  INLINE Socket_Address(unsigned short port = 0);
24  INLINE Socket_Address(const Socket_Address &inaddr);
25 
26  INLINE virtual ~Socket_Address();
27 
28  INLINE bool set_any_IP(int port);
29  INLINE bool set_port(int port);
30  INLINE bool set_broadcast(int port);
31 
32  INLINE bool set_host(const std::string &hostname, int port) ;
33  INLINE bool set_host(const std::string &hostname) ;
34  INLINE bool set_host(unsigned int ip4adr, int port);
35  INLINE void clear();
36 
37  INLINE unsigned short get_port() const;
38  INLINE std::string get_ip() const ;
39  INLINE std::string get_ip_port() const;
40  INLINE unsigned long GetIPAddressRaw() const;
41 
42  INLINE bool operator ==(const Socket_Address &in) const;
43  INLINE bool operator !=(const Socket_Address &in) const;
44  INLINE bool operator < (const Socket_Address &in) const;
45 
46  INLINE bool is_mcast_range() const;
47 
48 private:
49  AddressType _addr;
50 };
51 
52 #include "socket_address.I"
53 
54 #endif // SOCKET_ADDRESS_H
A simple place to store and munipulate tcp and port address for communication layer.