26RCSIDH(request_h,
"$Id: dbf1d53798f0d73e01928c3b207004aeb0efc8ca $")
44#include <freeradius-devel/server/log.h>
45#include <freeradius-devel/server/rcode.h>
46#include <freeradius-devel/server/signal.h>
47#include <freeradius-devel/util/event.h>
48#include <freeradius-devel/util/heap.h>
49#include <freeradius-devel/util/packet.h>
50#include <freeradius-devel/util/dlist.h>
57# define REQUEST_MAGIC (0xdeadbeef)
66#define REQUEST_POOL_HEADERS ( \
79#define REQUEST_POOL_SIZE ( \
80 (UNLANG_FRAME_PRE_ALLOC * UNLANG_STACK_MAX) + \
81 (sizeof(fr_pair_t) * 5) + \
82 (sizeof(fr_packet_t) * 2) + \
91#define REQUEST_MASTER_NUM_STATES (REQUEST_COUNTED + 1)
116#define request_pairs pair_list.request->children
120#define request_ctx pair_list.request
127#define reply_pairs pair_list.reply->children
131#define reply_ctx pair_list.reply
138#define control_pairs pair_list.control->children
142#define control_ctx pair_list.control
149#define session_state_pairs pair_list.state->children
153#define session_state_ctx pair_list.state
160#define local_pairs pair_list.local->children
164#define local_ctx pair_list.local
184#define request_is_external(_x) ((_x)->type == REQUEST_TYPE_EXTERNAL)
185#define request_is_internal(_x) ((_x)->type == REQUEST_TYPE_INTERNAL)
186#define request_is_detached(_x) ((_x)->type == REQUEST_TYPE_DETACHED)
187#define request_is_detachable(_x) ((_x)->flags.detachable)
188#define request_is_dynamic_client(_x) ((_x)->flags.dynamic_client)
189#define request_set_dynamic_client(_x) ((_x)->flags.dynamic_client = true)
297#ifdef WITH_VERIFY_PTR
298# define REQUEST_VERIFY(_x) request_verify(__FILE__, __LINE__, _x)
305# define REQUEST_VERIFY(_x) fr_assert(_x)
308#define RAD_REQUEST_LVL_NONE (0)
309#define RAD_REQUEST_LVL_DEBUG (1)
310#define RAD_REQUEST_LVL_DEBUG2 (2)
311#define RAD_REQUEST_LVL_DEBUG3 (3)
312#define RAD_REQUEST_LVL_DEBUG4 (4)
314#define RAD_REQUEST_OPTION_CTX (1 << 1)
315#define RAD_REQUEST_OPTION_DETAIL (1 << 2)
317#define request_init(_ctx, _type, _args) \
318 _request_init(__FILE__, __LINE__, _ctx, _type, _args)
331#define request_local_alloc_external(_ctx, _args) \
332 _request_local_alloc(__FILE__, __LINE__, (_ctx), REQUEST_TYPE_EXTERNAL, (_args))
339#define request_local_alloc_internal(_ctx, _args) \
340 _request_local_alloc(__FILE__, __LINE__, (_ctx), REQUEST_TYPE_INTERNAL, (_args))
354#ifdef WITH_VERIFY_PTR
void request_verify(UNUSED char const *file, UNUSED int line, UNUSED request_t *request)
Head of a doubly linked list.
Entry in a doubly linked list.
unsigned int fr_heap_index_t
Minimal data structure to use the new code.
Describes a host allowed to send packets to the server.
rlm_rcode_t
Return codes indicating the result of the module call.
struct request_s::@68 log
Logging information.
request_type_t type
What type of request this is.
fr_dict_attr_t const * request_attr_request
struct request_s::@67 flags
Capabilities flags for this request.
bool counted
Set if the request has been counted in the stats.
fr_rb_node_t dedup_node
entry in the deduplication tree.
uint64_t child_number
Monotonically increasing number for children of this request.
fr_dict_t const * proto_dict
Dictionary of the protocol that this request belongs to.
fr_pair_t * local
Pair containing local variables.
int request_slab_deinit(request_t *request)
Callback for slabs to deinitialise the request.
bool detachable
Request should be detachable, i.e.
HIDDEN fr_dict_attr_t const * request_attr_root
fr_pair_t * pair_root
Root attribute which contains the other list attributes as children.
request_pair_lists_t pair_list
Alternative pair list heads.
request_t * _request_local_alloc(char const *file, int line, TALLOC_CTX *ctx, request_type_t type, request_init_args_t const *args)
Allocate a request that's not in the free list.
fr_packet_t * reply
Outgoing response.
void request_log_prepend(request_t *request, fr_log_t *log, fr_log_lvl_t lvl)
Prepend another logging destination to the list.
uint64_t seq_start
State sequence ID.
fr_client_t * client
The client that originally sent us the request.
fr_dict_attr_t const * request_attr_control
int alloc_line
Line the request was allocated on.
fr_dict_t const * local_dict
dictionary for local variables
char const * alloc_file
File the request was allocated in.
@ REQUEST_TYPE_EXTERNAL
A request received on the wire.
@ REQUEST_TYPE_INTERNAL
A request generated internally.
@ REQUEST_TYPE_DETACHED
A request that was generated internally, but is now detached (not associated with a parent request....
fr_dict_attr_t const * request_attr_local
fr_dict_attr_t const * request_attr_state
fr_dict_attr_t const * request_attr_reply
char const *fr_packet_t * packet
< Module the request is currently being processed by.
uint64_t ins_max
max instruction to bail out at
fr_heap_index_t runnable
entry in the heap of runnable packets
uint32_t options
mainly for proxying EAP-MSCHAPv2.
void request_global_free(void)
int request_global_init(void)
int request_detach(request_t *child)
Unlink a subrequest from its parent.
void * stack
unlang interpreter stack.
fr_pair_t * request
Pair containing the request list.
request_pair_lists_t pair_list
Pair lists associated with the request.
request_t * parent
Request that generated this request.
rlm_rcode_t rcode
Last rcode returned by a module.
fr_dlist_t listen_entry
request's entry in the list for this listener / socket
fr_pair_t * request_state_replace(request_t *request, fr_pair_t *state))
Replace the session_state_ctx with a new one.
uint64_t number
Monotonically increasing request number. Reset on server restart.
int _request_init(char const *file, int line, request_t *request, request_type_t type, request_init_args_t const *args)
Setup logging and other fields for a request.
request_t * parent
< The namespace this request implements.
request_master_state_t master_state
Set by the master thread to signal the child that's currently working with the request,...
fr_timer_t * timeout
Timer event for this request.
uint64_t ins_count
count of instructions we've ran
char const * component
Section the request is in.
fr_async_t * async
for new async listeners
fr_pair_t * reply
Pair containing the reply list.
char const * name
for debug printing, as (d) is no longer sufficient
fr_pair_t * state
Pair containing the state list.
fr_dlist_head_t data
Request data.
@ REQUEST_ACTIVE
Request is active (running or runnable)
@ REQUEST_DONE
Request has completed.
@ REQUEST_STOP_PROCESSING
Request has been signalled to stop.
uint32_t magic
Magic number used to detect memory corruption, or request structs that have not been properly initial...
fr_pair_t * control
Pair containing the control list.
Optional arguments for initialising requests.
Pair lists accessible from the request.
fr_aka_sim_id_type_t type
Stores an attribute, a value and various bits of other data.