Context functions


Data Structures

struct  rxv_spin_context
 Context structure. More...

Defines

#define rxv_spin_ctx_strget(ctx, key)   rxv_spin_single_get(rxv_spin_ctx_get((ctx),(key)))
#define rxv_spin_ctx_strset(ctx, key, val)   rxv_spin_ctx_set((ctx),(key),rxv_spin_single((ctx)->pool,(val)))
#define rxv_spin_ctx_del(ctx, key)   rxv_spin_ctx_set((ctx),(key),NULL)

Typedefs

typedef struct
rxv_spin_context 
rxv_spin_context_t
typedef
rxv_spin_context_t 
rxv_spin_ctx_t

Functions

rxv_spin_data_trxv_spin_ctx_get (rxv_spin_context_t *ctx, const char *key)
rxv_spin_data_trxv_spin_ctx_set (rxv_spin_context_t *ctx, const char *key, rxv_spin_data_t *value)

Detailed Description

Context functions (mod_spin API)

Define Documentation

#define rxv_spin_ctx_strget ( ctx,
key   )     rxv_spin_single_get(rxv_spin_ctx_get((ctx),(key)))

get a string from the context by converting from single

#define rxv_spin_ctx_strset ( ctx,
key,
val   )     rxv_spin_ctx_set((ctx),(key),rxv_spin_single((ctx)->pool,(val)))

set a string into context by converting to single

#define rxv_spin_ctx_del ( ctx,
key   )     rxv_spin_ctx_set((ctx),(key),NULL)

delete a value from context


Typedef Documentation

typedef struct rxv_spin_context rxv_spin_context_t

context type

typedef rxv_spin_context_t rxv_spin_ctx_t

shorthand for context type


Function Documentation

rxv_spin_data_t* rxv_spin_ctx_get ( rxv_spin_context_t ctx,
const char *  key 
)

Retrieve data from the context.

Parameters:
ctx Context
key Unique key by which this data is identified
Returns:
pointer to data (no copying is done), NULL if not found
Example:
 rxv_spin_ctx_get(ctx,"result");

rxv_spin_data_t* rxv_spin_ctx_set ( rxv_spin_context_t ctx,
const char *  key,
rxv_spin_data_t value 
)

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 (no copying is done), NULL on error
Example:
 rxv_spin_ctx_set(ctx,"result",result->data);
Remarks:
This function is also used for context data removal, through a macro. In such a case, NULL return value is not necessarily a failure.
IMPORTANT:
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.
IMPORTANT:
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.


Generated on Sun Sep 9 04:54:12 2007 for mod_spin by  doxygen 1.5.3