All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
proto.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15  */
16 #ifndef _FR_PROTO_H
17 #define _FR_PROTO_H
18 /**
19  * $Id: 191f48450dd4aded7476570248b771ecf1829dd8 $
20  *
21  * @file include/proto.h
22  * @brief Protocol encoder/decoder support functions
23  *
24  * @copyright 2015 The FreeRADIUS server project
25  */
26 RCSIDH(proto_h, "$Id: 191f48450dd4aded7476570248b771ecf1829dd8 $")
27 
28 #include <freeradius-devel/libradius.h>
29 #include <freeradius-devel/dict.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #ifndef NDEBUG
36 # define FR_PROTO_TRACE(_x, ...) if (fr_log_fp && (fr_debug_lvl > 3)) fr_proto_print(__FILE__, __LINE__, _x, ## __VA_ARGS__)
37 # define FR_PROTO_HEX_DUMP(_x, _y, _z) if (fr_log_fp && (fr_debug_lvl > 3)) fr_proto_print_hex_data(__FILE__, __LINE__, _x, _y, _z)
38 # define FR_PROTO_STACK_PRINT(_x, _y) if (fr_log_fp && (fr_debug_lvl > 3)) fr_proto_tlv_stack_print( __FILE__, __LINE__, __FUNCTION__, _x, _y)
39 #else
40 # define FR_PROTO_TRACE(_x, ...)
41 # define FR_PROTO_HEX_DUMP(_x, _y, _z)
42 # define FR_PROTO_STACK_PRINT(_x, _y)
43 #endif
44 
45 void fr_proto_print(char const *file, int line, char const *fmt, ...) CC_HINT(format (printf, 3, 4));
46 
47 void fr_proto_print_hex_data(char const *file, int line, char const *msg, uint8_t const *data, size_t len);
48 
49 void fr_proto_tlv_stack_print(char const *file, int line, char const *func, fr_dict_attr_t const **tlv_stack, unsigned int depth);
50 
51 void fr_proto_tlv_stack_build(fr_dict_attr_t const **tlv_stack, fr_dict_attr_t const *da);
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 #endif /* _FR_PROTO_H */
#define RCSIDH(h, id)
Definition: build.h:136
Dictionary attribute.
Definition: dict.h:77
#define CC_HINT(_x)
Definition: build.h:71
void void fr_proto_print_hex_data(char const *file, int line, char const *msg, uint8_t const *data, size_t len)
Definition: proto.c:49
uint8_t data[]
Definition: eap_pwd.h:625
void fr_proto_print(char const *file, int line, char const *fmt,...) CC_HINT(format(printf
void fr_proto_tlv_stack_print(char const *file, int line, char const *func, fr_dict_attr_t const **tlv_stack, unsigned int depth)
Definition: proto.c:69
void fr_proto_tlv_stack_build(fr_dict_attr_t const **tlv_stack, fr_dict_attr_t const *da)
Definition: proto.c:94