]> granicus.if.org Git - apache/commitdiff
Define a hook for fetching management/status items.
authorGreg Stein <gstein@apache.org>
Wed, 13 Jun 2001 20:11:45 +0000 (20:11 +0000)
committerGreg Stein <gstein@apache.org>
Wed, 13 Jun 2001 20:11:45 +0000 (20:11 +0000)
This patch was submitted by Ian Holsman. Greg revised some names, applied
the Apache style, and namespace-prefixed the public symbols. Minor bugfix in
the use of the hook implementation macro.

Submitted by: Ian Holsman <IanH@cnet.com>
Reviewed by: Greg Stein

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89364 13f79535-47bb-0310-9956-ffa450edef68

include/http_core.h
server/core.c

index ccfdca1afe9454188b50d660bfe34496fa33f2cf..8fbe554cc24b7d50ef97f22bcf637c42093ad915 100644 (file)
@@ -60,6 +60,7 @@
 #define APACHE_HTTP_CORE_H
 
 #include "apr.h"
+#include "apr_hash.h"
 
 #if APR_HAVE_STRUCT_RLIMIT
 #include <sys/time.h>
@@ -498,6 +499,49 @@ AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dumm
 
 #endif
 
+
+/* ----------------------------------------------------------------------
+ *
+ * Runtime status/management
+ */
+
+typedef enum {
+    ap_mgmt_type_string,
+    ap_mgmt_type_long,
+    ap_mgmt_type_hash
+} ap_mgmt_type_e;
+
+typedef union {
+    const char *s_value;
+    long i_value;
+    apr_hash_t *h_value;
+} ap_mgmt_value;
+
+typedef struct {
+    const char *description;
+    const char *name;
+    ap_mgmt_type_e vtype;
+    ap_mgmt_value v;
+} ap_mgmt_item_t;
+
+/**
+ * This hook provdes a way for modules to provide metrics/statistics about
+ * their operational status.
+ *
+ * @param p A pool to use to create entries in the hash table
+ * @param val The name of the parameter(s) that is wanted. This is
+ *            tree-structured would be in the form ('*' is all the tree,
+ *            'module.*' all of the module , 'module.foo.*', or
+ *            'module.foo.bar' )
+ * @param ht The hash table to store the results. Keys are item names, and
+ *           the values point to ap_mgmt_item_t structures.
+ * @ingroup hooks
+ */
+AP_DECLARE_HOOK(int, get_mgmt_items,
+                (apr_pool_t *p, const char * val, apr_hash_t *ht))
+
+/* ---------------------------------------------------------------------- */
+
 #ifdef __cplusplus
 }
 #endif
index c1bc54dc44547758e202d5052484fda9408d30eb..b5f7aa5a598a907370a754c47c39e24788aa0932 100644 (file)
@@ -60,6 +60,7 @@
 #include "apr_strings.h"
 #include "apr_lib.h"
 #include "apr_fnmatch.h"
+#include "apr_hash.h"
 #include "apr_thread_proc.h"    /* for RLIMIT stuff */
 
 #define APR_WANT_IOVEC
 
 #define AP_MIN_SENDFILE_BYTES           (256)
 
+APR_HOOK_STRUCT(
+    APR_HOOK_LINK(get_mgmt_items)
+)
+
+AP_IMPLEMENT_HOOK_RUN_ALL(int, get_mgmt_items,
+                          (apr_pool_t *p, const char *val, apr_hash_t *ht),
+                          (p, val, ht), OK, DECLINED)
+
+
 /* Server core module... This module provides support for really basic
  * server operations, including options and commands which control the
  * operation of other modules.  Consider this the bureaucracy module.