The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
radclient.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: e163f780e1ff80a8c78a656abde2207992b45530 $
20 *
21 * @file radclient.h
22 * @brief Structures for the radclient utility.
23 *
24 * @copyright 2014 The FreeRADIUS server project
25 */
26RCSIDH(radclient_h, "$Id: e163f780e1ff80a8c78a656abde2207992b45530 $")
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <freeradius-devel/util/dlist.h>
33#include <freeradius-devel/util/rb.h>
34#include <freeradius-devel/util/pair.h>
35#include <freeradius-devel/util/packet.h>
36#include <freeradius-devel/radius/defs.h>
37/*
38 * Logging macros
39 */
40 #undef DEBUG
41#define DEBUG(fmt, ...) if (do_output && (fr_debug_lvl > 0)) fprintf(fr_log_fp, fmt "\n", ## __VA_ARGS__)
42#undef DEBUG2
43#define DEBUG2(fmt, ...) if (do_output && (fr_debug_lvl > 1)) fprintf(fr_log_fp, fmt "\n", ## __VA_ARGS__)
44
45
46#define ERROR(fmt, ...) if (do_output) fr_perror("radclient: " fmt, ## __VA_ARGS__)
47#define WARN(fmt, ...) if (do_output) fprintf(stderr, fmt "\n", ## __VA_ARGS__)
48
49#define RDEBUG_ENABLED() (do_output && (fr_debug_lvl > 0))
50#define RDEBUG_ENABLED2() (do_output && (fr_debug_lvl > 1))
51
52#define REDEBUG(fmt, ...) if (do_output) fr_perror("(%" PRIu64 ") " fmt , request->num, ## __VA_ARGS__)
53#define RDEBUG(fmt, ...) if (do_output && (fr_debug_lvl > 0)) fprintf(fr_log_fp, "(%" PRIu64 ") " fmt "\n", request->num, ## __VA_ARGS__)
54#define RDEBUG2(fmt, ...) if (do_output && (fr_debug_lvl > 1)) fprintf(fr_log_fp, "(%" PRIu64 ") " fmt "\n", request->num, ## __VA_ARGS__)
55
56typedef struct {
57 uint64_t accepted; //!< Requests to which we received a accept
58 uint64_t rejected; //!< Requests to which we received a reject
59 uint64_t lost; //!< Requests to which we received no response
60 uint64_t passed; //!< Requests which passed a filter
61 uint64_t failed; //!< Requests which failed a filter
63
64typedef struct {
65 fr_dlist_t entry; //!< for linked list
66 char const *packets; //!< The file containing the request packet
67 char const *filters; //!< The file containing the definition of the
68 //!< packet we want to match.
69 char const *coa_filter; //!< file containing the CoA filter we want to match
70 char const *coa_reply; //!< file containing the CoA filter we want to match
72
73typedef struct rc_request rc_request_t;
74
75struct rc_request {
76 uint64_t num; //!< The number (within the file) of the request were reading.
77
79
80 rc_file_pair_t *files; //!< Request and response file names.
81
82 rc_request_t *coa; //!< CoA filter and reply
83 fr_rb_node_t node; //!< rbtree node data for CoA
84
85 fr_pair_t *password; //!< Password.Cleartext
87
88 fr_packet_t *packet; //!< The outgoing request.
89 fr_packet_t *reply; //!< The incoming response.
90
93
94 fr_pair_list_t filter; //!< If the reply passes the filter, then the request passes.
95 fr_radius_packet_code_t filter_code; //!< Expected code of the response packet.
96
97 int resend;
98 int tries;
99 bool done; //!< Whether the request is complete.
100
101 char const *name; //!< Test name (as specified in the request).
102};
103
104#ifdef __cplusplus
105}
106#endif
#define RCSIDH(h, id)
Definition build.h:484
fr_radius_packet_code_t
RADIUS packet codes.
Definition defs.h:31
Entry in a doubly linked list.
Definition dlist.h:41
uint64_t num
The number (within the file) of the request were reading.
Definition radclient.h:76
fr_pair_t * password
Password.Cleartext.
Definition radclient.h:85
uint64_t accepted
Requests to which we received a accept.
Definition radclient.h:57
fr_packet_t * reply
The incoming response.
Definition radclient.h:89
fr_pair_list_t request_pairs
Definition radclient.h:91
char const * coa_reply
file containing the CoA filter we want to match
Definition radclient.h:70
uint64_t rejected
Requests to which we received a reject.
Definition radclient.h:58
fr_rb_node_t node
rbtree node data for CoA
Definition radclient.h:83
char const * packets
The file containing the request packet.
Definition radclient.h:66
uint64_t lost
Requests to which we received no response.
Definition radclient.h:59
bool done
Whether the request is complete.
Definition radclient.h:99
char const * coa_filter
file containing the CoA filter we want to match
Definition radclient.h:69
fr_pair_list_t filter
If the reply passes the filter, then the request passes.
Definition radclient.h:94
uint64_t failed
Requests which failed a filter.
Definition radclient.h:61
fr_pair_list_t reply_pairs
Definition radclient.h:92
uint64_t passed
Requests which passed a filter.
Definition radclient.h:60
fr_radius_packet_code_t filter_code
Expected code of the response packet.
Definition radclient.h:95
fr_time_t timestamp
Definition radclient.h:86
rc_request_t * coa
CoA filter and reply.
Definition radclient.h:82
fr_dlist_t entry
for linked list
Definition radclient.h:65
char const * name
Test name (as specified in the request).
Definition radclient.h:101
char const * filters
The file containing the definition of the packet we want to match.
Definition radclient.h:67
fr_dlist_t entry
Definition radclient.h:78
fr_packet_t * packet
The outgoing request.
Definition radclient.h:88
rc_file_pair_t * files
Request and response file names.
Definition radclient.h:80
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
"server local" time.
Definition time.h:69