The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions
proto.h File Reference

Protocol encoder/decoder support functions. More...

#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/dict.h>
+ Include dependency graph for proto.h:

Go to the source code of this file.

Data Structures

struct  fr_da_stack_t
 Structure for holding the stack of dictionary attributes being encoded. More...
 

Macros

#define CHECK_FREESPACE(_have, _need)
 
#define FR_PROTO_HEX_DUMP(_data, _data_len, _fmt, ...)   if (fr_debug_lvl >= L_DBG_LVL_4) fr_proto_print_hex_data(__FILE__, __LINE__, _data, _data_len, _fmt, ## __VA_ARGS__)
 
#define FR_PROTO_HEX_MARKER(_data, _data_len, _slen, _fmt, ...)   if (fr_debug_lvl >= L_DBG_LVL_4) fr_proto_print_hex_marker(__FILE__, __LINE__, _data, _data_len, _slen, _fmt, ## __VA_ARGS__)
 
#define FR_PROTO_STACK_PRINT(_stack, _depth)   if (fr_debug_lvl >= L_DBG_LVL_4) fr_proto_da_stack_print(__FILE__, __LINE__, __FUNCTION__, _stack, _depth)
 
#define FR_PROTO_TRACE(_fmt, ...)   if (fr_debug_lvl >= L_DBG_LVL_4) fr_proto_print(__FILE__, __LINE__, _fmt, ## __VA_ARGS__)
 

Functions

void fr_proto_da_stack_build (fr_da_stack_t *stack, fr_dict_attr_t const *da)
 Build a complete DA stack from the da back to the root. More...
 
void fr_proto_da_stack_build_partial (fr_da_stack_t *stack, fr_dict_attr_t const *parent, fr_dict_attr_t const *da)
 Complete the DA stack for a child attribute. More...
 
void fr_proto_da_stack_print (char const *file, int line, char const *func, fr_da_stack_t *da_stack, unsigned int depth)
 
void * fr_proto_next_encodable (fr_dlist_head_t *list, void *current, void *uctx)
 Implements the default iterator to encode pairs belonging to a specific dictionary that are not internal. More...
 
void fr_proto_print (char const *file, int line, char const *fmt,...))
 
void fr_proto_print_hex_data (char const *file, int line, uint8_t const *data, size_t data_len, char const *fmt,...)
 
void fr_proto_print_hex_marker (char const *file, int line, uint8_t const *data, size_t data_len, ssize_t slen, char const *fmt,...)
 

Detailed Description

Protocol encoder/decoder support functions.

Definition in file proto.h.


Data Structure Documentation

◆ fr_da_stack_t

struct fr_da_stack_t

Structure for holding the stack of dictionary attributes being encoded.

Definition at line 54 of file proto.h.

+ Collaboration diagram for fr_da_stack_t:
Data Fields
fr_dict_attr_t const * da[FR_DICT_MAX_TLV_STACK+1] The stack.
uint8_t depth Deepest attribute in the stack.

Macro Definition Documentation

◆ CHECK_FREESPACE

#define CHECK_FREESPACE (   _have,
  _need 
)
Value:
do { \
if (unlikely((size_t)(_have) < (size_t)(_need))) return -((size_t)(_need) - (size_t)(_have)); \
} while (0);
#define unlikely(_x)
Definition: build.h:378
unsigned long int size_t
Definition: merged_model.c:25

Definition at line 34 of file proto.h.

◆ FR_PROTO_HEX_DUMP

#define FR_PROTO_HEX_DUMP (   _data,
  _data_len,
  _fmt,
  ... 
)    if (fr_debug_lvl >= L_DBG_LVL_4) fr_proto_print_hex_data(__FILE__, __LINE__, _data, _data_len, _fmt, ## __VA_ARGS__)

Definition at line 41 of file proto.h.

◆ FR_PROTO_HEX_MARKER

#define FR_PROTO_HEX_MARKER (   _data,
  _data_len,
  _slen,
  _fmt,
  ... 
)    if (fr_debug_lvl >= L_DBG_LVL_4) fr_proto_print_hex_marker(__FILE__, __LINE__, _data, _data_len, _slen, _fmt, ## __VA_ARGS__)

Definition at line 42 of file proto.h.

◆ FR_PROTO_STACK_PRINT

#define FR_PROTO_STACK_PRINT (   _stack,
  _depth 
)    if (fr_debug_lvl >= L_DBG_LVL_4) fr_proto_da_stack_print(__FILE__, __LINE__, __FUNCTION__, _stack, _depth)

Definition at line 43 of file proto.h.

◆ FR_PROTO_TRACE

#define FR_PROTO_TRACE (   _fmt,
  ... 
)    if (fr_debug_lvl >= L_DBG_LVL_4) fr_proto_print(__FILE__, __LINE__, _fmt, ## __VA_ARGS__)

Definition at line 40 of file proto.h.

Function Documentation

◆ fr_proto_da_stack_build()

void fr_proto_da_stack_build ( fr_da_stack_t stack,
fr_dict_attr_t const *  da 
)

Build a complete DA stack from the da back to the root.

Parameters
[out]stackto populate.
[in]dato build the stack for.

Definition at line 118 of file proto.c.

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

◆ fr_proto_da_stack_build_partial()

void fr_proto_da_stack_build_partial ( fr_da_stack_t stack,
fr_dict_attr_t const *  parent,
fr_dict_attr_t const *  da 
)

Complete the DA stack for a child attribute.

Parameters
[out]stackto populate.
[in]parentto populate from.
[in]dato populate to.

Definition at line 159 of file proto.c.

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

◆ fr_proto_da_stack_print()

void fr_proto_da_stack_print ( char const *  file,
int  line,
char const *  func,
fr_da_stack_t da_stack,
unsigned int  depth 
)

Definition at line 73 of file proto.c.

+ Here is the call graph for this function:

◆ fr_proto_next_encodable()

void* fr_proto_next_encodable ( fr_dlist_head_t list,
void *  current,
void *  uctx 
)

Implements the default iterator to encode pairs belonging to a specific dictionary that are not internal.

Parameters
[in]listto iterate over.
[in]currentThe fr_pair_t cursor->current. Will be advanced and checked to see if it matches the specified fr_dict_t.
[in]uctxThe fr_dict_t to search for.
Returns
  • Next matching fr_pair_t.
  • NULL if not more matching fr_pair_ts could be found.

Definition at line 100 of file proto.c.

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

◆ fr_proto_print()

void fr_proto_print ( char const *  file,
int  line,
char const *  fmt,
  ... 
)

Definition at line 27 of file proto.c.

+ Here is the call graph for this function:

◆ fr_proto_print_hex_data()

void fr_proto_print_hex_data ( char const *  file,
int  line,
uint8_t const *  data,
size_t  data_len,
char const *  fmt,
  ... 
)

Definition at line 42 of file proto.c.

+ Here is the call graph for this function:

◆ fr_proto_print_hex_marker()

void fr_proto_print_hex_marker ( char const *  file,
int  line,
uint8_t const *  data,
size_t  data_len,
ssize_t  slen,
char const *  fmt,
  ... 
)

Definition at line 57 of file proto.c.

+ Here is the call graph for this function: