|
nidas v1.2.3
|
A IP version 4 socket address, containing a host address, and a port number. More...
#include <Inet4SocketAddress.h>

Public Member Functions | |
| Inet4SocketAddress () | |
| Default constructor, address of 0.0.0.0 (INADDR_ANY), port 0. | |
| Inet4SocketAddress (int port) | |
| Address of 0.0.0.0 (INADDR_ANY), with a given port number. | |
| Inet4SocketAddress (const Inet4Address &, int port) | |
| Inet4SocketAddress (const struct sockaddr_in *_sockaddr) | |
| Inet4SocketAddress (const Inet4SocketAddress &) | |
| Copy constructor. | |
| Inet4SocketAddress & | operator= (const Inet4SocketAddress &x) |
| Assignment operator. | |
| Inet4SocketAddress * | clone () const |
| Virtual constructor. | |
| int | getFamily () const |
| Return the address family, AF_INET. | |
| int | getPort () const |
| Return the port number. | |
| void | setPort (int val) |
| Set the port number. | |
| Inet4Address | getInet4Address () const |
| Return the IP address portion. | |
| struct sockaddr * | getSockAddrPtr () |
| Provide non-const pointer to struct sockaddr_in. | |
| const struct sockaddr * | getConstSockAddrPtr () const |
| Provide const pointer to struct sockaddr_in. | |
| socklen_t | getSockAddrLen () const |
| Return the length of the struct sockaddr_XX for this address family. | |
| std::string | toString () const |
| Java style toString: returns "inet:hostname:port". | |
| std::string | toAddressString () const |
| Java style toString, but no DNS lookup: returns "inet:w.x.y.z:port". | |
| bool | operator< (const Inet4SocketAddress &x) const |
| Comparator operator for addresses. | |
| bool | operator== (const Inet4SocketAddress &x) const |
| Equality operator for addresses. | |
Protected Attributes | |
| struct sockaddr_in | _sockaddr |
A IP version 4 socket address, containing a host address, and a port number.
The only data element is a struct sockaddr_in, so the default copy constructor and assignment operators work fine.
| Inet4SocketAddress::Inet4SocketAddress | ( | ) |
| Inet4SocketAddress::Inet4SocketAddress | ( | int | port | ) |
| Inet4SocketAddress::Inet4SocketAddress | ( | const Inet4Address & | addr, |
| int | port ) |
References _sockaddr, nidas::util::Inet4Address::getInAddrPtr(), and port.
| Inet4SocketAddress::Inet4SocketAddress | ( | const struct sockaddr_in * | _sockaddr | ) |
| Inet4SocketAddress::Inet4SocketAddress | ( | const Inet4SocketAddress & | x | ) |
Copy constructor.
|
virtual |
|
inlinevirtual |
Provide const pointer to struct sockaddr_in.
Implements nidas::util::SocketAddress.
References _sockaddr.
|
inlinevirtual |
|
inline |
Return the IP address portion.
References _sockaddr.
Referenced by nidas::core::Socket::connect(), nidas::util::McSocketListener::run(), toAddressString(), and toString().
|
inlinevirtual |
Return the port number.
Implements nidas::util::SocketAddress.
References _sockaddr.
Referenced by nidas::util::McSocketListener::run(), toAddressString(), and toString().
|
inlinevirtual |
Return the length of the struct sockaddr_XX for this address family.
Implements nidas::util::SocketAddress.
References _sockaddr.
|
inlinevirtual |
Provide non-const pointer to struct sockaddr_in.
This is needed for recvfrom methods. recvfrom updates the struct sockaddr_in, so we can't cache the other portions of the address.
Implements nidas::util::SocketAddress.
References _sockaddr.
| bool Inet4SocketAddress::operator< | ( | const Inet4SocketAddress & | x | ) | const |
Comparator operator for addresses.
Useful if this address is a key in an STL map.
References _sockaddr.
| Inet4SocketAddress & Inet4SocketAddress::operator= | ( | const Inet4SocketAddress & | x | ) |
Assignment operator.
References _sockaddr.
| bool Inet4SocketAddress::operator== | ( | const Inet4SocketAddress & | x | ) | const |
Equality operator for addresses.
References _sockaddr.
|
inline |
Set the port number.
References _sockaddr.
Referenced by nidas::dynld::UDPSampleOutput::ConnectionMonitor::addDestination().
|
virtual |
Java style toString, but no DNS lookup: returns "inet:w.x.y.z:port".
Implements nidas::util::SocketAddress.
References nidas::util::Inet4Address::getHostAddress(), getInet4Address(), and getPort().
Referenced by nidas::core::StatusListener::run().
|
virtual |
Java style toString: returns "inet:hostname:port".
Implements nidas::util::SocketAddress.
References nidas::util::Inet4Address::getHostName(), getInet4Address(), and getPort().
Referenced by nidas::util::McSocketListener::run().
|
protected |