The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions | Variables
packet.c File Reference

fr_packet_t alloc/free functions More...

#include <freeradius-devel/server/packet.h>
#include <freeradius-devel/util/pair_legacy.h>
+ Include dependency graph for packet.c:

Go to the source code of this file.

Functions

int fr_packet_pairs_from_packet (TALLOC_CTX *ctx, fr_pair_list_t *list, fr_packet_t const *packet)
 Allocate a "Net." struct with src/dst host and port. More...
 
void fr_packet_pairs_to_packet (fr_packet_t *packet, fr_pair_list_t const *list)
 Convert pairs to information in a packet. More...
 
static int inet2pairs (TALLOC_CTX *ctx, fr_pair_list_t *list, fr_dict_attr_t const *attr_ip, fr_dict_attr_t const *attr_port, fr_ipaddr_t const *ipaddr, uint16_t port)
 
void packet_global_free (void)
 
int packet_global_init (void)
 Initialises the Net. More...
 
static void pairs2inet (fr_ipaddr_t *ipaddr, uint16_t *port, fr_pair_list_t const *list, fr_dict_attr_t const *attr_ip, fr_dict_attr_t const *attr_port)
 

Variables

static fr_dict_attr_t const * attr_net
 
static fr_dict_attr_t const * attr_net_dst
 
static fr_dict_attr_t const * attr_net_dst_ip
 
static fr_dict_attr_t const * attr_net_dst_port
 
static fr_dict_attr_t const * attr_net_src
 
static fr_dict_attr_t const * attr_net_src_ip
 
static fr_dict_attr_t const * attr_net_src_port
 
static fr_dict_attr_t const * attr_net_timestamp
 
static fr_dict_t const * dict_freeradius
 
fr_dict_autoload_t util_packet_dict []
 
fr_dict_attr_autoload_t util_packet_dict_attr []
 

Detailed Description

fr_packet_t alloc/free functions

Definition in file packet.c.

Function Documentation

◆ fr_packet_pairs_from_packet()

int fr_packet_pairs_from_packet ( TALLOC_CTX *  ctx,
fr_pair_list_t list,
fr_packet_t const *  packet 
)

Allocate a "Net." struct with src/dst host and port.

Parameters
ctxThe context in which the packet is allocated.
[in]listfr_pair_list_t value to resolve to fr_packet_t.
[out]packetThe request packet.
Returns
  • 0 on success
  • <0 on error.

Definition at line 86 of file packet.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_packet_pairs_to_packet()

void fr_packet_pairs_to_packet ( fr_packet_t packet,
fr_pair_list_t const *  list 
)

Convert pairs to information in a packet.

Parameters
packetthe packet to send
listthe list to check for Net.*

Definition at line 136 of file packet.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inet2pairs()

static int inet2pairs ( TALLOC_CTX *  ctx,
fr_pair_list_t list,
fr_dict_attr_t const *  attr_ip,
fr_dict_attr_t const *  attr_port,
fr_ipaddr_t const *  ipaddr,
uint16_t  port 
)
static

Definition at line 59 of file packet.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ packet_global_free()

void packet_global_free ( void  )

Definition at line 176 of file packet.c.

+ Here is the caller graph for this function:

◆ packet_global_init()

int packet_global_init ( void  )

Initialises the Net.

packet attributes.

Note
Call packet_global_free() when the server is done to avoid leaks.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 163 of file packet.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pairs2inet()

static void pairs2inet ( fr_ipaddr_t ipaddr,
uint16_t port,
fr_pair_list_t const *  list,
fr_dict_attr_t const *  attr_ip,
fr_dict_attr_t const *  attr_port 
)
static

Definition at line 119 of file packet.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ attr_net

fr_dict_attr_t const* attr_net
static

Definition at line 36 of file packet.c.

◆ attr_net_dst

fr_dict_attr_t const* attr_net_dst
static

Definition at line 40 of file packet.c.

◆ attr_net_dst_ip

fr_dict_attr_t const* attr_net_dst_ip
static

Definition at line 41 of file packet.c.

◆ attr_net_dst_port

fr_dict_attr_t const* attr_net_dst_port
static

Definition at line 42 of file packet.c.

◆ attr_net_src

fr_dict_attr_t const* attr_net_src
static

Definition at line 37 of file packet.c.

◆ attr_net_src_ip

fr_dict_attr_t const* attr_net_src_ip
static

Definition at line 38 of file packet.c.

◆ attr_net_src_port

fr_dict_attr_t const* attr_net_src_port
static

Definition at line 39 of file packet.c.

◆ attr_net_timestamp

fr_dict_attr_t const* attr_net_timestamp
static

Definition at line 43 of file packet.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 28 of file packet.c.

◆ util_packet_dict

fr_dict_autoload_t util_packet_dict
Initial value:
= {
{ .out = &dict_freeradius, .proto = "freeradius" },
{ NULL }
}
static fr_dict_t const * dict_freeradius
Definition: packet.c:28

Definition at line 31 of file packet.c.

◆ util_packet_dict_attr

fr_dict_attr_autoload_t util_packet_dict_attr
Initial value:
= {
{ .out = &attr_net, .name = "Net", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
{ .out = &attr_net_src, .name = "Net.Src", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
{ .out = &attr_net_dst, .name = "Net.Dst", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
{ .out = &attr_net_src_ip, .name = "Net.Src.IP", .type = FR_TYPE_COMBO_IP_ADDR, .dict = &dict_freeradius },
{ .out = &attr_net_src_port, .name = "Net.Src.Port", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
{ .out = &attr_net_dst_ip, .name = "Net.Dst.IP", .type = FR_TYPE_COMBO_IP_ADDR, .dict = &dict_freeradius },
{ .out = &attr_net_dst_port, .name = "Net.Dst.Port", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
{ .out = &attr_net_timestamp, .name = "Net.Timestamp", .type = FR_TYPE_DATE, .dict = &dict_freeradius },
{ NULL }
}
static fr_dict_attr_t const * attr_net_src
Definition: packet.c:37
static fr_dict_attr_t const * attr_net_dst_port
Definition: packet.c:42
static fr_dict_attr_t const * attr_net_timestamp
Definition: packet.c:43
static fr_dict_attr_t const * attr_net
Definition: packet.c:36
static fr_dict_attr_t const * attr_net_dst
Definition: packet.c:40
static fr_dict_attr_t const * attr_net_src_ip
Definition: packet.c:38
static fr_dict_attr_t const * attr_net_dst_ip
Definition: packet.c:41
static fr_dict_attr_t const * attr_net_src_port
Definition: packet.c:39
@ FR_TYPE_TLV
Contains nested attributes.
Definition: merged_model.c:118
@ FR_TYPE_UINT16
16 Bit unsigned integer.
Definition: merged_model.c:98
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
Definition: merged_model.c:111
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
Definition: merged_model.c:91

Definition at line 46 of file packet.c.