26 RCSIDH(request_h,
"$Id: 1b2934f4a4f6cc23f49072ece970c597a3495827 $")
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)
65 #define REQUEST_MASTER_NUM_STATES (REQUEST_COUNTED + 1)
90 #define request_pairs pair_list.request->children
94 #define request_ctx pair_list.request
101 #define reply_pairs pair_list.reply->children
105 #define reply_ctx pair_list.reply
112 #define control_pairs pair_list.control->children
116 #define control_ctx pair_list.control
123 #define session_state_pairs pair_list.state->children
127 #define session_state_ctx pair_list.state
134 #define local_pairs pair_list.local->children
138 #define local_ctx pair_list.local
158 #define request_is_external(_x) ((_x)->type == REQUEST_TYPE_EXTERNAL)
159 #define request_is_internal(_x) ((_x)->type == REQUEST_TYPE_INTERNAL)
160 #define request_is_detached(_x) ((_x)->type == REQUEST_TYPE_DETACHED)
161 #define request_is_detachable(_x) ((_x)->flags.detachable)
162 #define request_is_dynamic_client(_x) ((_x)->flags.dynamic_client)
163 #define request_set_dynamic_client(_x) ((_x)->flags.dynamic_client = true)
268 #ifdef WITH_VERIFY_PTR
269 # define REQUEST_VERIFY(_x) request_verify(__FILE__, __LINE__, _x)
276 # define REQUEST_VERIFY(_x) fr_assert(_x)
279 #define RAD_REQUEST_LVL_NONE (0)
280 #define RAD_REQUEST_LVL_DEBUG (1)
281 #define RAD_REQUEST_LVL_DEBUG2 (2)
282 #define RAD_REQUEST_LVL_DEBUG3 (3)
283 #define RAD_REQUEST_LVL_DEBUG4 (4)
285 #define RAD_REQUEST_OPTION_CTX (1 << 1)
286 #define RAD_REQUEST_OPTION_DETAIL (1 << 2)
295 #define request_alloc_external(_ctx, _args) \
296 _request_alloc( __FILE__, __LINE__, (_ctx), REQUEST_TYPE_EXTERNAL, (_args))
305 #define request_alloc_internal(_ctx, _args) \
306 _request_alloc( __FILE__, __LINE__, (_ctx), REQUEST_TYPE_INTERNAL, (_args))
316 #define request_local_alloc_external(_ctx, _args) \
317 _request_local_alloc(__FILE__, __LINE__, (_ctx), REQUEST_TYPE_EXTERNAL, (_args))
324 #define request_local_alloc_internal(_ctx, _args) \
325 _request_local_alloc(__FILE__, __LINE__, (_ctx), REQUEST_TYPE_INTERNAL, (_args))
339 #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.
request_type_t type
What type of request this is.
fr_dict_attr_t const * request_attr_request
bool counted
Set if the request has been counted in the stats.
fr_rb_node_t dedup_node
entry in the deduplication tree.
fr_packet_t * packet
Incoming request.
uint64_t child_number
Monotonically increasing number for children of this request.
fr_pair_t * local
Pair containing local variables.
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.
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.
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
uint64_t ins_max
max instruction to bail out at
fr_dict_t const * dict
Dictionary of the protocol that this request belongs to.
uint32_t options
mainly for proxying EAP-MSCHAPv2.
void request_global_free(void)
fr_heap_index_t runnable_id
entry in the heap of runnable packets
int request_global_init(void)
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.
struct request_s::@66 flags
Capabilities flags for this request.
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.
fr_dlist_t free_entry
Request's entry in the free list.
request_pair_lists_t pair_list
Pair lists associated with the request.
request_t * parent
Request that generated this request.
request_t * _request_alloc(char const *file, int line, TALLOC_CTX *ctx, request_type_t type, request_init_args_t const *args)
Create a new request_t data structure.
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
uint64_t number
Monotonically increasing request number. Reset on server restart.
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,...
uint64_t ins_count
count of instructions we've ran
char const * component
Section the request is in.
fr_heap_index_t time_order_id
entry in the heap of time ordered packets
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.
char const * module
Module the request is currently being processed by.
@ REQUEST_ACTIVE
Request is active (running or runnable)
@ REQUEST_DONE
Request has completed.
@ REQUEST_STOP_PROCESSING
Request has been signalled to stop.
struct request_s::@67 log
Logging information.
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.
fr_pair_t * request_state_replace(request_t *request, fr_pair_t *state))
Replace the session_state_ctx with a new one.
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.