dodo  0.0.1
A C++ library to create containerized Linux services
dodo::network::SocketParams Class Reference

Socket parameters - the family (domain), socket type and protocol triplet. More...

#include <socketparams.hpp>

Collaboration diagram for dodo::network::SocketParams:

Public Types

enum  AddressFamily {
  afLOCAL = AF_LOCAL, afINET = AF_INET, afINET6 = AF_INET6, afIPX = AF_IPX,
  afNETLINK = AF_NETLINK, afX25 = AF_X25, afAX25 = AF_AX25, afATMPVC = AF_ATMPVC,
  afAPPLETALK = AF_APPLETALK, afPACKET = AF_PACKET, afALG = AF_ALG, afUNSPEC = AF_UNSPEC
}
 Addres family type. More...
 
enum  ProtocolNumber {
  pnHOPOPT = 0, pnICMP = IPPROTO_ICMP, pnICMPV6 = IPPROTO_ICMPV6, pnIGMP = 2,
  pnGGP = 3, pnIPv4 = 4, pnST = 5, pnTCP = 6,
  pnCBT = 7, pnEGP = 8, pnIGP = 9, pnBBN_RCC_MON = 10,
  pnNVP_II = 11, pnPUP = 12, pnARGUS = 13, pnEMCON = 14,
  pnXNET = 15, pnCHAOS = 16, pnUDP = 17, pnMUX = 18,
  pnDCN_MEAS = 19, pnHMP = 20, pnPRM = 21, pnXNS_IDP = 22,
  pnTRUNK_1 = 23, pnTRUNK_2 = 24, pnLEAF_1 = 25, pnLEAF_2 = 26,
  pnRDP = 27, pnIRTP = 28, pnISO_TP4 = 29, pnNETBLT = 30,
  pnMFE_NSP = 31, pnMERIT_INP = 32, pnDCCP = 33, pn3PC = 34,
  pnIDPR = 35, pnXTP = 36, pnDDP = 37, pnIDPR_CMTP = 38
}
 IANA Protocol number. More...
 
enum  SocketType {
  stSTREAM = SOCK_STREAM, stDGRAM = SOCK_DGRAM, stSEQPACKET = SOCK_SEQPACKET, stRAW = SOCK_RAW,
  stRDM = SOCK_RDM, stPACKET = SOCK_PACKET
}
 Socket Type type. More...
 

Public Member Functions

 SocketParams ()
 Default constructor to AF_INET6, SOCK_STREAM, protocol pnHOPOPT. More...
 
 SocketParams (AddressFamily family)
 Constructor only sets the AddressFamily. More...
 
 SocketParams (AddressFamily family, SocketType sockettype)
 Constructor sets the AddressFamily and SocketType. More...
 
 SocketParams (AddressFamily family, SocketType sockettype, ProtocolNumber protocol)
 Constructor sets the AddressFamily, SocketType and ProtocolNumber. More...
 
std::string asString () const
 Return the parameters as a string. More...
 
AddressFamily getAddressFamily () const
 Get the AddressFamily. More...
 
ProtocolNumber getProtocol () const
 Get the ProtocolNumber. More...
 
SocketType getSocketType () const
 Get the SocketType. More...
 
void setAddressFamily (AddressFamily family)
 Set the AddressFamily. More...
 
void setProtocol (ProtocolNumber protocol)
 Set the ProtocolNumber. More...
 
void setSocketType (SocketType sockettype)
 Set the SocketType. More...
 

Static Public Member Functions

static std::string familyString (AddressFamily family)
 Return the AddressFamily name as a string. More...
 
static std::string protocolString (ProtocolNumber protocol)
 Return the ProtocolNumber name as a string. More...
 
static std::string socketTypeString (SocketType sockettype)
 Return the SocketType name as a string. More...
 

Private Attributes

AddressFamily family_
 The address family. More...
 
ProtocolNumber protocol_
 The protocol. More...
 
SocketType sockettype_
 The socket type. More...
 

Detailed Description

Socket parameters - the family (domain), socket type and protocol triplet.

Definition at line 35 of file socketparams.hpp.

Member Enumeration Documentation

◆ AddressFamily

Addres family type.

Definition at line 41 of file socketparams.hpp.

◆ ProtocolNumber

◆ SocketType

Socket Type type.

Definition at line 59 of file socketparams.hpp.

Constructor & Destructor Documentation

◆ SocketParams() [1/4]

dodo::network::SocketParams::SocketParams ( )
inline

Default constructor to AF_INET6, SOCK_STREAM, protocol pnHOPOPT.

Definition at line 119 of file socketparams.hpp.

◆ SocketParams() [2/4]

dodo::network::SocketParams::SocketParams ( AddressFamily  family)
inline

Constructor only sets the AddressFamily.

Parameters
familyThe AddressFamily.

Definition at line 125 of file socketparams.hpp.

◆ SocketParams() [3/4]

dodo::network::SocketParams::SocketParams ( AddressFamily  family,
SocketType  sockettype 
)
inline

Constructor sets the AddressFamily and SocketType.

Parameters
familyThe AddressFamily.
sockettypeThe SocketType.

Definition at line 132 of file socketparams.hpp.

◆ SocketParams() [4/4]

dodo::network::SocketParams::SocketParams ( AddressFamily  family,
SocketType  sockettype,
ProtocolNumber  protocol 
)
inline

Constructor sets the AddressFamily, SocketType and ProtocolNumber.

Parameters
familyThe AddressFamily.
sockettypeThe SocketType.
protocolThe ProtocolNumber.

Definition at line 141 of file socketparams.hpp.

Member Function Documentation

◆ asString()

std::string dodo::network::SocketParams::asString ( ) const
inline

Return the parameters as a string.

Returns
The string.

Definition at line 184 of file socketparams.hpp.

References family_, familyString(), protocol_, protocolString(), sockettype_, and socketTypeString().

Referenced by dodo::network::AddrInfoItem::asString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ familyString()

static std::string dodo::network::SocketParams::familyString ( AddressFamily  family)
inlinestatic

Return the AddressFamily name as a string.

Parameters
familyThe AddressFamily to convert.
Returns
The string.

Definition at line 198 of file socketparams.hpp.

Referenced by asString().

Here is the caller graph for this function:

◆ getAddressFamily()

AddressFamily dodo::network::SocketParams::getAddressFamily ( ) const
inline

Get the AddressFamily.

Returns
The AddressFamily.

Definition at line 148 of file socketparams.hpp.

References family_.

Referenced by dodo::network::BaseSocket::BaseSocket(), and dodo::network::Address::getHostAddrInfo().

Here is the caller graph for this function:

◆ getProtocol()

ProtocolNumber dodo::network::SocketParams::getProtocol ( ) const
inline

Get the ProtocolNumber.

Returns
The ProtocolNumber.

Definition at line 160 of file socketparams.hpp.

References protocol_.

Referenced by dodo::network::BaseSocket::BaseSocket(), and dodo::network::Address::getHostAddrInfo().

Here is the caller graph for this function:

◆ getSocketType()

SocketType dodo::network::SocketParams::getSocketType ( ) const
inline

Get the SocketType.

Returns
The SocketType.

Definition at line 154 of file socketparams.hpp.

References sockettype_.

Referenced by dodo::network::BaseSocket::BaseSocket(), and dodo::network::Address::getHostAddrInfo().

Here is the caller graph for this function:

◆ protocolString()

static std::string dodo::network::SocketParams::protocolString ( ProtocolNumber  protocol)
inlinestatic

Return the ProtocolNumber name as a string.

Parameters
protocolThe ProtocolNumber to convert.
Returns
The string.

Definition at line 243 of file socketparams.hpp.

Referenced by asString().

Here is the caller graph for this function:

◆ setAddressFamily()

void dodo::network::SocketParams::setAddressFamily ( AddressFamily  family)
inline

Set the AddressFamily.

Parameters
familyThe AddressFamily.

Definition at line 166 of file socketparams.hpp.

References family_.

Referenced by dodo::network::Address::getHostAddrInfo().

Here is the caller graph for this function:

◆ setProtocol()

void dodo::network::SocketParams::setProtocol ( ProtocolNumber  protocol)
inline

Set the ProtocolNumber.

Parameters
protocolThe ProtocolNumber.

Definition at line 178 of file socketparams.hpp.

References protocol_.

Referenced by dodo::network::Address::getHostAddrInfo().

Here is the caller graph for this function:

◆ setSocketType()

void dodo::network::SocketParams::setSocketType ( SocketType  sockettype)
inline

Set the SocketType.

Parameters
sockettypeThe SocketType.

Definition at line 172 of file socketparams.hpp.

References sockettype_.

Referenced by dodo::network::Address::getHostAddrInfo().

Here is the caller graph for this function:

◆ socketTypeString()

static std::string dodo::network::SocketParams::socketTypeString ( SocketType  sockettype)
inlinestatic

Return the SocketType name as a string.

Parameters
sockettypeThe SocketType to convert.
Returns
The string.

Definition at line 223 of file socketparams.hpp.

Referenced by asString().

Here is the caller graph for this function:

Field Documentation

◆ family_

AddressFamily dodo::network::SocketParams::family_
private

The address family.

Definition at line 270 of file socketparams.hpp.

Referenced by asString(), getAddressFamily(), and setAddressFamily().

◆ protocol_

ProtocolNumber dodo::network::SocketParams::protocol_
private

The protocol.

Definition at line 286 of file socketparams.hpp.

Referenced by asString(), getProtocol(), and setProtocol().

◆ sockettype_

SocketType dodo::network::SocketParams::sockettype_
private

The socket type.

Definition at line 281 of file socketparams.hpp.

Referenced by asString(), getSocketType(), and setSocketType().


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