Defines | |
#define | MTU 1400 |
Constant for the size of ethernet frame. | |
#define | IP_HEADER (5*4) |
Constant for the size of the IP Header. | |
#define | UDP_HEADER (2*4) |
Constant for the size of the UDP header. | |
#define | UDP_PAYLOAD_SIZE (MTU - (IP_HEADER + UDP_HEADER)) |
Constant for maximum UDP packet payload size. | |
#define | UDPSendTo(_socketfd, _data, _data_len, _to, _to_len) sendto(_socketfd, _data, _data_len, 0, _to, _to_len) |
Macro to simplify sending data to a socket. | |
#define | UDPReceiveFrom(_socketfd, _data, _data_len, _from, _from_len) recvfrom(_socketfd, _data, _data_len, 0, _from, _from_len) |
Macro to simplify receiving data from a socket. | |
Functions | |
int | UDPCreateSocket (sa_family_t family) |
Creates a UDP socket for the given family. |
#define MTU 1400 |
Constant for the size of ethernet frame.
This is a conservative estimate.
#define UDP_PAYLOAD_SIZE (MTU - (IP_HEADER + UDP_HEADER)) |
Constant for maximum UDP packet payload size.
This is a conservative estimate.
#define UDPReceiveFrom | ( | _socketfd, | |||
_data, | |||||
_data_len, | |||||
_from, | |||||
_from_len | ) | recvfrom(_socketfd, _data, _data_len, 0, _from, _from_len) |
Macro to simplify receiving data from a socket.
_socketfd | The socket file descriptor to receive data from. | |
_data | The buffer to receive the data in. | |
_data_len | The length of the buffer. | |
_from | Address buffer to receive the address of the sender. | |
_from_len | The length of the _from buffer. |
#define UDPSendTo | ( | _socketfd, | |||
_data, | |||||
_data_len, | |||||
_to, | |||||
_to_len | ) | sendto(_socketfd, _data, _data_len, 0, _to, _to_len) |
Macro to simplify sending data to a socket.
_socketfd | The socket file descriptor to send the data to. | |
_data | Buffer containing the data to send. | |
_data_len | Length of the data to send. | |
_to | The buffer containing the address to send the data to. | |
_to_len | Length of the _to buffer, |
int UDPCreateSocket | ( | sa_family_t | family | ) |
Creates a UDP socket for the given family.
The socket family is intended to be either PF_INET or PF_INET6.
family | Either PF_INET or PF_INET6. |