dodo
0.0.1
A C++ library to create containerized Linux services
|
Go to the documentation of this file.
23 #ifndef network_socketparams_hpp
24 #define network_socketparams_hpp
46 afNETLINK = AF_NETLINK,
50 afAPPLETALK = AF_APPLETALK,
60 stSTREAM = SOCK_STREAM,
62 stSEQPACKET = SOCK_SEQPACKET,
65 stPACKET = SOCK_PACKET
75 pnICMP = IPPROTO_ICMP,
76 pnICMPV6 = IPPROTO_ICMPV6,
185 std::stringstream ss;
199 std::stringstream ss;
201 case AF_LOCAL : ss <<
"AF_LOCAL";
break;
202 case AF_INET : ss <<
"AF_INET";
break;
203 case AF_INET6 : ss <<
"AF_INET6";
break;
204 case AF_IPX : ss <<
"AF_IPX";
break;
205 case AF_NETLINK : ss <<
"AF_NETLINK";
break;
206 case AF_X25 : ss <<
"AF_X25";
break;
207 case AF_AX25 : ss <<
"AF_AX25";
break;
208 case AF_ATMPVC : ss <<
"AF_ATMPVC";
break;
209 case AF_APPLETALK : ss <<
"AF_APPLETALK";
break;
210 case AF_PACKET : ss <<
"AF_PACKET";
break;
211 case AF_ALG : ss <<
"AF_ALG";
break;
212 case AF_UNSPEC : ss <<
"AF_UNSPEC";
break;
213 default : ss <<
"unhandled protocol family";
break;
224 std::stringstream ss;
225 switch ( sockettype ) {
226 case SOCK_STREAM : ss <<
"SOCK_STREAM";
break;
227 case SOCK_DGRAM : ss <<
"SOCK_DGRAM";
break;
228 case SOCK_SEQPACKET : ss <<
"SOCK_SEQPACKET";
break;
229 case SOCK_RAW : ss <<
"SOCK_RAW";
break;
230 case SOCK_RDM : ss <<
"SOCK_RDM";
break;
231 case SOCK_PACKET : ss <<
"SOCK_PACKET";
break;
232 default : ss <<
"unhandled socket type";
break;
244 std::stringstream ss;
245 switch ( protocol ) {
246 case pnHOPOPT : ss <<
"HOPOPT";
break;
247 case pnICMP : ss <<
"ICMP";
break;
248 case pnIGMP : ss <<
"IGMP";
break;
249 case pnGGP : ss <<
"GGP";
break;
250 case pnIPv4 : ss <<
"IPv4";
break;
251 case pnST : ss <<
"ST";
break;
252 case pnTCP : ss <<
"TCP";
break;
253 case pnCBT : ss <<
"CBT";
break;
254 case pnEGP : ss <<
"EGP";
break;
255 case pnIGP : ss <<
"IGP";
break;
256 case pnBBN_RCC_MON : ss <<
"BBN-RCC-MON";
break;
257 case pnNVP_II : ss <<
"NVP-II";
break;
258 case pnPUP : ss <<
"PUP";
break;
259 case pnARGUS : ss <<
"ARGUS";
break;
260 case pnEMCON : ss <<
"EMCON";
break;
261 case pnXNET : ss <<
"XNET";
break;
262 case pnCHAOS : ss <<
"CHAOS";
break;
263 case pnUDP : ss <<
"UDP";
break;
264 case pnMUX : ss <<
"MUX";
break;
265 case pnDCN_MEAS : ss <<
"DCN_MEAS";
break;
266 case pnHMP : ss <<
"HMP";
break;
267 default : ss <<
"unknown";
break;
AddressFamily getAddressFamily() const
Get the AddressFamily.
void setAddressFamily(AddressFamily family)
Set the AddressFamily.
static std::string protocolString(ProtocolNumber protocol)
Return the ProtocolNumber name as a string.
SocketParams()
Default constructor to AF_INET6, SOCK_STREAM, protocol pnHOPOPT.
AddressFamily
Addres family type.
AddressFamily family_
The address family.
ProtocolNumber protocol_
The protocol.
Socket parameters - the family (domain), socket type and protocol triplet.
static std::string familyString(AddressFamily family)
Return the AddressFamily name as a string.
SocketParams(AddressFamily family, SocketType sockettype, ProtocolNumber protocol)
Constructor sets the AddressFamily, SocketType and ProtocolNumber.
SocketParams(AddressFamily family, SocketType sockettype)
Constructor sets the AddressFamily and SocketType.
std::string asString() const
Return the parameters as a string.
void setSocketType(SocketType sockettype)
Set the SocketType.
SocketParams(AddressFamily family)
Constructor only sets the AddressFamily.
void setProtocol(ProtocolNumber protocol)
Set the ProtocolNumber.
Interface for network communication.
static std::string socketTypeString(SocketType sockettype)
Return the SocketType name as a string.
SocketType getSocketType() const
Get the SocketType.
ProtocolNumber
IANA Protocol number.
SocketType
Socket Type type.
SocketType sockettype_
The socket type.
ProtocolNumber getProtocol() const
Get the ProtocolNumber.