All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
protocol.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_PROTOCOL_H
17 #define FR_PROTOCOL_H
18 /**
19  * $Id: b0d31a8b4bf5f53462736f0d83e7c234558caf7b $
20  *
21  * @file include/protocol.h
22  * @brief Protocol module API.
23  *
24  * @copyright 2013 Alan DeKok
25  */
26 RCSIDH(protocol_h, "$Id: b0d31a8b4bf5f53462736f0d83e7c234558caf7b $")
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*
33  * We'll use this below.
34  */
36 typedef void (*rad_listen_free_t)(rad_listen_t *);
37 typedef ssize_t (*rad_listen_size_t)(uint8_t const *data, size_t data_len);
38 
39 typedef struct fr_protocol_t {
40  uint64_t magic; //!< Used to validate loaded library
41  char const *name; //!< The name of the protocol
42  size_t inst_size;
44 
45  uint32_t transports;
46  bool tls;
47 
49 
60 
61 #define TRANSPORT_TCP (1 << IPPROTO_TCP)
62 #define TRANSPORT_UDP (1 << IPPROTO_UDP)
63 #define TRANSPORT_DUAL (TRANSPORT_UDP | TRANSPORT_TCP)
64 
65 /*
66  * @todo: fix for later
67  */
68 int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this);
69 int common_socket_open(CONF_SECTION *cs, rad_listen_t *this);
70 int common_socket_print(rad_listen_t const *this, char *buffer, size_t bufsize);
71 void common_packet_debug(REQUEST *request, RADIUS_PACKET *packet, bool received);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* FR_PROTOCOL_H */
#define RCSIDH(h, id)
Definition: build.h:136
rad_listen_free_t free
Definition: protocol.h:52
rad_listen_debug_t debug
Definition: protocol.h:56
rad_listen_print_t print
Definition: protocol.h:55
int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
Definition: listen.c:1274
void common_packet_debug(REQUEST *request, RADIUS_PACKET *packet, bool received)
Definition: listen.c:1153
rad_listen_parse_t open
Definition: protocol.h:51
rad_listen_encode_t encode
Definition: protocol.h:57
void(* rad_listen_debug_t)(REQUEST *, RADIUS_PACKET *, bool received)
Definition: listen.h:65
Defines a CONF_PAIR to C data type mapping.
Definition: conffile.h:267
rad_listen_recv_t recv
Definition: protocol.h:53
int(* rad_listen_encode_t)(rad_listen_t *, REQUEST *)
Definition: listen.h:66
size_t inst_size
Definition: protocol.h:42
CONF_PARSER * proto_config
Definition: protocol.h:43
int(* rad_listen_decode_t)(rad_listen_t *, REQUEST *)
Definition: listen.h:67
int(* rad_listen_print_t)(rad_listen_t const *, char *, size_t)
Definition: listen.h:64
struct fr_protocol_t fr_protocol_t
rad_listen_size_t size
Definition: protocol.h:48
int common_socket_open(CONF_SECTION *cs, rad_listen_t *this)
Definition: listen.c:1599
rad_listen_decode_t decode
Definition: protocol.h:58
void(* rad_listen_free_t)(rad_listen_t *)
Definition: protocol.h:36
rad_listen_send_t send
Definition: protocol.h:54
ssize_t(* rad_listen_size_t)(uint8_t const *data, size_t data_len)
Definition: protocol.h:37
uint8_t data[]
Definition: eap_pwd.h:625
int(* rad_listen_parse_t)(CONF_SECTION *, rad_listen_t *)
Definition: protocol.h:35
char const * name
The name of the protocol.
Definition: protocol.h:41
uint32_t transports
Definition: protocol.h:45
uint64_t magic
Used to validate loaded library.
Definition: protocol.h:40
int(* rad_listen_recv_t)(rad_listen_t *)
Definition: listen.h:62
int(* rad_listen_send_t)(rad_listen_t *, REQUEST *)
Definition: listen.h:63
rad_listen_parse_t parse
Definition: protocol.h:50
int common_socket_print(rad_listen_t const *this, char *buffer, size_t bufsize)
Definition: listen.c:1021