All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
udp.c File Reference

Functions to send/receive UDP packets. More...

#include <freeradius-devel/udp.h>
+ Include dependency graph for udp.c:

Go to the source code of this file.

Macros

#define FR_DEBUG_STRERROR_PRINTF   if (fr_debug_lvl) fr_strerror_printf
 
#define UDP_UNUSED   UNUSED
 

Functions

ssize_t udp_recv (int sockfd, void *data, size_t data_len, int flags, fr_ipaddr_t *src_ipaddr, uint16_t *src_port, fr_ipaddr_t *dst_ipaddr, uint16_t *dst_port, UDP_UNUSED int *if_index, struct timeval *when)
 Read a UDP packet. More...
 
void udp_recv_discard (int sockfd)
 Discard the next UDP packet. More...
 
ssize_t udp_recv_peek (int sockfd, void *data, size_t data_len, int flags, fr_ipaddr_t *src_ipaddr, uint16_t *src_port)
 Peek at the header of a UDP packet. More...
 
ssize_t udp_send (int sockfd, void *data, size_t data_len, int flags, UDP_UNUSED fr_ipaddr_t *src_ipaddr, UDP_UNUSED uint16_t src_port, UDP_UNUSED int if_index, fr_ipaddr_t *dst_ipaddr, uint16_t dst_port)
 Send a packet via a UDP socket. More...
 

Detailed Description

Functions to send/receive UDP packets.

Id:
3d1794bffa841e33d7c761f94c6d22b82d62d4fe

Definition in file udp.c.

Macro Definition Documentation

#define FR_DEBUG_STRERROR_PRINTF   if (fr_debug_lvl) fr_strerror_printf

Definition at line 39 of file udp.c.

#define UDP_UNUSED   UNUSED

Definition at line 36 of file udp.c.

Function Documentation

ssize_t udp_recv ( int  sockfd,
void *  data,
size_t  data_len,
int  flags,
fr_ipaddr_t src_ipaddr,
uint16_t *  src_port,
fr_ipaddr_t dst_ipaddr,
uint16_t *  dst_port,
UDP_UNUSED int *  if_index,
struct timeval *  when 
)

Read a UDP packet.

Parameters
[in]sockfdwe're reading from.
[out]datapointer where data will be written
[in]data_lenlength of data to read
[in]flagsfor things
[out]src_ipaddrof the packet.
[out]src_portof the packet.
[out]dst_ipaddrof the packet.
[out]dst_portof the packet.
[out]if_indexof the interface that received the packet.
[out]whenthe packet was received.
Returns
  • > 0 on success (number of bytes read).
  • < 0 on failure.

Definition at line 177 of file udp.c.

+ Here is the call graph for this function:

void udp_recv_discard ( int  sockfd)

Discard the next UDP packet.

Parameters
[in]sockfdwe're reading from.

Definition at line 105 of file udp.c.

+ Here is the caller graph for this function:

ssize_t udp_recv_peek ( int  sockfd,
void *  data,
size_t  data_len,
int  flags,
fr_ipaddr_t src_ipaddr,
uint16_t *  src_port 
)

Peek at the header of a UDP packet.

Parameters
[in]sockfdwe're reading from.
[out]datapointer where data will be written
[in]data_lenlength of data to read
[in]flagsfor things
[out]src_ipaddrof the packet.
[out]src_portof the packet.

Definition at line 125 of file udp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ssize_t udp_send ( int  sockfd,
void *  data,
size_t  data_len,
int  flags,
UDP_UNUSED fr_ipaddr_t src_ipaddr,
UDP_UNUSED uint16_t  src_port,
UDP_UNUSED int  if_index,
fr_ipaddr_t dst_ipaddr,
uint16_t  dst_port 
)

Send a packet via a UDP socket.

Parameters
[in]sockfdwe're reading from.
[in]datapointer to data to send
[in]data_lenlength of data to send
[in]flagsto pass to send(), or sendto()
[in]src_ipaddrof the packet.
[in]src_portof the packet.
[in]if_indexof the packet.
[in]dst_ipaddrof the packet.
[in]dst_portof the packet.

Definition at line 53 of file udp.c.

+ Here is the call graph for this function: