The main request structure, and allocation functions.
More...
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/rcode.h>
#include <freeradius-devel/server/signal.h>
#include <freeradius-devel/util/event.h>
#include <freeradius-devel/util/heap.h>
#include <freeradius-devel/util/packet.h>
#include <freeradius-devel/util/dlist.h>
Go to the source code of this file.
|
#define | control_ctx pair_list.control |
| Talloc ctx for allocating control pairs under.
|
|
#define | control_pairs pair_list.control->children |
| Convenience macro for accessing the control list.
|
|
#define | local_ctx pair_list.local |
| Talloc ctx for allocating local variagbles.
|
|
#define | local_pairs pair_list.local->children |
| Convenience macro for accessing the state list.
|
|
#define | RAD_REQUEST_LVL_DEBUG (1) |
|
#define | RAD_REQUEST_LVL_DEBUG2 (2) |
|
#define | RAD_REQUEST_LVL_DEBUG3 (3) |
|
#define | RAD_REQUEST_LVL_DEBUG4 (4) |
|
#define | RAD_REQUEST_LVL_NONE (0) |
| No debug messages should be printed.
|
|
#define | RAD_REQUEST_OPTION_CTX (1 << 1) |
|
#define | RAD_REQUEST_OPTION_DETAIL (1 << 2) |
|
#define | reply_ctx pair_list.reply |
| Talloc ctx for allocating reply pairs under.
|
|
#define | reply_pairs pair_list.reply->children |
| Convenience macro for accessing the reply list.
|
|
#define | request_ctx pair_list.request |
| Talloc ctx for allocating request pairs under.
|
|
#define | request_init(_ctx, _type, _args) _request_init(__FILE__, __LINE__, _ctx, _type, _args) |
|
#define | request_is_detachable(_x) ((_x)->flags.detachable) |
|
#define | request_is_detached(_x) ((_x)->type == REQUEST_TYPE_DETACHED) |
|
#define | request_is_dynamic_client(_x) ((_x)->flags.dynamic_client) |
|
#define | request_is_external(_x) ((_x)->type == REQUEST_TYPE_EXTERNAL) |
|
#define | request_is_internal(_x) ((_x)->type == REQUEST_TYPE_INTERNAL) |
|
#define | request_local_alloc_external(_ctx, _args) _request_local_alloc(__FILE__, __LINE__, (_ctx), REQUEST_TYPE_EXTERNAL, (_args)) |
| Allocate a new external request outside of the request pool.
|
|
#define | request_local_alloc_internal(_ctx, _args) _request_local_alloc(__FILE__, __LINE__, (_ctx), REQUEST_TYPE_INTERNAL, (_args)) |
| Allocate a new internal request outside of the request pool.
|
|
#define | REQUEST_MAGIC (0xdeadbeef) |
|
#define | REQUEST_MASTER_NUM_STATES (REQUEST_COUNTED + 1) |
|
#define | request_pairs pair_list.request->children |
| Convenience macro for accessing the request list.
|
|
#define | REQUEST_POOL_HEADERS |
|
#define | REQUEST_POOL_SIZE |
|
#define | request_set_dynamic_client(_x) ((_x)->flags.dynamic_client = true) |
|
#define | REQUEST_VERIFY(_x) fr_assert(_x) |
|
#define | session_state_ctx pair_list.state |
| Talloc ctx for allocating reply pairs under.
|
|
#define | session_state_pairs pair_list.state->children |
| Convenience macro for accessing the state list.
|
|
|
enum | request_master_state_t {
REQUEST_ACTIVE = 1
,
REQUEST_STOP_PROCESSING
,
REQUEST_DONE
} |
|
enum | request_state_t {
REQUEST_INIT = 0
,
REQUEST_RECV
,
REQUEST_PROCESS
,
REQUEST_SEND
,
REQUEST_OTHER_1
,
REQUEST_OTHER_2
,
REQUEST_OTHER_3
,
REQUEST_OTHER_4
} |
|
enum | request_type_t {
REQUEST_TYPE_EXTERNAL = 0
,
REQUEST_TYPE_INTERNAL
,
REQUEST_TYPE_DETACHED
} |
|
|
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 * | _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.
|
|
int | request_detach (request_t *child) |
| Unlink a subrequest from its parent.
|
|
void | request_global_free (void) |
|
int | request_global_init (void) |
|
void | request_log_prepend (request_t *request, fr_log_t *log, fr_log_lvl_t lvl) |
| Prepend another logging destination to the list.
|
|
int | request_slab_deinit (request_t *request) |
| Callback for slabs to deinitialise the request.
|
|
fr_pair_t * | request_state_replace (request_t *request, fr_pair_t *state)) |
| Replace the session_state_ctx with a new one.
|
|
The main request structure, and allocation functions.
- Id
- dbf1d53798f0d73e01928c3b207004aeb0efc8ca
- Copyright
- 1999-2018 The FreeRADIUS server project
Definition in file request.h.
◆ request_init_args_t
struct request_init_args_t |
Optional arguments for initialising requests.
Definition at line 283 of file request.h.
Data Fields |
bool |
detachable |
Request should be detachable, i.e. able to run even if its parent exits.
|
request_pair_lists_t |
pair_list |
Alternative pair list heads. These allow a request to expose nested attributes as request or reply lists from the parent.
|
request_t * |
parent |
< The namespace this request implements. If set, the request is a child request used to run policy sections and additional virtual servers.
|
◆ request_pair_lists_t
struct request_pair_lists_t |
Pair lists accessible from the request.
Definition at line 169 of file request.h.
Data Fields |
fr_pair_t * |
control |
Pair containing the control list. |
fr_pair_t * |
local |
Pair containing local variables. |
fr_pair_t * |
reply |
Pair containing the reply list. |
fr_pair_t * |
request |
Pair containing the request list. |
fr_pair_t * |
state |
Pair containing the state list. |
◆ request_s
Definition at line 191 of file request.h.
Data Fields |
char const * |
alloc_file |
File the request was allocated in. |
int |
alloc_line |
Line the request was allocated on. |
fr_async_t * |
async |
for new async listeners |
uint64_t |
child_number |
Monotonically increasing number for children of this request. |
fr_client_t * |
client |
The client that originally sent us the request. |
char const * |
component |
Section the request is in. |
bool |
counted |
Set if the request has been counted in the stats. |
fr_dlist_head_t |
data |
Request data. |
fr_rb_node_t |
dedup_node |
entry in the deduplication tree. |
struct request_s.flags |
flags |
Capabilities flags for this request. |
uint64_t |
ins_count |
count of instructions we've ran |
uint64_t |
ins_max |
max instruction to bail out at |
fr_dlist_t |
listen_entry |
request's entry in the list for this listener / socket |
fr_dict_t const * |
local_dict |
dictionary for local variables |
struct request_s.log |
log |
Logging information. |
uint32_t |
magic |
Magic number used to detect memory corruption, or request structs that have not been properly initialised. |
request_master_state_t |
master_state |
Set by the master thread to signal the child that's currently working with the request, to do something. |
char const * |
name |
for debug printing, as (d) is no longer sufficient |
uint64_t |
number |
Monotonically increasing request number. Reset on server restart. |
uint32_t |
options |
mainly for proxying EAP-MSCHAPv2. |
char const *fr_packet_t * |
packet |
< Module the request is currently being processed by. Incoming request.
|
request_pair_lists_t |
pair_list |
Pair lists associated with the request. - Warning
- DO NOT allocate pairs directly beneath the root or in the ctx of the request. They MUST be allocated beneath their appropriate list attribute. Structure containing all pair lists.
|
fr_pair_t * |
pair_root |
Root attribute which contains the other list attributes as children. |
request_t * |
parent |
Request that generated this request. |
fr_dict_t const * |
proto_dict |
Dictionary of the protocol that this request belongs to. |
rlm_rcode_t |
rcode |
Last rcode returned by a module. |
fr_packet_t * |
reply |
Outgoing response. |
fr_heap_index_t |
runnable |
entry in the heap of runnable packets |
uint64_t |
seq_start |
State sequence ID. Stable identifier for a sequence of requests and responses.
|
void * |
stack |
unlang interpreter stack. |
fr_timer_t * |
timeout |
Timer event for this request. This tracks when we need to forcefully terminate a request.
|
request_type_t |
type |
What type of request this is. |
◆ request_s.flags
Capabilities flags for this request.
Definition at line 232 of file request.h.
Data Fields |
uint8_t |
detachable: 1 |
This request may be detached from its parent.. |
uint8_t |
dynamic_client: 1 |
this is a dynamic client request |
◆ request_s.log
Logging information.
Definition at line 240 of file request.h.
Data Fields |
log_dst_t * |
dst |
First in a list of log destinations. |
rindent_t |
indent |
Indentation for log messages. |
fr_log_lvl_t |
lvl |
Log messages with lvl >= to this should be logged. |
◆ control_ctx
#define control_ctx pair_list.control |
Talloc ctx for allocating control pairs under.
Definition at line 142 of file request.h.
◆ control_pairs
#define control_pairs pair_list.control->children |
Convenience macro for accessing the control list.
This should be used in the form &request->control_pairs
to get a pointer to the head of the request list.
Definition at line 138 of file request.h.
◆ local_ctx
#define local_ctx pair_list.local |
Talloc ctx for allocating local variagbles.
Definition at line 164 of file request.h.
◆ local_pairs
#define local_pairs pair_list.local->children |
Convenience macro for accessing the state list.
This should be used in the form &request->local_pairs
to get a pointer to the head of the local list.
Definition at line 160 of file request.h.
◆ RAD_REQUEST_LVL_DEBUG
#define RAD_REQUEST_LVL_DEBUG (1) |
◆ RAD_REQUEST_LVL_DEBUG2
#define RAD_REQUEST_LVL_DEBUG2 (2) |
◆ RAD_REQUEST_LVL_DEBUG3
#define RAD_REQUEST_LVL_DEBUG3 (3) |
◆ RAD_REQUEST_LVL_DEBUG4
#define RAD_REQUEST_LVL_DEBUG4 (4) |
◆ RAD_REQUEST_LVL_NONE
#define RAD_REQUEST_LVL_NONE (0) |
No debug messages should be printed.
Definition at line 308 of file request.h.
◆ RAD_REQUEST_OPTION_CTX
#define RAD_REQUEST_OPTION_CTX (1 << 1) |
◆ RAD_REQUEST_OPTION_DETAIL
#define RAD_REQUEST_OPTION_DETAIL (1 << 2) |
◆ reply_ctx
Talloc ctx for allocating reply pairs under.
Definition at line 131 of file request.h.
◆ reply_pairs
Convenience macro for accessing the reply list.
This should be used in the form &request->reply_pairs
to get a pointer to the head of the request list.
Definition at line 127 of file request.h.
◆ request_ctx
#define request_ctx pair_list.request |
Talloc ctx for allocating request pairs under.
Definition at line 120 of file request.h.
◆ request_init
#define request_init |
( |
|
_ctx, |
|
|
|
_type, |
|
|
|
_args |
|
) |
| _request_init(__FILE__, __LINE__, _ctx, _type, _args) |
◆ request_is_detachable
#define request_is_detachable |
( |
|
_x | ) |
((_x)->flags.detachable) |
◆ request_is_detached
◆ request_is_dynamic_client
#define request_is_dynamic_client |
( |
|
_x | ) |
((_x)->flags.dynamic_client) |
◆ request_is_external
◆ request_is_internal
◆ request_local_alloc_external
Allocate a new external request outside of the request pool.
- Parameters
-
[in] | _ctx | Talloc ctx to allocate the request in. |
[in] | _args | Optional arguments that control how the request is initialised. |
Definition at line 331 of file request.h.
◆ request_local_alloc_internal
Allocate a new internal request outside of the request pool.
- Parameters
-
[in] | _ctx | Talloc ctx to allocate the request in. |
[in] | _args | Optional arguments that control how the request is initialised. |
Definition at line 339 of file request.h.
◆ REQUEST_MAGIC
#define REQUEST_MAGIC (0xdeadbeef) |
◆ REQUEST_MASTER_NUM_STATES
#define REQUEST_MASTER_NUM_STATES (REQUEST_COUNTED + 1) |
◆ request_pairs
#define request_pairs pair_list.request->children |
Convenience macro for accessing the request list.
This should be used in the form &request->request_pairs
to get a pointer to the head of the request list.
Definition at line 116 of file request.h.
◆ REQUEST_POOL_HEADERS
Value: ( \
1 + \
2 + \
10 \
)
#define UNLANG_STACK_MAX
The maximum depth of the stack.
Definition at line 66 of file request.h.
◆ REQUEST_POOL_SIZE
Value: ( \
128 \
)
#define UNLANG_FRAME_PRE_ALLOC
How much memory we pre-alloc for each frame.
Stores an attribute, a value and various bits of other data.
Definition at line 79 of file request.h.
◆ request_set_dynamic_client
#define request_set_dynamic_client |
( |
|
_x | ) |
((_x)->flags.dynamic_client = true) |
◆ REQUEST_VERIFY
◆ session_state_ctx
#define session_state_ctx pair_list.state |
Talloc ctx for allocating reply pairs under.
Definition at line 153 of file request.h.
◆ session_state_pairs
#define session_state_pairs pair_list.state->children |
Convenience macro for accessing the state list.
This should be used in the form &request->session_state_pairs
to get a pointer to the head of the request list.
Definition at line 149 of file request.h.
◆ fr_async_t
◆ fr_client_t
◆ request_state_t
◆ request_t
◆ request_master_state_t
Enumerator |
---|
REQUEST_ACTIVE | Request is active (running or runnable)
|
REQUEST_STOP_PROCESSING | Request has been signalled to stop.
|
REQUEST_DONE | Request has completed.
|
Definition at line 86 of file request.h.
◆ request_state_t
Enumerator |
---|
REQUEST_INIT | |
REQUEST_RECV | |
REQUEST_PROCESS | |
REQUEST_SEND | |
REQUEST_OTHER_1 | |
REQUEST_OTHER_2 | |
REQUEST_OTHER_3 | |
REQUEST_OTHER_4 | |
Definition at line 93 of file request.h.
◆ request_type_t
Enumerator |
---|
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.)
|
Definition at line 177 of file request.h.
◆ _request_init()
Setup logging and other fields for a request.
- Parameters
-
[in] | file | the request was allocated in. |
[in] | line | the request was allocated on. |
[in] | request | to (re)-initialise. |
[in] | type | of request to initialise. |
[in] | args | Other optional arguments. |
Definition at line 237 of file request.c.
◆ _request_local_alloc()
Allocate a request that's not in the free list.
This can be useful if modules need a persistent request for their own purposes which needs to be outside of the normal free list, so that it can be freed when the module requires, not when the thread destructor runs.
Definition at line 477 of file request.c.
◆ request_detach()
Unlink a subrequest from its parent.
- Note
- This should be used for requests in preparation for freeing them.
- Parameters
-
[in] | child | request to unlink. |
- Returns
- 0 on success.
- -1 on failure.
Definition at line 535 of file request.c.
◆ request_global_free()
void request_global_free |
( |
void |
| ) |
|
◆ request_global_init()
int request_global_init |
( |
void |
| ) |
|
◆ request_log_prepend()
Prepend another logging destination to the list.
- Parameters
-
request | the request |
log_dst | the logging destination |
lvl | the new request debug lvl |
Definition at line 92 of file request.c.
◆ request_slab_deinit()
int request_slab_deinit |
( |
request_t * |
request | ) |
|
Callback for slabs to deinitialise the request.
Does not need to be called for local requests.
- Parameters
-
- Returns
- 0 in the request was deinitialised.
- -1 if the request is in an unexpected state.
Definition at line 378 of file request.c.
◆ request_state_replace()
Replace the session_state_ctx with a new one.
NOTHING should rewrite request->session_state_ctx.
It's now a pair, and is stored in request->pair_root. So it's wrong for anyone other than this function to play games with it.
- Parameters
-
[in] | request | to replace the state of. |
[in] | new_state | state to assign to the request. May be NULL in which case a new_state state will be alloced and assigned. |
- Returns
- the fr_pair_t containing the old state list.
Definition at line 504 of file request.c.
◆ request_attr_control
◆ request_attr_local
◆ request_attr_reply
◆ request_attr_request
◆ request_attr_root
◆ request_attr_state