#include <stdio.h>
#include <errno.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <linux/if.h>
#include <linux/sockios.h>
#include <sys/ioctl.h>
Go to the source code of this file.
Defines | |
#define | MAX_IP_ADDRESS_STR_SIZE 16 |
Maximum number of characters for an IP address (XXX.XXX.XXX.XXX), including the terminal zero. | |
Functions | |
int | create_socket (int port, struct sockaddr_in *add, char *host, char *interface, int len, unsigned long int *broadcast, unsigned long int *netmask, unsigned long int *myip, int(*syslog)(const char *file, const char *fmt,...), char *log) |
Create a UDP socket and bind it to a given port and a given network interface. Note that this socket is allowed to send broadcast messages. More... | |
char * | get_last_socket_error () |
Returns a pointer to the last error message. More... | |
void | get_remote_address (struct sockaddr_in *sender, char *ip, int *port) |
Return the IP address and the port number of a remote end point. More... |
Definition in file sockets.h.
|
Create a UDP socket and bind it to a given port and a given network interface. Note that this socket is allowed to send broadcast messages.
int syslog (const char *file, const char * fmt,...) Upon successful completion, the function returns the value 0. To desactivate logging, just set this pointer to NULL. If NULL, logging service is not activated (no matter the value of 'log').
Definition at line 67 of file sockets.c. References get_doted_ip(), last_error, MAX_INTERFACE, my_fake_syslog(), my_syslog(), and SOCKET_ERROR_SIZE. Referenced by main(). |
|
Returns a pointer to the last error message.
Definition at line 30 of file sockets.c. References last_error. Referenced by main(). |
|
Return the IP address and the port number of a remote end point.
Definition at line 409 of file sockets.c. Referenced by packet_dump(). |