MCPcopy Create free account
hub / github.com/SIPp/sipp / socket_fd

Function socket_fd

src/socket.cpp:1293–1327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1291}
1292
1293static int socket_fd(bool use_ipv6, int transport)
1294{
1295 int socket_type = -1;
1296 int protocol = 0;
1297 int fd;
1298
1299 switch(transport) {
1300 case T_UDP:
1301 socket_type = SOCK_DGRAM;
1302 protocol = IPPROTO_UDP;
1303 break;
1304 case T_SCTP:
1305#ifndef USE_SCTP
1306 ERROR("You do not have SCTP support enabled!");
1307#else
1308 socket_type = SOCK_STREAM;
1309 protocol = IPPROTO_SCTP;
1310#endif
1311 break;
1312 case T_TLS:
1313#ifndef USE_TLS
1314 ERROR("You do not have TLS support enabled!");
1315#endif
1316 case T_TCP:
1317 socket_type = SOCK_STREAM;
1318 protocol = IPPROTO_TCP;
1319 break;
1320 }
1321
1322 if ((fd = socket(use_ipv6 ? AF_INET6 : AF_INET, socket_type, protocol))== -1) {
1323 ERROR_NO("Unable to get a %s socket (3)", TRANSPORT_TO_STRING(transport));
1324 }
1325
1326 return fd;
1327}
1328
1329SIPpSocket *new_sipp_socket(bool use_ipv6, int transport) {
1330 SIPpSocket *ret;

Callers 2

new_sipp_socketFunction · 0.85
reconnectMethod · 0.85

Calls 2

ERRORFunction · 0.85
ERROR_NOFunction · 0.85

Tested by

no test coverage detected