nidas v1.2.3
Public Member Functions | List of all members
nidas::util::SocketAddress Class Referenceabstract

An interface for a socket address. More...

#include <SocketAddress.h>

Inheritance diagram for nidas::util::SocketAddress:
Inheritance graph
[legend]

Public Member Functions

virtual SocketAddressclone () const =0
 Virtual constructor.
 
virtual ~SocketAddress ()
 
virtual int getFamily () const =0
 Get the family of this SocketAddress, one of the values from /usr/include/sys/socket.h: AF_UNIX, AF_INET, AF_INET6, etc.
 
virtual int getPort () const =0
 return the port number of this address, or -1 if there is no associated port number, e.g.
 
virtual struct sockaddr * getSockAddrPtr ()=0
 Provide non-const pointer to struct sockaddr_in.
 
virtual const struct sockaddr * getConstSockAddrPtr () const =0
 
virtual socklen_t getSockAddrLen () const =0
 Return the length of the struct sockaddr_XX for this address family.
 
virtual std::string toString () const =0
 Java style toString.
 
virtual std::string toAddressString () const =0
 Java style toString, but no DNS lookup.
 

Detailed Description

An interface for a socket address.

Constructor & Destructor Documentation

◆ ~SocketAddress()

virtual nidas::util::SocketAddress::~SocketAddress ( )
inlinevirtual

Member Function Documentation

◆ clone()

virtual SocketAddress * nidas::util::SocketAddress::clone ( ) const
pure virtual

◆ getConstSockAddrPtr()

virtual const struct sockaddr * nidas::util::SocketAddress::getConstSockAddrPtr ( ) const
pure virtual

◆ getFamily()

virtual int nidas::util::SocketAddress::getFamily ( ) const
pure virtual

Get the family of this SocketAddress, one of the values from /usr/include/sys/socket.h: AF_UNIX, AF_INET, AF_INET6, etc.

Implemented in nidas::util::Inet4SocketAddress, and nidas::util::UnixSocketAddress.

◆ getPort()

virtual int nidas::util::SocketAddress::getPort ( ) const
pure virtual

return the port number of this address, or -1 if there is no associated port number, e.g.

AF_UNIX.

Implemented in nidas::util::Inet4SocketAddress, and nidas::util::UnixSocketAddress.

Referenced by nidas::util::SocketImpl::getLocalPort(), and nidas::util::SocketImpl::getRemotePort().

◆ getSockAddrLen()

virtual socklen_t nidas::util::SocketAddress::getSockAddrLen ( ) const
pure virtual

Return the length of the struct sockaddr_XX for this address family.

Implemented in nidas::util::Inet4SocketAddress, and nidas::util::UnixSocketAddress.

Referenced by nidas::util::SocketImpl::connect(), and nidas::util::DatagramPacketBase::getSockAddrLen().

◆ getSockAddrPtr()

virtual struct sockaddr * nidas::util::SocketAddress::getSockAddrPtr ( )
pure virtual

Provide non-const pointer to struct sockaddr_in.

This is needed for recvfrom methods. recvfrom updates the struct sockaddr, so we can't cache the other portions of the address.

Implemented in nidas::util::Inet4SocketAddress, and nidas::util::UnixSocketAddress.

Referenced by nidas::util::DatagramPacketBase::getSockAddrPtr().

◆ toAddressString()

virtual std::string nidas::util::SocketAddress::toAddressString ( ) const
pure virtual

Java style toString, but no DNS lookup.

Implemented in nidas::util::Inet4SocketAddress, and nidas::util::UnixSocketAddress.

Referenced by nidas::util::SocketImpl::accept(), nidas::util::SocketImpl::connect(), nidas::util::SocketImpl::getBroadcastEnable(), nidas::util::SocketImpl::getInQueueSize(), nidas::util::SocketImpl::getInterface(), nidas::util::SocketImpl::getKeepAlive(), nidas::util::SocketImpl::getKeepAliveIdleSecs(), nidas::util::SocketImpl::getMulticastLoop(), nidas::util::SocketImpl::getOutQueueSize(), nidas::util::SocketImpl::getReceiveBufferSize(), nidas::util::SocketImpl::getSendBufferSize(), nidas::util::SocketImpl::getTcpNoDelay(), nidas::util::SocketImpl::getTimeToLive(), nidas::util::SocketImpl::isNonBlocking(), nidas::util::SocketImpl::listen(), nidas::util::SocketImpl::receive(), nidas::util::SocketImpl::receive(), nidas::util::SocketImpl::recv(), nidas::util::SocketImpl::recvfrom(), nidas::util::SocketImpl::send(), nidas::util::SocketImpl::send(), nidas::util::SocketImpl::sendall(), nidas::util::SocketImpl::sendto(), nidas::util::SocketImpl::setBroadcastEnable(), nidas::util::SocketImpl::setInterface(), nidas::util::SocketImpl::setInterface(), nidas::util::SocketImpl::setKeepAlive(), nidas::util::SocketImpl::setKeepAliveIdleSecs(), nidas::util::SocketImpl::setMulticastLoop(), nidas::util::SocketImpl::setNonBlocking(), nidas::util::SocketImpl::setPktInfo(), nidas::util::SocketImpl::setReceiveBufferSize(), nidas::util::SocketImpl::setSendBufferSize(), nidas::util::SocketImpl::setTcpNoDelay(), and nidas::util::SocketImpl::setTimeToLive().

◆ toString()

virtual std::string nidas::util::SocketAddress::toString ( ) const
pure virtual

Java style toString.

Implemented in nidas::util::Inet4SocketAddress, and nidas::util::UnixSocketAddress.


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