The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
protocol.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/**
19 * $Id: 6550c11a88b99d138689f1461e1b28bd7864779e $
20 *
21 * @file lib/server/protocol.h
22 * @brief Protocol module API.
23 *
24 * @copyright 2013 Alan DeKok
25 */
26RCSIDH(protocol_h, "$Id: 6550c11a88b99d138689f1461e1b28bd7864779e $")
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <freeradius-devel/io/base.h>
33
34#include <freeradius-devel/server/dl_module.h>
35#include <freeradius-devel/server/listen.h>
36
37/*
38 * We'll use this below.
39 */
43
44/*
45 * @todo: fix for later
46 */
49int common_socket_print(rad_listen_t const *this, char *buffer, size_t bufsize);
50void common_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *pairs, bool received);
51
52/** Struct exported by a proto_* module
53 *
54 * Used to pass information common to proto_* modules to the server core,
55 * and to register callbacks that get executed when processing packets of this
56 * protocol type.
57 */
58typedef struct rad_protocol_s {
59 DL_MODULE_COMMON; //!< Common fields to all loadable modules.
60
61 uint32_t transports; //!< What can transport this protocol.
62 bool tls; //!< Whether protocol can be wrapped in TLS.
63
64 rad_listen_unlang_t bootstrap; //!< Phase1 - Basic validation checks of virtual server.
65 rad_listen_unlang_t compile; //!< Phase2 - Compile unlang sections in the virtual
66 //!< server that map to packet types used by the protocol.
67
68 rad_listen_parse_t parse; //!< Perform extra processing of the configuration data
69 //!< specified by config.
70
71 rad_listen_parse_t open; //!< Open a descriptor.
72
73 rad_listen_recv_t recv; //!< Read an incoming packet from the descriptor.
74 rad_listen_send_t send; //!< Write an outgoing packet to the descriptor.
75 rad_listen_error_t error; //!< Handle error/eol on the descriptor.
76
77 rad_listen_print_t print; //!< Print a line describing the packet being sent or the
78 //!< packet that was received.
79 rad_listen_debug_t debug; //!< Print an attribute list for debugging.
80
81 rad_listen_encode_t encode; //!< Encode an outgoing packet.
82 rad_listen_decode_t decode; //!< Decode an incoming packet.
84
85#define TRANSPORT_NONE 0
86#define TRANSPORT_TCP (1 << IPPROTO_TCP)
87#define TRANSPORT_UDP (1 << IPPROTO_UDP)
88#define TRANSPORT_DUAL (TRANSPORT_UDP | TRANSPORT_TCP)
89
90#ifdef __cplusplus
91}
92#endif
static int const char char buffer[256]
Definition acutest.h:576
#define RCSIDH(h, id)
Definition build.h:484
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:101
unsigned int uint32_t
int common_socket_print(rad_listen_t const *this, char *buffer, size_t bufsize)
rad_listen_error_t error
Handle error/eol on the descriptor.
Definition protocol.h:75
rad_listen_unlang_t compile
Phase2 - Compile unlang sections in the virtual server that map to packet types used by the protocol.
Definition protocol.h:65
void(* rad_listen_free_t)(rad_listen_t *)
Definition protocol.h:42
int(* rad_listen_parse_t)(CONF_SECTION *, rad_listen_t *)
Definition protocol.h:40
rad_listen_parse_t parse
Perform extra processing of the configuration data specified by config.
Definition protocol.h:68
struct rad_protocol_s rad_protocol_t
Struct exported by a proto_* module.
int common_socket_parse(CONF_SECTION *cs, rad_listen_t *this)
rad_listen_unlang_t bootstrap
Phase1 - Basic validation checks of virtual server.
Definition protocol.h:64
DL_MODULE_COMMON
Common fields to all loadable modules.
Definition protocol.h:59
uint32_t transports
What can transport this protocol.
Definition protocol.h:61
int common_socket_open(CONF_SECTION *cs, rad_listen_t *this)
void common_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *pairs, bool received)
Definition auth.c:198
rad_listen_debug_t debug
Print an attribute list for debugging.
Definition protocol.h:79
rad_listen_encode_t encode
Encode an outgoing packet.
Definition protocol.h:81
rad_listen_print_t print
Print a line describing the packet being sent or the packet that was received.
Definition protocol.h:77
bool tls
Whether protocol can be wrapped in TLS.
Definition protocol.h:62
rad_listen_recv_t recv
Read an incoming packet from the descriptor.
Definition protocol.h:73
rad_listen_send_t send
Write an outgoing packet to the descriptor.
Definition protocol.h:74
rad_listen_decode_t decode
Decode an incoming packet.
Definition protocol.h:82
int(* rad_listen_unlang_t)(CONF_SECTION *, CONF_SECTION *)
Definition protocol.h:41
rad_listen_parse_t open
Open a descriptor.
Definition protocol.h:71
Struct exported by a proto_* module.
Definition protocol.h:58
int(* rad_listen_print_t)(rad_listen_t const *, char *, size_t)
Definition listen.h:71
int(* rad_listen_recv_t)(rad_listen_t *)
Definition listen.h:68
int(* rad_listen_decode_t)(rad_listen_t *, request_t *)
Definition listen.h:74
int(* rad_listen_send_t)(rad_listen_t *, request_t *)
Definition listen.h:69
int(* rad_listen_encode_t)(rad_listen_t *, request_t *)
Definition listen.h:73
int(* rad_listen_error_t)(rad_listen_t *, int)
Definition listen.h:70
void(* rad_listen_debug_t)(request_t *, fr_packet_t *, fr_pair_list_t *, bool received)
Definition listen.h:72