The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
internal.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 
18 #include <freeradius-devel/util/pair.h>
19 #include <freeradius-devel/util/talloc.h>
20 
21 /*
22  * Encoding byte 0
23  */
24 #define FR_INTERNAL_MASK_TYPE 0xe0
25 #define FR_INTERNAL_MASK_LEN 0x1c
26 #define FR_INTERNAL_FLAG_EXTENDED 0x01
27 #define FR_INTERNAL_FLAG_TAINTED 0x02
28 
29 /*
30  * Encoding byte 1
31  */
32 #define FR_INTERNAL_FLAG_UNKNOWN 0x80
33 #define FR_INTERNAL_FLAG_INTERNAL 0x40
34 
35 typedef struct {
36  bool allow_name_only; //!< Allow name only pairs. This should be set
37  ///< to true when encoding data that's being
38  ///< passed between threads in the same process.
39  ///< It should be set to false when encoding
40  ///< data that's stored in an external database
41  ///< or in the cache module.
43 
44 /*
45  * $Id: e4c6773163c6d77692149c0ff062ae8f69a11d8e $
46  *
47  * @file protocols/internal/internal.h
48  * @brief Structures and prototypes for the internal encoder/decoder.
49  *
50  * @copyright 2020 The FreeRADIUS server project
51  */
52 
54 
56 
58  uint8_t const *data, size_t data_len, void *decode_ctx);
59 
61  fr_dbuff_t *dbuff, void *decode_ctx);
62 
64  fr_dbuff_t *dbuff, void *decode_ctx);
ssize_t fr_internal_decode_list_dbuff(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *dbuff, void *decode_ctx)
Retrieve all pairs from the dbuff.
Definition: decode.c:310
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
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.
Definition: encode.c:303
ssize_t fr_internal_decode_pair_dbuff(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *dbuff, void *decode_ctx)
Definition: decode.c:279
bool allow_name_only
Allow name only pairs.
Definition: internal.h:36
ssize_t fr_internal_decode_pair(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, uint8_t const *data, size_t data_len, void *decode_ctx)
Create a single fr_pair_t and all its nesting.
Definition: decode.c:273
long int ssize_t
Definition: merged_model.c:24
unsigned char uint8_t
Definition: merged_model.c:30
static fr_internal_encode_ctx_t encode_ctx
static fr_slen_t parent
Definition: pair.h:844
static fr_slen_t data
Definition: value.h:1259
static size_t char ** out
Definition: value.h:984