#include <arpa/inet.h>#include <errno.h>#include <ifaddrs.h>#include <linux/version.h>#include <netinet/in.h>#include <net/if.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h>#include <unistd.h>#include "log.h"#include "net_definitions.h"#include "net_utils.h"#include "socket_helpers.h"#include "ssdp_static_defs.h"
Go to the source code of this file.
Macros | |
| #define | CHECK_KERNEL_VERSION(...) LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) |
Functions | |
| int | set_send_timeout (SOCKET sock, int timeout) |
| int | set_receive_timeout (SOCKET sock, int timeout) |
| int | set_reuseaddr (SOCKET sock) |
| int | set_reuseport (SOCKET sock) |
| int | set_keepalive (SOCKET sock, BOOL keepalive) |
| int | set_ttl (SOCKET sock, int family, int ttl) |
| int | disable_multicast_loopback (SOCKET sock, int family) |
| int | join_multicast_group (SOCKET sock, char *multicast_group, char *interface_ip) |
| SOCKET | setup_socket (socket_conf_s *conf) |
Helper functions for creating and configuring sockets.
Definition in file socket_helpers.c.
| int disable_multicast_loopback | ( | SOCKET | sock, |
| int | family | ||
| ) |
Disable multicast loopback traffic for a socket.
| sock | The socket to disable it for. |
| family | Socket IP type (AF_INET or AF_INET6). |
Definition at line 118 of file socket_helpers.c.
| int join_multicast_group | ( | SOCKET | sock, |
| char * | multicast_group, | ||
| char * | interface_ip | ||
| ) |
Join a multicast group.
| multicast_group | The group to join. |
| interface_ip | The interface to join on. |
Definition at line 135 of file socket_helpers.c.
Set the keepalive for a socket.
| sock | The socket to enable keepalive for. |
| keepalive | TRUE to enable keepalive for this socket, FALSE to disable it. |
Definition at line 93 of file socket_helpers.c.
| int set_receive_timeout | ( | SOCKET | sock, |
| int | timeout | ||
| ) |
Set the recv-timeout for a socket.
| sock | The socket to set the timeout for. |
| timeout | The timeout value to set. |
Definition at line 48 of file socket_helpers.c.
| int set_reuseaddr | ( | SOCKET | sock | ) |
Set the reuseaddr for a socket. This enables the socket to receive from an address already in use (address and port in linux >= 3.9).
| sock | The socket to set the reuseaddr for. |
Definition at line 64 of file socket_helpers.c.
| int set_reuseport | ( | SOCKET | sock | ) |
Set the reuseport for a socket. This enable socket to receive from a port already in use (no support in linux < 3.9).
| sock | The socket to set the reuseport for. |
Definition at line 75 of file socket_helpers.c.
| int set_send_timeout | ( | SOCKET | sock, |
| int | timeout | ||
| ) |
Set the send-timeout for a socket.
| sock | The socket to set the timeout for. |
| timeout | The timeout value to set. |
Definition at line 32 of file socket_helpers.c.
| int set_ttl | ( | SOCKET | sock, |
| int | family, | ||
| int | ttl | ||
| ) |
Set the Time-To-Live (ttl) for a socket.
| sock | The socket to set the ttl for. |
| ttl | The ttl value to set. |
Definition at line 103 of file socket_helpers.c.
| SOCKET setup_socket | ( | socket_conf_s * | conf | ) |
Create and configure a new socket.
| conf | The socket configuration to use when creating and configuring the socket. |
Definition at line 375 of file socket_helpers.c.
1.8.8