The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
radclient-ng.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: 713c8ea1bd31aaea6ba4e0c6234a7c5d930e9703 $
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: 713c8ea1bd31aaea6ba4e0c6234a7c5d930e9703 $")
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 error; //!< Requests which received a Protocol-Error response
61 uint64_t passed; //!< Requests which passed a filter
62 uint64_t failed; //!< Requests which failed a filter
64
65typedef struct {
66 fr_dlist_t entry; //!< for linked list
67 char const *packets; //!< The file containing the request packet
68 char const *filters; //!< The file containing the definition of the
69 //!< packet we want to match.
70 char const *coa_filter; //!< file containing the CoA filter we want to match
71 char const *coa_reply; //!< file containing the CoA filter we want to match
73
74typedef struct rc_request rc_request_t;
75FR_DLIST_TYPES(rc_request_list)
76
77struct rc_request {
78 FR_DLIST_ENTRY(rc_request_list) entry; //!< Entry in the list of requests.
79
80 uint64_t num; //!< The number (within the file) of the request were reading.
81
82 rc_file_pair_t *files; //!< Request and response file names.
83
84 rc_request_t *coa; //!< CoA filter and reply
85 fr_rb_node_t node; //!< rbtree node data for CoA
86
87 fr_pair_t *password; //!< Password.Cleartext
89
90 fr_packet_t *packet; //!< The outgoing request.
91 fr_packet_t *reply; //!< The incoming response.
92
95
96 fr_pair_list_t filter; //!< If the reply passes the filter, then the request passes.
97 fr_radius_packet_code_t filter_code; //!< Expected code of the response packet.
98
99 int resend;
100 int tries;
101
102 bool done; //!< Whether the request is complete.
103
104 char const *name; //!< Test name (as specified in the request).
105};
106
107FR_DLIST_FUNCS(rc_request_list, rc_request_t, entry)
108
109#define rc_request_list_foreach(_list_head, _iter) \
110 fr_dlist_foreach(rc_request_list_dlist_head(_list_head), rc_request_t, _iter)
111
112#ifdef __cplusplus
113}
114#endif
#define RCSIDH(h, id)
Definition build.h:488
fr_radius_packet_code_t
RADIUS packet codes.
Definition defs.h:31
#define FR_DLIST_TYPES(_name)
Define type specific wrapper structs for dlists.
Definition dlist.h:1111
#define FR_DLIST_FUNCS(_name, _element_type, _element_entry)
Define type specific wrapper functions for dlists.
Definition dlist.h:1134
Entry in a doubly linked list.
Definition dlist.h:41
uint64_t accepted
Requests to which we received a accept.
uint64_t rejected
Requests to which we received a reject.
uint64_t lost
Requests to which we received no response.
uint64_t failed
Requests which failed a filter.
char const * coa_filter
file containing the CoA filter we want to match
uint64_t passed
Requests which passed a filter.
char const * filters
The file containing the definition of the packet we want to match.
fr_dlist_t entry
for linked list
char const * coa_reply
file containing the CoA filter we want to match
char const * packets
The file containing the request packet.
uint64_t error
Requests which received a Protocol-Error response.
uint64_t num
The number (within the file) of the request were reading.
fr_packet_t * reply
The incoming response.
fr_pair_t * password
Password.Cleartext.
char const * name
Test name (as specified in the request).
rc_file_pair_t * files
Request and response file names.
rc_request_t * coa
CoA filter and reply.
fr_packet_t * packet
The outgoing request.
fr_pair_list_t request_pairs
fr_rb_node_t node
rbtree node data for CoA
bool done
Whether the request is complete.
fr_pair_list_t filter
If the reply passes the filter, then the request passes.
fr_pair_list_t reply_pairs
fr_radius_packet_code_t filter_code
Expected code of the response packet.
fr_time_t timestamp
FR_DLIST_ENTRY(rc_request_list) entry
Entry in the list of requests.
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
"server local" time.
Definition time.h:69