![]() |
sP2P c++ STL *nix API
1.2
NAT traversal and peer-to-peer networking API providing all utilities needed to build peer-to-peer application straigth out of box
|
Public Member Functions | |
IPEndPoint (IP4Address IPAddress, sp2plib::UInt16 Port) | |
Initialises new instance from IPEndPoint from IP4Address object and port value | |
IPEndPoint (char *HostAddress, sp2plib::UInt16 Port) | |
Initialises new instance from text represented host name/IP and port value | |
IPEndPoint (sp2plib::UInt32 intAddress, sp2plib::UInt16 Port) | |
Initialises new instance from address Int32 value (machine order) and port value | |
IPEndPoint (sockaddr_in sAddr) | |
Initialises new instance from sockaddr_in object | |
IPEndPoint (const char *sEp) | |
Initialises new instance from human readable text address:port value | |
~IPEndPoint () | |
Destructor. | |
void | Set (IP4Address IPAddress, sp2plib::UInt16 Port) |
Sets the value of end point from IP4Address object and port value | |
void | Set (char *HostAddress, sp2plib::UInt16 Port) |
Sets the value of end point from text represented host name/IP and port value | |
void | Set (sp2plib::UInt32 intAddress, sp2plib::UInt16 Port) |
Sets the value of end point from address Int32 value (machine order) and port value | |
IP4Address | GetAddress () |
Gets address of End Point as IP4Address object | |
void | As_sockaddr_in (sockaddr_in &adr) |
Injects data from this object into sockaddr_in structure | |
sockaddr_in | get_sockaddr_in () |
Gets sockaddr_in object form IPEndPoint | |
void | From_sockaddr_in (const sockaddr_in &adr) |
Takes values from sockaddr_in object | |
sp2plib::UInt16 | GetPort () |
Gets the port. | |
void | SetPort (sp2plib::UInt16 Port) |
Sets a port. | |
void | SetAddress (sp2plib::UInt32 intAddress) |
Sets address value by passing Int32 address value (machine order) argument | |
void | SetAddress (char *HostAddress) |
Sets address value by passing address in text format : d.d.d.d | |
void | SetAddressFromBytes (unsigned char *AddressBytes, int startIndex=0) |
Sets address value from 4 byte sequence argument. To specify start index of sequence different than 0 use startIndex argument | |
::std::string | ToString () |
Gets human readable form of IPEndPoint in format d.d.d.d:p | |
bool | Equals (IPEndPoint *otherEndPoint) |
Tests if this IPEndPoint * is considered equal to another. | |
void | ParseFromBytes (unsigned char *buffer, int startIndex=0) |
Parses 6 (address[4]:port[2]) bytes from byte array in machine order | |
void | ToByteArray (unsigned char *buffer, int startIndex=0) |
Writes 6 (address[4]:port[2]) bytes to existing byte array starting from startIndex | |
operator sockaddr_in () | |
sockaddr_in casting operator. | |
IPEndPoint & | operator= (const IPEndPoint &rhs) |
Assignment operator. | |
IPEndPoint & | operator= (const sockaddr_in &rhs) |
Assignment operator. | |
bool | operator== (const IPEndPoint &other) const |
Equality operator. | |
bool | operator!= (const IPEndPoint &other) const |
Inequality operator. | |
Static Public Member Functions | |
static IPEndPoint * | new_ParseFromBytes (unsigned char *buffer, int startIndex=0) |
Creates IPEndPoint object from byte array | |
static IPEndPoint & | ANY () |
Gets Ep = 0.0.0.0:0 (ANY) | |
sp2plib::IPEndPoint::IPEndPoint | ( | IP4Address | IPAddress, |
sp2plib::UInt16 | Port | ||
) |
Initialises new instance from IPEndPoint from IP4Address object and port value
IPAddress | The IP address. |
Port | The port. |
sp2plib::IPEndPoint::IPEndPoint | ( | char * | HostAddress, |
sp2plib::UInt16 | Port | ||
) |
Initialises new instance from text represented host name/IP and port value
HostAddress | The host address in human readable format or dns format |
Port | The port. |
sp2plib::IPEndPoint::IPEndPoint | ( | sp2plib::UInt32 | intAddress, |
sp2plib::UInt16 | Port | ||
) |
Initialises new instance from address Int32 value (machine order) and port value
intAddress | The int address in machine byte order |
Port | The port. |
sp2plib::IPEndPoint::IPEndPoint | ( | sockaddr_in | sAddr | ) |
Initialises new instance from sockaddr_in object
sAddr | The sockaddr_in address |
sp2plib::IPEndPoint::IPEndPoint | ( | const char * | sEp | ) |
Initialises new instance from human readable text address:port value
sEp | Human readable string 000.000.000.000:00000 |
sp2plib::IPEndPoint::~IPEndPoint | ( | ) |
Destructor.
|
static |
Gets Ep = 0.0.0.0:0 (ANY)
void sp2plib::IPEndPoint::As_sockaddr_in | ( | sockaddr_in & | adr | ) |
Injects data from this object into sockaddr_in structure
adr | The sockaddr_in address. |
bool sp2plib::IPEndPoint::Equals | ( | IPEndPoint * | otherEndPoint | ) |
Tests if this IPEndPoint * is considered equal to another.
otherEndPoint | [in,out] If non-null, the IP end point * to compare to this object. |
void sp2plib::IPEndPoint::From_sockaddr_in | ( | const sockaddr_in & | adr | ) |
Takes values from sockaddr_in object
adr | The sockaddr_in address. |
sockaddr_in sp2plib::IPEndPoint::get_sockaddr_in | ( | ) |
Gets sockaddr_in object form IPEndPoint
IP4Address sp2plib::IPEndPoint::GetAddress | ( | ) |
Gets address of End Point as IP4Address object
sp2plib::UInt16 sp2plib::IPEndPoint::GetPort | ( | ) |
Gets the port.
|
static |
Creates IPEndPoint object from byte array
buffer | The buffer holding 6 EP bytes |
startIndex | (optional) the start index from which to start parsing. |
char b_adr[6] = {0x0C,0x0D,0x0E,0x0F,0x0A,0x0A}; IPEndPoint *adr = IPEndPoint::new_ParseFromBytes(b_adr);
sp2plib::IPEndPoint::operator sockaddr_in | ( | ) |
sockaddr_in casting operator.
bool sp2plib::IPEndPoint::operator!= | ( | const IPEndPoint & | other | ) | const |
Inequality operator.
other | The other. |
IPEndPoint& sp2plib::IPEndPoint::operator= | ( | const IPEndPoint & | rhs | ) |
Assignment operator.
rhs | The right hand side. |
IPEndPoint& sp2plib::IPEndPoint::operator= | ( | const sockaddr_in & | rhs | ) |
Assignment operator.
rhs | The right hand side. |
bool sp2plib::IPEndPoint::operator== | ( | const IPEndPoint & | other | ) | const |
Equality operator.
other | The other. |
void sp2plib::IPEndPoint::ParseFromBytes | ( | unsigned char * | buffer, |
int | startIndex = 0 |
||
) |
Parses 6 (address[4]:port[2]) bytes from byte array in machine order
buffer | The buffer holding 6 EP bytes. |
startIndex | (optional) the start index from which to start parsing. |
void sp2plib::IPEndPoint::Set | ( | IP4Address | IPAddress, |
sp2plib::UInt16 | Port | ||
) |
Sets the value of end point from IP4Address object and port value
IPAddress | The IP address. |
Port | The port. |
void sp2plib::IPEndPoint::Set | ( | char * | HostAddress, |
sp2plib::UInt16 | Port | ||
) |
Sets the value of end point from text represented host name/IP and port value
HostAddress | The host address in human readable format or dns format. |
Port | The port. |
void sp2plib::IPEndPoint::Set | ( | sp2plib::UInt32 | intAddress, |
sp2plib::UInt16 | Port | ||
) |
Sets the value of end point from address Int32 value (machine order) and port value
intAddress | The int address in machine byte order. |
Port | The port. |
void sp2plib::IPEndPoint::SetAddress | ( | sp2plib::UInt32 | intAddress | ) |
Sets address value by passing Int32 address value (machine order) argument
intAddress | The int address in machine byte order. |
void sp2plib::IPEndPoint::SetAddress | ( | char * | HostAddress | ) |
Sets address value by passing address in text format : d.d.d.d
HostAddress | The host address in human readable format or dns format. |
void sp2plib::IPEndPoint::SetAddressFromBytes | ( | unsigned char * | AddressBytes, |
int | startIndex = 0 |
||
) |
Sets address value from 4 byte sequence argument. To specify start index of sequence different than 0 use startIndex argument
AddressBytes | Array holding address bytes |
startIndex | (optional) the start index from which to start parsing |
void sp2plib::IPEndPoint::SetPort | ( | sp2plib::UInt16 | Port | ) |
Sets a port.
Port | The port. |
void sp2plib::IPEndPoint::ToByteArray | ( | unsigned char * | buffer, |
int | startIndex = 0 |
||
) |
Writes 6 (address[4]:port[2]) bytes to existing byte array starting from startIndex
buffer | The buffer to store 6 EP bytes to |
startIndex | (optional) the start index from which to start writing |
::std::string sp2plib::IPEndPoint::ToString | ( | ) |
Gets human readable form of IPEndPoint in format d.d.d.d:p