* 20100609.0 (2.3.6-dev) Dropped ap_args_to_table due to missing constraints.
* 20100609.1 (2.3.7-dev) Introduce ap_log_cserror()
* 20100609.2 (2.3.7-dev) Add deferred write pool to core_output_filter_ctx
+ * 20100625.0 (2.3.7-dev) Add 'userctx' to socache iterator callback prototype
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20100609
+#define MODULE_MAGIC_NUMBER_MAJOR 20100625
#endif
#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
/**
* Iterator callback prototype for the ap_socache_provider_t->iterate() method
- * @param instance The cache instance (passed through)
- * @param s Associated server structure (passed through)
+ * @param instance The cache instance
+ * @param s Associated server context (for logging)
+ * @param userctx User defined pointer passed from the iterator call
* @param id Unique ID for the object (binary blob)
* with a trailing null char for convenience
* @param idlen Length of id blob
* @param data Output buffer to place retrieved data (binary blob)
* with a trailing null char for convenience
* @param datalen Length of data buffer
- * @param pool Pool for temporary allocations (passed through)
+ * @param pool Pool for temporary allocations
* @return APR status value; return APR_SUCCESS or the iteration will halt;
* this value is returned to the ap_socache_provider_t->iterate() caller
*/
-typedef apr_status_t (*ap_socache_iterator_t)(ap_socache_instance_t *instance,
- server_rec *s,
- const unsigned char *id,
- unsigned int idlen,
- const unsigned char *data,
- unsigned int datalen,
- apr_pool_t *pool);
+typedef apr_status_t (ap_socache_iterator_t)(ap_socache_instance_t *instance,
+ server_rec *s,
+ void *userctx,
+ const unsigned char *id,
+ unsigned int idlen,
+ const unsigned char *data,
+ unsigned int datalen,
+ apr_pool_t *pool);
/** A socache provider structure. socache providers are registered
* with the ap_provider.h interface using the AP_SOCACHE_PROVIDER_*
/**
* Dump all cached objects through an iterator callback.
* @param instance The cache instance
- * @param s Associated server structure (for logging purposes)
- * @param iterator The user provided callback which will receive
+ * @param s Associated server context (for processing and logging)
+ * @param userctx User defined pointer passed through to the iterator
+ * @param iterator The user provided callback function which will receive
* individual calls for each unexpired id/data pair
* @param pool Pool for temporary allocations.
* @return APR status value; APR_NOTFOUND if the object was not
* found
*/
apr_status_t (*iterate)(ap_socache_instance_t *instance, server_rec *s,
- ap_socache_iterator_t *iterator,
+ void *userctx, ap_socache_iterator_t *iterator,
apr_pool_t *pool);
} ap_socache_provider_t;
}
static apr_status_t socache_dbm_iterate(ap_socache_instance_t *ctx,
- server_rec *s,
+ server_rec *s, void *userctx,
ap_socache_iterator_t *iterator,
apr_pool_t *pool)
{
expired = TRUE;
}
if (!expired) {
- rv = (*iterator)(ctx, s, (unsigned char *)dbmkey.dptr, dbmkey.dsize,
+ rv = (*iterator)(ctx, s, userctx,
+ (unsigned char *)dbmkey.dptr, dbmkey.dsize,
(unsigned char *)dbmval.dptr + sizeof(apr_time_t),
dbmval.dsize - sizeof(apr_time_t), pool);
ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s,
}
static apr_status_t socache_dc_iterate(ap_socache_instance_t *instance,
- server_rec *s,
+ server_rec *s, void *userctx,
ap_socache_iterator_t *iterator,
apr_pool_t *pool)
{
}
static apr_status_t socache_mc_iterate(ap_socache_instance_t *instance,
- server_rec *s,
+ server_rec *s, void *userctx,
ap_socache_iterator_t *iterator,
apr_pool_t *pool)
{
/* Returns result of the (iterator)() call, zero is success (continue) */
static apr_status_t shmcb_subcache_iterate(ap_socache_instance_t *instance,
server_rec *s,
+ void *userctx,
SHMCBHeader *header,
SHMCBSubcache *subcache,
ap_socache_iterator_t *iterator,
}
static apr_status_t socache_shmcb_iterate(ap_socache_instance_t *instance,
- server_rec *s,
+ server_rec *s, void *userctx,
ap_socache_iterator_t *iterator,
apr_pool_t *pool)
{
/* Iterate over the subcaches */
for (loop = 0; loop < header->subcache_num && rv == APR_SUCCESS; loop++) {
SHMCBSubcache *subcache = SHMCB_SUBCACHE(header, loop);
- rv = shmcb_subcache_iterate(instance, s, header, subcache, iterator,
- &buf, &buflen, pool, now);
+ rv = shmcb_subcache_iterate(instance, s, userctx, header, subcache,
+ iterator, &buf, &buflen, pool, now);
}
return rv;
}
static apr_status_t shmcb_subcache_iterate(ap_socache_instance_t *instance,
server_rec *s,
+ void *userctx,
SHMCBHeader *header,
SHMCBSubcache *subcache,
ap_socache_iterator_t *iterator,
data_offset, dest_len);
dest[dest_len] = '\0';
- rv = (*iterator)(instance, s, id, idx->id_len,
+ rv = (*iterator)(instance, s, userctx, id, idx->id_len,
dest, dest_len, pool);
ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s,
"shmcb entry iterated");