Panda3D
 All Classes Functions Variables Enumerations
Public Types | Public Member Functions | List of all members
Socket_Address Class Reference

A simple place to store and munipulate tcp and port address for communication layer. More...

#include "socket_address.h"

Public Types

typedef struct sockaddr_in AddressType
 

Public Member Functions

 Socket_Address (const AddressType &inaddr)
 
 Socket_Address (unsigned short port=0)
 Constructor that lets us set a port value. More...
 
 Socket_Address (const Socket_Address &inaddr)
 
virtual ~Socket_Address ()
 Normal Destructor. More...
 
void clear ()
 Set the internal values to a suitable known value. 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...
 
AddressType & GetAddressInfo ()
 
const AddressType & GetAddressInfo () const
 
unsigned long GetIPAddressRaw () const
 Return a RAW sockaddr_in. 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 (int port)
 Set to any address and a specified port. More...
 
bool set_broadcast (int port)
 Set to the broadcast address and a specified port. More...
 
bool set_host (const std::string &hostname, int port)
 This function will take a port and string-based TCP address and initialize the address with this information. More...
 
bool set_host (const std::string &hostname)
 
bool set_host (unsigned int ip4adr, int port)
 
bool set_port (int port)
 Set to a specified port. More...
 

Detailed Description

A simple place to store and munipulate tcp and port address for communication layer.

Definition at line 15 of file socket_address.h.

Constructor & Destructor Documentation

Socket_Address::Socket_Address ( unsigned short  port = 0)
inline

Constructor that lets us set a port value.

Definition at line 32 of file socket_address.I.

Socket_Address::~Socket_Address ( )
inlinevirtual

Normal Destructor.

Definition at line 68 of file socket_address.I.

Member Function Documentation

void Socket_Address::clear ( )
inline

Set the internal values to a suitable known value.

Definition at line 138 of file socket_address.I.

Referenced by NetAddress::clear().

std::string Socket_Address::get_ip ( ) const
inline

Return the IP address portion in dot notation string.

Definition at line 160 of file socket_address.I.

Referenced by NetAddress::get_ip_string().

std::string Socket_Address::get_ip_port ( ) const
inline

Return the ip address/port in dot notation string.

Definition at line 170 of file socket_address.I.

References get_port().

unsigned short Socket_Address::get_port ( ) const
inline

Get the port portion as an integer.

Definition at line 150 of file socket_address.I.

Referenced by get_ip_port(), NetAddress::get_port(), and Socket_UDP_Incoming::OpenForInputMCast().

unsigned long Socket_Address::GetIPAddressRaw ( ) const
inline

Return a RAW sockaddr_in.

Definition at line 22 of file socket_address.I.

Referenced by NetAddress::get_ip(), and NetAddress::get_ip_component().

bool Socket_Address::is_mcast_range ( void  ) const
inline

True if the address is in the multicast range.

Definition at line 274 of file socket_address.I.

bool Socket_Address::set_any_IP ( int  port)
inline

Set to any address and a specified port.

Definition at line 114 of file socket_address.I.

Referenced by NetAddress::set_any().

bool Socket_Address::set_broadcast ( int  port)
inline

Set to the broadcast address and a specified port.

Definition at line 101 of file socket_address.I.

Referenced by NetAddress::set_broadcast(), and set_host().

bool Socket_Address::set_host ( const std::string &  hostname,
int  port 
)
inline

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 185 of file socket_address.I.

References set_broadcast().

Referenced by ConnectionManager::scan_interfaces(), NetAddress::set_host(), and NetAddress::set_localhost().

bool Socket_Address::set_port ( int  port)
inline

Set to a specified port.

Definition at line 127 of file socket_address.I.

Referenced by NetAddress::set_port().


The documentation for this class was generated from the following files: