All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
packet.c File Reference
#include <freeradius-devel/libradius.h>
#include <fcntl.h>
+ Include dependency graph for packet.c:

Go to the source code of this file.

Data Structures

struct  fr_packet_list_t
 
struct  fr_packet_socket_t
 

Macros

#define FNV_MAGIC_PRIME   (0x01000193)
 
#define ID_i   ((i + start_i) & SOCKOFFSET_MASK)
 
#define ID_j   ((j + start_j) & 0x1f)
 
#define ID_k   ((k + start_k) & 0x07)
 
#define MAX_SOCKETS   (256)
 
#define SOCK2OFFSET(sockfd)   ((sockfd * FNV_MAGIC_PRIME) & SOCKOFFSET_MASK)
 
#define SOCKOFFSET_MASK   (MAX_SOCKETS - 1)
 

Typedefs

typedef struct fr_packet_socket_t fr_packet_socket_t
 

Functions

int fr_is_inaddr_any (fr_ipaddr_t *ipaddr)
 Determine if an address is the INADDR_ANY address for its address family. More...
 
int fr_packet_cmp (RADIUS_PACKET const *a, RADIUS_PACKET const *b)
 
void fr_packet_header_print (FILE *fp, RADIUS_PACKET *packet, bool received)
 
fr_packet_list_tfr_packet_list_create (int alloc_id)
 
int fr_packet_list_fd_set (fr_packet_list_t *pl, fd_set *set)
 
RADIUS_PACKET ** fr_packet_list_find (fr_packet_list_t *pl, RADIUS_PACKET *request)
 
RADIUS_PACKET ** fr_packet_list_find_byreply (fr_packet_list_t *pl, RADIUS_PACKET *reply)
 
void fr_packet_list_free (fr_packet_list_t *pl)
 
bool fr_packet_list_id_alloc (fr_packet_list_t *pl, int proto, RADIUS_PACKET **request_p, void **pctx)
 
bool fr_packet_list_id_free (fr_packet_list_t *pl, RADIUS_PACKET *request, bool yank)
 
bool fr_packet_list_insert (fr_packet_list_t *pl, RADIUS_PACKET **request_p)
 
uint32_t fr_packet_list_num_elements (fr_packet_list_t *pl)
 
uint32_t fr_packet_list_num_incoming (fr_packet_list_t *pl)
 
uint32_t fr_packet_list_num_outgoing (fr_packet_list_t *pl)
 
RADIUS_PACKETfr_packet_list_recv (fr_packet_list_t *pl, fd_set *set)
 
bool fr_packet_list_socket_add (fr_packet_list_t *pl, int sockfd, int proto, fr_ipaddr_t *dst_ipaddr, uint16_t dst_port, void *ctx)
 
bool fr_packet_list_socket_del (fr_packet_list_t *pl, int sockfd)
 
bool fr_packet_list_socket_freeze (fr_packet_list_t *pl, int sockfd)
 
bool fr_packet_list_socket_thaw (fr_packet_list_t *pl, int sockfd)
 
int fr_packet_list_walk (fr_packet_list_t *pl, void *ctx, rb_walker_t callback)
 
bool fr_packet_list_yank (fr_packet_list_t *pl, RADIUS_PACKET *request)
 
void fr_request_from_reply (RADIUS_PACKET *request, RADIUS_PACKET const *reply)
 
int fr_socket (fr_ipaddr_t *ipaddr, uint16_t port)
 
static fr_packet_socket_tfr_socket_find (fr_packet_list_t *pl, int sockfd)
 
static int packet_entry_cmp (void const *one, void const *two)
 

Data Structure Documentation

struct fr_packet_list_t

Definition at line 274 of file packet.c.

+ Collaboration diagram for fr_packet_list_t:
Data Fields
int alloc_id
int last_recv
uint32_t num_outgoing
int num_sockets
fr_packet_socket_t sockets[MAX_SOCKETS]
rbtree_t * tree
struct fr_packet_socket_t

Definition at line 241 of file packet.c.

+ Collaboration diagram for fr_packet_socket_t:
Data Fields
void * ctx
bool dont_use
int dst_any
fr_ipaddr_t dst_ipaddr
uint16_t dst_port
uint8_t id[32]
uint32_t num_outgoing
int proto
int sockfd
int src_any
fr_ipaddr_t src_ipaddr
uint16_t src_port

Macro Definition Documentation

#define FNV_MAGIC_PRIME   (0x01000193)

Definition at line 265 of file packet.c.

#define ID_i   ((i + start_i) & SOCKOFFSET_MASK)
#define ID_j   ((j + start_j) & 0x1f)
#define ID_k   ((k + start_k) & 0x07)
#define MAX_SOCKETS   (256)

Definition at line 266 of file packet.c.

#define SOCK2OFFSET (   sockfd)    ((sockfd * FNV_MAGIC_PRIME) & SOCKOFFSET_MASK)

Definition at line 268 of file packet.c.

#define SOCKOFFSET_MASK   (MAX_SOCKETS - 1)

Definition at line 267 of file packet.c.

Typedef Documentation

Function Documentation

int fr_is_inaddr_any ( fr_ipaddr_t ipaddr)

Determine if an address is the INADDR_ANY address for its address family.

Parameters
ipaddrto check.
Returns
  • 0 if it's not.
  • 1 if it is.
  • -1 on error.

Definition at line 91 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int fr_packet_cmp ( RADIUS_PACKET const *  a,
RADIUS_PACKET const *  b 
)

Definition at line 40 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fr_packet_header_print ( FILE *  fp,
RADIUS_PACKET packet,
bool  received 
)

Definition at line 962 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

fr_packet_list_t* fr_packet_list_create ( int  alloc_id)

Definition at line 464 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int fr_packet_list_fd_set ( fr_packet_list_t pl,
fd_set *  set 
)

Definition at line 874 of file packet.c.

+ Here is the caller graph for this function:

RADIUS_PACKET** fr_packet_list_find ( fr_packet_list_t pl,
RADIUS_PACKET request 
)

Definition at line 501 of file packet.c.

+ Here is the call graph for this function:

RADIUS_PACKET** fr_packet_list_find_byreply ( fr_packet_list_t pl,
RADIUS_PACKET reply 
)

Definition at line 514 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fr_packet_list_free ( fr_packet_list_t pl)

Definition at line 452 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fr_packet_list_id_alloc ( fr_packet_list_t pl,
int  proto,
RADIUS_PACKET **  request_p,
void **  pctx 
)

Definition at line 611 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fr_packet_list_id_free ( fr_packet_list_t pl,
RADIUS_PACKET request,
bool  yank 
)

Definition at line 830 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fr_packet_list_insert ( fr_packet_list_t pl,
RADIUS_PACKET **  request_p 
)

Definition at line 493 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t fr_packet_list_num_elements ( fr_packet_list_t pl)

Definition at line 584 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t fr_packet_list_num_incoming ( fr_packet_list_t pl)

Definition at line 940 of file packet.c.

+ Here is the call graph for this function:

uint32_t fr_packet_list_num_outgoing ( fr_packet_list_t pl)

Definition at line 952 of file packet.c.

+ Here is the caller graph for this function:

RADIUS_PACKET* fr_packet_list_recv ( fr_packet_list_t pl,
fd_set *  set 
)

Definition at line 901 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fr_packet_list_socket_add ( fr_packet_list_t pl,
int  sockfd,
int  proto,
fr_ipaddr_t dst_ipaddr,
uint16_t  dst_port,
void *  ctx 
)

Definition at line 356 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fr_packet_list_socket_del ( fr_packet_list_t pl,
int  sockfd 
)

Definition at line 338 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fr_packet_list_socket_freeze ( fr_packet_list_t pl,
int  sockfd 
)

Definition at line 305 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fr_packet_list_socket_thaw ( fr_packet_list_t pl,
int  sockfd 
)

Definition at line 324 of file packet.c.

+ Here is the call graph for this function:

int fr_packet_list_walk ( fr_packet_list_t pl,
void *  ctx,
rb_walker_t  callback 
)

Definition at line 867 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fr_packet_list_yank ( fr_packet_list_t pl,
RADIUS_PACKET request 
)

Definition at line 571 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fr_request_from_reply ( RADIUS_PACKET request,
RADIUS_PACKET const *  reply 
)

Definition at line 118 of file packet.c.

int fr_socket ( fr_ipaddr_t ipaddr,
uint16_t  port 
)

Definition at line 136 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static fr_packet_socket_t* fr_socket_find ( fr_packet_list_t pl,
int  sockfd 
)
static

Definition at line 289 of file packet.c.

+ Here is the caller graph for this function:

static int packet_entry_cmp ( void const *  one,
void const *  two 
)
static

Definition at line 444 of file packet.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: