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. | |
virtual | ~Socket_Address () |
Normal Destructor. | |
void | clear () |
Set the internal values to a suitable known value. | |
sa_family_t | get_family () const |
Returns AF_INET if this is an IPv4 address, or AF_INET6 if this is an IPv6 address. | |
std::string | get_ip () const |
Return the IP address portion in dot notation string. | |
std::string | get_ip_port () const |
Return the ip address/port in dot notation string. | |
unsigned short | get_port () const |
Get the port portion as an integer. | |
struct sockaddr & | GetAddressInfo () |
const struct sockaddr & | GetAddressInfo () const |
unsigned long | GetIPAddressRaw () const |
Returns a raw 32-bit unsigned integer representing the IPv4 address. | |
bool | is_any () const |
True if the address is zero. | |
bool | is_mcast_range () const |
True if the address is in the multicast range. | |
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. | |
bool | set_any_IPv6 (unsigned short port) |
Set to any IPv6 address and a specified port. | |
bool | set_broadcast (unsigned short port) |
Set to the broadcast address and a specified port. | |
bool | set_host (const std::string &hostname) |
Initializes the address from a string specifying both the address and port, separated by a colon. | |
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. | |
bool | set_host (uint32_t ip4addr, unsigned short port) |
bool | set_port (unsigned short port) |
Set to a specified port. | |
A simple place to store and manipulate tcp and port address for communication layer.
Definition at line 25 of file socket_address.h.
|
inline |
Definition at line 37 of file socket_address.I.
|
inline |
Definition at line 54 of file socket_address.I.
|
inline |
Definition at line 62 of file socket_address.I.
|
inline |
Definition at line 76 of file socket_address.I.
|
inlineexplicit |
Constructor that lets us set a port value.
Definition at line 19 of file socket_address.I.
|
inline |
Definition at line 29 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().
|
inline |
Definition at line 31 of file socket_address.h.
|
inline |
Definition at line 32 of file socket_address.h.
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(), and NetAddress::get_ip_component().
|
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 |
Definition at line 116 of file socket_address.I.
|
inline |
Definition at line 205 of file socket_address.I.
|
inline |
Definition at line 91 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 Socket_UDP_Incoming::OpenForInput(), Socket_TCP_Listen::OpenForListen(), and NetAddress::set_any().
|
inline |
Set to any IPv6 address and a specified port.
Definition at line 146 of file socket_address.I.
Referenced by Socket_UDP_Incoming::OpenForInput(), and Socket_TCP_Listen::OpenForListen().
|
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 ConnectionManager::scan_interfaces(), set_host(), NetAddress::set_host(), and NetAddress::set_localhost().
|
inline |
Definition at line 194 of file socket_address.I.
|
inline |
Set to a specified port.
Definition at line 158 of file socket_address.I.
Referenced by NetAddress::set_port().
sockaddr Socket_Address::_addr |
Definition at line 65 of file socket_address.h.
sockaddr_in Socket_Address::_addr4 |
Definition at line 66 of file socket_address.h.
sockaddr_in6 Socket_Address::_addr6 |
Definition at line 67 of file socket_address.h.
sockaddr_storage Socket_Address::_storage |
Definition at line 68 of file socket_address.h.