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

typedef struct rxv_spin_ctx rxv_spin_ctx_t

context type


Function Documentation

apr_pool_t* rxv_spin_pool ( rxv_spin_ctx_t *  ctx  ) 

Retrieve context specific pool.

Parameters:
ctx Context
Returns:
pointer to context specific pool, NULL on error
Example:
apr_pool_t* rxv_spin_ppool ( rxv_spin_ctx_t *  ctx  ) 

Retrieve process specific pool.

Parameters:
ctx Context
Returns:
pointer to process specific pool, NULL on error
Example:
rxv_spin_data_t* rxv_spin_data ( rxv_spin_ctx_t *  ctx  ) 

Retrieve data from context.

Parameters:
ctx Context
Returns:
pointer to data, NULL on error
Example:
request_rec* rxv_spin_r ( rxv_spin_ctx_t *  ctx  ) 

Retrieve Apache request from context.

Parameters:
ctx Context
Returns:
pointer to Apache request, NULL on error
Example:
 rxv_spin_r(ctx);
apreq_handle_t* rxv_spin_req ( rxv_spin_ctx_t *  ctx  ) 

Retrieve parsed request from context.

Parameters:
ctx Context
Returns:
pointer to parsed request, NULL on error
Example:
 rxv_spin_req(ctx);
void* rxv_spin_xget ( rxv_spin_ctx_t *  ctx  ) 

Retrieve extra data from the context.

Parameters:
ctx Context
Returns:
pointer to extra data, NULL on error
Example:
void* rxv_spin_xset ( rxv_spin_ctx_t *  ctx,
void *  extra 
)

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:
 rxv_spin_xset(ctx,somedata);
rxv_spin_data_t* rxv_spin_get ( rxv_spin_ctx_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, NULL if not found
Example:
 rxv_spin_get(ctx,"result");
rxv_spin_data_t* rxv_spin_set ( rxv_spin_ctx_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, NULL on error
Example:
 rxv_spin_set(ctx,"result",result);
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.
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.
 All Files Functions Typedefs Enumerations Enumerator Defines

Generated on 29 Dec 2009 for mod_spin by  doxygen 1.6.1