httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Holsman <I...@cnet.com>
Subject RE: [PATCH] mgmt_get_vars hook
Date Wed, 13 Jun 2001 15:27:31 GMT
[Latest Rev Of patch with the hook changed to RUN_ALL]

Index: include/http_core.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/include/http_core.h,v
retrieving revision 1.43
diff -u -r1.43 http_core.h
--- include/http_core.h 2001/04/13 05:19:25 1.43
+++ include/http_core.h 2001/06/11 20:22:28
@@ -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>
@@ -497,6 +498,38 @@
 AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const
char *arg);

 #endif
+
+typedef enum {
+ mgmt_line_type_string,
+ mgmt_line_type_long,
+ mgmt_line_type_hash
+} mgmt_line_type_e;
+
+typedef union {
+ const char* string;
+ long  long;
+ apr_hash_t *ht;
+} mgmt_line_value;
+
+typedef struct mgmt_line_t {
+ const char *description;
+ const char *name;
+ mgmt_line_type_e valType;
+ mgmt_line_value val;
+} mgmt_line_t;
+
+/**
+ * Gives modules a method 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 (using mgmt_line_t)
+ * @ingroup hooks
+ */
+
+AP_DECLARE_HOOK(int, mgmt_get_vars,
+ (apr_pool_t *p, const char*val,apr_hash_t *ht))

 #ifdef __cplusplus
 }
Index: server/core.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/core.c,v
retrieving revision 1.17
diff -u -r1.17 core.c
--- server/core.c 2001/06/08 16:39:48 1.17
+++ server/core.c 2001/06/11 20:22:49
@@ -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
@@ -93,6 +94,13 @@
 #define AP_DEFAULT_LIMIT_XML_BODY       ((size_t)1000000)

 #define AP_MIN_SENDFILE_BYTES           (256)
+
+APR_HOOK_STRUCT(
+ APR_HOOK_LINK(mgmt_get_vars)
+)
+
+AP_IMPLEMENT_HOOK_RUN_ALL(int,mgmt_get_vars,
+      (apr_pool_t *p,const  char*val, apr_hash_t *ht),(p,val,ht),DECLINED)

 /* Server core module... This module provides support for really basic
  * server operations, including options and commands which control the


> -----Original Message-----
> From: Harrie Hazewinkel [mailto:harrie@lisanza.net]
> Sent: Tuesday, June 12, 2001 8:14 PM
> To: new-httpd@apache.org
> Subject: Re: [PATCH] mgmt_get_vars hook
> 
> 
> Greg Stein wrote:
> > 
> > On Tue, Jun 12, 2001 at 02:08:02PM -0700, Harrie Hazewinkel wrote:
> > >...
> > > Hmm, I wonder about the runall. I even wonder about the
> > > overall use of a HOOK for this. I believe (as I said earlier)
> > >...
> > > The everything is only usefull to have a full dump, but most of it
> > > will then be discarded.
> > 
> > So? Please explain why this is a problem.
> 
> 
> I do not say it is a direct problem when you ask for lots of data
> and only pick a single value where the rest is discarded.
> I just wonder if it is usefull. Useless things are in my book
> not directly problems, but maybe my english is not good enough.
> 

The main use I have for a display all is to figure out what stuff is out there.
when your in development mode, it is usually easier to get a "display all"
save it to a file, and then write a more specific query to get the stuff 
you need out of it (which would run at a regular interval)


> If I under stand the implication of a RUNALL it will run all functions
> registered in the HOOK. I guess if a value is found you can stop.
> Maybe I just don't understand the HOOK part here.

problem is that different modules might implment parts of the namespace.
(using ryan's example here)

I might have registered a SSI tag, and decided it made more
sense to put it under the "include.ssi.name" key instead of it's own namespace.

so when a request for "include.ssi.*" comes in mod_include can handle part of
it, and my module can fill it another part. The point is that mod_include DOESN'T
know that my module's numbers exist, and doesn't need to.

the caller doesn't know HOW the information gets filled, or WHAT fills in the
info, just that it gets filled.


> 
> Would a simple mechanism as a optional function not be better.
> The module that has management data to provide registers this
> function in a generic form and function registration
> dedicated for the management data.

wouldn't you need to know beforehand which module's optional
function to call? 
each module would require a unique function name, and the 
calling program would need to know what function to call for each request

..Ian

> 
> 
> Harrie
> -- 
> address: Covalent Technologies, 645 Howard St, San Francisco, 
> CA - 94105
> phone: +1-415-536-5221                               
> fax:+1-415-536-5210
> personal website: http://www.lisanza.net/
> 

Mime
View raw message