#include "sockets.h"
Go to the source code of this file.
Defines | |
#define | SOCKET_ERROR_SIZE 4096 |
Maximum number of characters for the error message. | |
#define | MAX_INTERFACE 16 |
Maximum number of network interfaces fot the host. | |
Functions | |
char * | get_doted_ip (unsigned long int ip) |
Convert IP address in binary representation (4 bytes in network byte order) into standard numbers-and-dots notation. More... | |
char * | get_last_socket_error () |
Returns a pointer to the last error message. More... | |
int | my_fake_syslog (const char *file, const char *fmt,...) |
Fake logging service. More... | |
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... | |
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... | |
Variables | |
char | last_error [SOCKET_ERROR_SIZE] |
Buffer that will contain the last error message. |
Definition in file sockets.c.
|
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(). |
|
Convert IP address in binary representation (4 bytes in network byte order) into standard numbers-and-dots notation.
Definition at line 430 of file sockets.c. Referenced by create_socket(). |
|
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(). |
|
Fake logging service.
Definition at line 36 of file sockets.c. Referenced by create_socket(). |