]> granicus.if.org Git - apache/blobdiff - include/ap_socache.h
mod_cache: Add the cache_status hook to register the final cache
[apache] / include / ap_socache.h
index d24455c5d0ce4b320c555b9188b2a26f1c9bfbbe..e00c316f6d79a4968f3b2f3b4c980eaa645fef3f 100644 (file)
@@ -39,7 +39,8 @@ extern "C" {
  * of the provider are NOT safe to be called concurrently from
  * multiple processes or threads, and an external global mutex must be
  * used to serialize access to the provider.
- * XXX: Even if store/retrieve/remove is atomic, isn't it useful to note
+ */
+/* XXX: Even if store/retrieve/remove is atomic, isn't it useful to note
  * independently that status and iterate may or may not be?
  */
 #define AP_SOCACHE_FLAG_NOTMPSAFE (0x0001)
@@ -60,23 +61,27 @@ struct ap_socache_hints {
 
 /**
  * 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 id Unique ID for the object; binary blob
+ * @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 retrievd data (binary 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,
-                                              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_*
@@ -179,7 +184,7 @@ typedef struct ap_socache_provider_t {
 
     /** Dump the status of a cache instance for mod_status.  Will use
      * the ap_r* interfaces to produce appropriate status output.
-     * XXX: apr_r* are deprecated, bad dogfood
+     * XXX: ap_r* are deprecated, bad dogfood
      *
      * @param instance The cache instance
      * @param r The request structure
@@ -190,15 +195,16 @@ typedef struct ap_socache_provider_t {
     /**
      * 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;