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

Functions to encode data in our internal structure. More...

#include <freeradius-devel/internal/internal.h>
#include <freeradius-devel/io/pair.h>
#include <freeradius-devel/io/test_point.h>
#include <freeradius-devel/util/net.h>
#include <freeradius-devel/util/proto.h>
+ Include dependency graph for encode.c:

Go to the source code of this file.

Functions

ssize_t fr_internal_encode_list (fr_dbuff_t *dbuff, fr_pair_list_t const *list, void *encode_ctx)
 Encode a list of pairs using the internal encoder. More...
 
ssize_t fr_internal_encode_pair (fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *encode_ctx)
 Encode a data structure into an internal attribute. More...
 
static ssize_t internal_encode (fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, unsigned int depth, fr_dcursor_t *cursor, void *encode_ctx)
 We use the same header for all types. More...
 

Variables

static fr_internal_encode_ctx_t default_encode_ctx = { }
 
fr_test_point_pair_encode_t internal_tp_encode_pair
 

Detailed Description

Functions to encode data in our internal structure.

Id
bb86a3967066bfb6b689cddd3a3e97e5eec5fc10

Because what we need is yet ANOTHER serialisation scheme.

Definition in file encode.c.

Function Documentation

◆ fr_internal_encode_list()

ssize_t fr_internal_encode_list ( fr_dbuff_t dbuff,
fr_pair_list_t const *  list,
void *  encode_ctx 
)

Encode a list of pairs using the internal encoder.

Parameters
[out]dbuffWhere to write encoded data.
[in]listList of attributes to encode.
[in]encode_ctxAdditional data to be used by the encoder.
Returns
  • length of encoded data on success
  • < 0 on failure

Definition at line 303 of file encode.c.

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

◆ fr_internal_encode_pair()

ssize_t fr_internal_encode_pair ( fr_dbuff_t dbuff,
fr_dcursor_t cursor,
void *  encode_ctx 
)

Encode a data structure into an internal attribute.

Parameters
[in,out]dbuffWhere to write encoded data and how much one can write.
[in]cursorSpecifying attribute to encode.
[in]encode_ctxAdditional data such as the shared secret to use.
Returns
  • >0 The number of bytes written to out.
  • 0 Nothing to encode (or attribute skipped).
  • <0 an error occurred.

Definition at line 281 of file encode.c.

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

◆ internal_encode()

static ssize_t internal_encode ( fr_dbuff_t dbuff,
fr_da_stack_t da_stack,
unsigned int  depth,
fr_dcursor_t cursor,
void *  encode_ctx 
)
static

We use the same header for all types.

Encode the value of the value pair the cursor currently points at.

Parameters
dbuffdata buffer to place the encoded data in
da_stackda stack corresponding to the value pair
depthin da_stack
cursorcursor whose current value is the one to be encoded
encode_ctxencoder context
Returns
either a negative number, indicating an error or the number of bytes used to encode the value

Definition at line 52 of file encode.c.

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

Variable Documentation

◆ default_encode_ctx

fr_internal_encode_ctx_t default_encode_ctx = { }
static

Definition at line 35 of file encode.c.

◆ internal_tp_encode_pair

fr_test_point_pair_encode_t internal_tp_encode_pair
Initial value:
= {
.test_ctx = NULL,
}
ssize_t fr_internal_encode_pair(fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *encode_ctx)
Encode a data structure into an internal attribute.
Definition: encode.c:281

Definition at line 326 of file encode.c.