|
Panda3D
|
A simple place to store and manipulate tcp and port address for communication layer. More...
#include "socket_address.h"
Public Member Functions | |
| Socket_Address (const Socket_Address &inaddr) | |
| Socket_Address (const struct sockaddr &inaddr) | |
| Socket_Address (const struct sockaddr_in &inaddr) | |
| Socket_Address (const struct sockaddr_in6 &inaddr) | |
| Socket_Address (const struct sockaddr_storage &inaddr) | |
| Socket_Address (unsigned short port=0) | |
| Constructor that lets us set a port value. More... | |
| virtual | ~Socket_Address () |
| Normal Destructor. More... | |
| void | clear () |
| Set the internal values to a suitable known value. More... | |
| sa_family_t | get_family () const |
| Returns AF_INET if this is an IPv4 address, or AF_INET6 if this is an IPv6 address. More... | |
| std::string | get_ip () const |
| Return the IP address portion in dot notation string. More... | |
| std::string | get_ip_port () const |
| Return the ip address/port in dot notation string. More... | |
| unsigned short | get_port () const |
| Get the port portion as an integer. More... | |
| struct sockaddr & | GetAddressInfo () |
| const struct sockaddr & | GetAddressInfo () const |
| unsigned long | GetIPAddressRaw () const |
| Returns a raw 32-bit unsigned integer representing the IPv4 address. More... | |
| bool | is_any () const |
| True if the address is zero. More... | |
| bool | is_mcast_range () const |
| True if the address is in the multicast range. More... | |
| bool | operator!= (const Socket_Address &in) const |
| bool | operator< (const Socket_Address &in) const |
| bool | operator== (const Socket_Address &in) const |
| bool | set_any_IP (unsigned short port) |
| Set to any address and a specified port. More... | |
| bool | set_any_IPv6 (unsigned short port) |
| Set to any IPv6 address and a specified port. More... | |
| bool | set_broadcast (unsigned short port) |
| Set to the broadcast address and a specified port. More... | |
| bool | set_host (const std::string &hostname) |
| Initializes the address from a string specifying both the address and port, separated by a colon. More... | |
| bool | set_host (const std::string &hostname, unsigned short port) |
| This function will take a port and string-based TCP address and initialize the address with this information. More... | |
| bool | set_host (uint32_t ip4addr, unsigned short port) |
| bool | set_port (unsigned short port) |
| Set to a specified port. More... | |
A simple place to store and manipulate tcp and port address for communication layer.
Definition at line 25 of file socket_address.h.
|
inlineexplicit |
Constructor that lets us set a port value.
Definition at line 19 of file socket_address.I.
|
inlinevirtual |
Normal Destructor.
Definition at line 84 of file socket_address.I.
|
inline |
Set the internal values to a suitable known value.
Definition at line 167 of file socket_address.I.
Referenced by NetAddress::clear().
|
inline |
Returns AF_INET if this is an IPv4 address, or AF_INET6 if this is an IPv6 address.
Definition at line 178 of file socket_address.I.
Referenced by Socket_TCP::ActiveOpen(), Socket_TCP::ActiveOpenNonBlocking(), Socket_UDP_Incoming::OpenForInput(), Socket_UDP_Incoming::OpenForInputMCast(), and Socket_TCP_Listen::OpenForListen().
| std::string Socket_Address::get_ip | ( | ) | const |
Return the IP address portion in dot notation string.
Definition at line 89 of file socket_address.cxx.
Referenced by NetAddress::get_ip_string().
| std::string Socket_Address::get_ip_port | ( | ) | const |
Return the ip address/port in dot notation string.
If this is an IPv6 address, it will be enclosed in square brackets.
Definition at line 111 of file socket_address.cxx.
References get_port().
|
inline |
Get the port portion as an integer.
Definition at line 186 of file socket_address.I.
Referenced by get_ip_port(), NetAddress::get_port(), and Socket_UDP_Incoming::OpenForInputMCast().
| unsigned long Socket_Address::GetIPAddressRaw | ( | ) | const |
Returns a raw 32-bit unsigned integer representing the IPv4 address.
Definition at line 137 of file socket_address.cxx.
Referenced by NetAddress::get_ip().
|
inline |
True if the address is zero.
Definition at line 234 of file socket_address.I.
Referenced by NetAddress::is_any().
|
inline |
True if the address is in the multicast range.
Definition at line 250 of file socket_address.I.
|
inline |
Set to any address and a specified port.
Definition at line 135 of file socket_address.I.
Referenced by NetAddress::set_any().
|
inline |
Set to any IPv6 address and a specified port.
Definition at line 146 of file socket_address.I.
|
inline |
Set to the broadcast address and a specified port.
Definition at line 124 of file socket_address.I.
Referenced by NetAddress::set_broadcast(), and set_host().
| bool Socket_Address::set_host | ( | const std::string & | hostname | ) |
Initializes the address from a string specifying both the address and port, separated by a colon.
An IPv6 address must be enclosed in brackets.
Definition at line 50 of file socket_address.cxx.
References set_host().
| bool Socket_Address::set_host | ( | const std::string & | hostname, |
| unsigned short | port | ||
| ) |
This function will take a port and string-based TCP address and initialize the address with this information.
Returns true on success; on failure, it returns false and the address may be undefined.
Definition at line 22 of file socket_address.cxx.
References set_broadcast().
Referenced by set_host(), NetAddress::set_host(), and NetAddress::set_localhost().
|
inline |
Set to a specified port.
Definition at line 158 of file socket_address.I.
Referenced by NetAddress::set_port().