Context functions
Defines |
#define | rxv_spin_sget(ctx, key) rxv_spin_string(rxv_spin_get((ctx),(key))) |
#define | rxv_spin_sset(ctx, key, val) rxv_spin_set((ctx),(key),rxv_spin_datum(rxv_spin_pool(ctx),(val),NULL)) |
#define | rxv_spin_del(ctx, key) rxv_spin_set((ctx),(key),NULL) |
Typedefs |
typedef struct rxv_spin_ctx | rxv_spin_ctx_t |
Functions |
apr_pool_t * | rxv_spin_pool (rxv_spin_ctx_t *ctx) |
apr_pool_t * | rxv_spin_ppool (rxv_spin_ctx_t *ctx) |
rxv_spin_data_t * | rxv_spin_data (rxv_spin_ctx_t *ctx) |
request_rec * | rxv_spin_r (rxv_spin_ctx_t *ctx) |
apreq_handle_t * | rxv_spin_req (rxv_spin_ctx_t *ctx) |
void * | rxv_spin_xget (rxv_spin_ctx_t *ctx) |
void * | rxv_spin_xset (rxv_spin_ctx_t *ctx, void *extra) |
rxv_spin_data_t * | rxv_spin_get (rxv_spin_ctx_t *ctx, const char *key) |
rxv_spin_data_t * | rxv_spin_set (rxv_spin_ctx_t *ctx, const char *key, rxv_spin_data_t *value) |
Detailed Description
Context functions (mod_spin API)
Define Documentation
#define rxv_spin_sget |
( |
ctx, |
|
|
key |
|
) |
rxv_spin_string(rxv_spin_get((ctx),(key))) |
get a string from the context by converting from single
#define rxv_spin_sset |
( |
ctx, |
|
|
key, |
|
|
val |
|
) |
rxv_spin_set((ctx),(key),rxv_spin_datum(rxv_spin_pool(ctx),(val),NULL)) |
set a string into context by converting to single
#define rxv_spin_del |
( |
ctx, |
|
|
key |
|
) |
rxv_spin_set((ctx),(key),NULL) |
delete a value from context
Typedef Documentation
Function Documentation
Retrieve context specific pool.
- Parameters:
-
- Returns:
- pointer to context specific pool, NULL on error
- Example:
-
Retrieve process specific pool.
- Parameters:
-
- Returns:
- pointer to process specific pool, NULL on error
- Example:
-
Retrieve data from context.
- Parameters:
-
- Returns:
- pointer to data, NULL on error
- Example:
-
Retrieve Apache request from context.
- Parameters:
-
- Returns:
- pointer to Apache request, NULL on error
- Example:
-
Retrieve parsed request from context.
- Parameters:
-
- Returns:
- pointer to parsed request, NULL on error
- Example:
-
Retrieve extra data from the context.
- Parameters:
-
- Returns:
- pointer to extra data, NULL on error
- Example:
-
Set extra data into the context.
- Parameters:
-
| ctx | Context |
| extra | Pointer to extra data to set into the context |
- Returns:
- pointer to extra data, NULL on error
- Example:
-
Retrieve data from the context.
- Parameters:
-
| ctx | Context |
| key | Unique key by which this data is identified |
- Returns:
- pointer to data, NULL if not found
- Example:
-
Place data into the context.
- Parameters:
-
| ctx | Context |
| key | Unique key by which this data is identified |
| value | The actual data |
- Returns:
- pointer to data, NULL on error
- Example:
-
- Warning:
- The data set into the context has to have at least the lifetime of the request. Anything less and the pool used to hold the data may get cleaned before the bucket holding the value gets created. In most cases, this will result in a segfault.
-
Do not put data allocated from the heap (with malloc(), calloc() and friends) into the context unless you set up cleanup functions that will free the allocated space. Although the context itself and the bucket brigade passed to Apache will be cleaned automatically (because it is allocated from the pool and/or has relevant cleanup functions), the heap storage space has to be freed explicitly. The safest option is to always use data allocated from the request pool.