The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
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.
Data Structures | |
struct | request_init_args_t |
Optional arguments for initialising requests. More... | |
struct | request_pair_lists_t |
Pair lists accessible from the request. More... | |
struct | request_s |
struct | request_s.flags |
Capabilities flags for this request. More... | |
struct | request_s.log |
Logging information. More... | |
Macros | |
#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_alloc_external(_ctx, _args) _request_alloc( __FILE__, __LINE__, (_ctx), REQUEST_TYPE_EXTERNAL, (_args)) |
Allocate a new external request. | |
#define | request_alloc_internal(_ctx, _args) _request_alloc( __FILE__, __LINE__, (_ctx), REQUEST_TYPE_INTERNAL, (_args)) |
Allocate a new internal request. | |
#define | request_ctx pair_list.request |
Talloc ctx for allocating request pairs under. | |
#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_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. | |
Typedefs | |
typedef struct fr_async_s | fr_async_t |
typedef struct fr_client_s | fr_client_t |
typedef enum request_state_t | request_state_t |
typedef struct request_s | request_t |
Enumerations | |
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 } |
Functions | |
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. | |
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. | |
fr_pair_t * | request_state_replace (request_t *request, fr_pair_t *state)) |
Replace the session_state_ctx with a new one. | |
Variables | |
fr_dict_attr_t const * | request_attr_control |
fr_dict_attr_t const * | request_attr_local |
fr_dict_attr_t const * | request_attr_reply |
fr_dict_attr_t const * | request_attr_request |
HIDDEN fr_dict_attr_t const * | request_attr_root |
fr_dict_attr_t const * | request_attr_state |
The main request structure, and allocation functions.
Definition in file request.h.
struct request_init_args_t |
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. |
struct request_pair_lists_t |
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. |
struct request_s |
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. |
fr_dict_t const * | dict | Dictionary of the protocol that this request belongs to. |
struct request_s.flags | flags | Capabilities flags for this request. |
fr_dlist_t | free_entry | Request's entry in the free list. |
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 |
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.
|
fr_pair_t * | pair_root | Root attribute which contains the other list attributes as children. |
request_t * | parent | Request that generated this request. |
rlm_rcode_t | rcode | Last rcode returned by a module. |
fr_packet_t * | reply | Outgoing response. |
fr_heap_index_t | runnable_id | 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_heap_index_t | time_order_id | entry in the heap of time ordered packets |
request_type_t | type | What type of request this is. |
struct request_s.flags |
struct request_s.log |
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. |
#define control_ctx pair_list.control |
#define control_pairs pair_list.control->children |
#define local_ctx pair_list.local |
#define local_pairs pair_list.local->children |
#define RAD_REQUEST_LVL_NONE (0) |
#define reply_ctx pair_list.reply |
#define reply_pairs pair_list.reply->children |
#define request_alloc_external | ( | _ctx, | |
_args | |||
) | _request_alloc( __FILE__, __LINE__, (_ctx), REQUEST_TYPE_EXTERNAL, (_args)) |
#define request_alloc_internal | ( | _ctx, | |
_args | |||
) | _request_alloc( __FILE__, __LINE__, (_ctx), REQUEST_TYPE_INTERNAL, (_args)) |
#define request_ctx pair_list.request |
#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)) |
#define request_local_alloc_internal | ( | _ctx, | |
_args | |||
) | _request_local_alloc(__FILE__, __LINE__, (_ctx), REQUEST_TYPE_INTERNAL, (_args)) |
#define request_pairs pair_list.request->children |
#define request_set_dynamic_client | ( | _x | ) | ((_x)->flags.dynamic_client = true) |
#define session_state_ctx pair_list.state |
#define session_state_pairs pair_list.state->children |
typedef struct fr_async_s fr_async_t |
typedef struct fr_client_s fr_client_t |
typedef enum request_state_t request_state_t |
enum request_state_t |
enum request_type_t |
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.
[in] | file | where the request was allocated. |
[in] | line | where the request was allocated. |
[in] | ctx | to bind the request to. |
[in] | type | what type of request to alloc. |
[in] | args | Optional arguments. |
Definition at line 501 of file request.c.
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.
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 608 of file request.c.
int request_detach | ( | request_t * | child | ) |
Unlink a subrequest from its parent.
[in] | child | request to unlink. |
Definition at line 668 of file request.c.
void request_global_free | ( | void | ) |
int request_global_init | ( | void | ) |
void request_log_prepend | ( | request_t * | request, |
fr_log_t * | log_dst, | ||
fr_log_lvl_t | lvl | ||
) |
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.
[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. |
Definition at line 637 of file request.c.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |