Author: jfrederic.clere(a)jboss.com
Date: 2008-03-18 10:12:42 -0400 (Tue, 18 Mar 2008)
New Revision: 1445
Added:
sandbox/httpd/src/native/common/context.c
sandbox/httpd/src/native/common/context.h
sandbox/httpd/src/native/common/host.c
sandbox/httpd/src/native/common/host.h
Modified:
sandbox/httpd/src/native/common/Makefile.in
sandbox/httpd/src/native/mod_manager/configure.in
Log:
Add logic to handle hosts and contexts.
Modified: sandbox/httpd/src/native/common/Makefile.in
===================================================================
--- sandbox/httpd/src/native/common/Makefile.in 2008-03-16 21:29:21 UTC (rev 1444)
+++ sandbox/httpd/src/native/common/Makefile.in 2008-03-18 14:12:42 UTC (rev 1445)
@@ -1,14 +1,21 @@
# Makefile.in for common
-APR_BASE=@APR_BASE@
-top_srcdir = @top_srcdir@
-LOCAL_LIBS=$(APR_BASE)/lib/lib@APR_LIBNAME@.la
+#APR_BASE=@APR_BASE@
+#top_srcdir = @top_srcdir@
+#LOCAL_LIBS=$(APR_BASE)/lib/lib@APR_LIBNAME@.la
-INCLUDES=-I$(APR_BASE)/include/apr-1 -I$(top_srcdir)/include
+#INCLUDES=-I$(APR_BASE)/include/apr-1 -I$(top_srcdir)/include
-include $(APR_BASE)/build-1/apr_rules.mk
+#include $(APR_BASE)/build-1/apr_rules.mk
+APACHE_BASE=@APACHE_BASE@
+top_builddir = @APACHE_BASE@
+builddir = @MANAGER_BASE@
+
+include $(APACHE_BASE)/build/rules.mk
+INCLUDES=-I$(APACHE_BASE)/include/
+
LINK_PROG = $(LIBTOOL) $(LTFLAGS) --mode=link $(LT_LDFLAGS) $(COMPILE) $(ALL_LDFLAGS) -o
$@
-OBJS=sharedmem_util.lo node.lo
+OBJS=sharedmem_util.lo node.lo context.lo host.lo
all: $(OBJS)
Added: sandbox/httpd/src/native/common/context.c
===================================================================
--- sandbox/httpd/src/native/common/context.c (rev 0)
+++ sandbox/httpd/src/native/common/context.c 2008-03-18 14:12:42 UTC (rev 1445)
@@ -0,0 +1,227 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+/**
+ * @file context.c
+ * @brief context description Storage Module for Apache
+ *
+ * @defgroup MEM contexts
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_pools.h"
+#include "apr_time.h"
+
+#include "context.h"
+#include "slotmem.h"
+
+struct mem {
+ ap_slotmem_t *slotmem;
+ const slotmem_storage_method *storage;
+ int num;
+ apr_pool_t *p;
+};
+
+static mem_t * create_attach_mem_context(char *string, int *num, int type, apr_pool_t *p)
{
+ mem_t *ptr;
+ const char *storename;
+ apr_status_t rv;
+
+ ptr = apr_pcalloc(p, sizeof(mem_t));
+ if (!ptr) {
+ return NULL;
+ }
+ ptr->storage = mem_getstorage(p, "shared");
+ if (!ptr->storage) {
+ return NULL;
+ }
+ storename = apr_pstrcat(p, string, CONTEXTEXE, NULL);
+ if (type)
+ rv = ptr->storage->ap_slotmem_create(&ptr->slotmem, storename,
sizeof(contextinfo_t), *num, p);
+ else {
+ apr_size_t size = sizeof(contextinfo_t);
+ rv = ptr->storage->ap_slotmem_attach(&ptr->slotmem, storename,
&size, num, p);
+ }
+ if (rv != APR_SUCCESS) {
+ return NULL;
+ }
+ ptr->num = *num;
+ ptr->p = p;
+ return ptr;
+}
+/**
+ * Insert(alloc) and update a context record in the shared table
+ * @param pointer to the shared table.
+ * @param context context to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+static apr_status_t insert_update(void* mem, void **data, int id, apr_pool_t *pool)
+{
+ contextinfo_t *in = (contextinfo_t *)*data;
+ contextinfo_t *ou = (contextinfo_t *)mem;
+ if (strcmp(in->context, ou->context) == 0 && in->vhost ==
ou->vhost) {
+ memcpy(ou, in, sizeof(contextinfo_t));
+ ou->id = id;
+ ou->updatetime = apr_time_sec(apr_time_now());
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+apr_status_t insert_update_context(mem_t *s, contextinfo_t *context)
+{
+ apr_status_t rv;
+ contextinfo_t *ou;
+ int ident;
+
+ context->id = 0;
+ rv = s->storage->ap_slotmem_do(s->slotmem, insert_update, &context,
s->p);
+ if (context->id != 0 && rv == APR_SUCCESS) {
+ return APR_SUCCESS; /* updated */
+ }
+
+ /* we have to insert it */
+ rv = s->storage->ap_slotmem_alloc(s->slotmem, &ident, (void **)
&ou);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ memcpy(ou, context, sizeof(contextinfo_t));
+ ou->id = ident;
+ ou->updatetime = apr_time_sec(apr_time_now());
+
+ return APR_SUCCESS;
+}
+
+/**
+ * read a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context context to read from the shared table.
+ * @return address of the read context or NULL if error.
+ */
+static apr_status_t loc_read_context(void* mem, void **data, int id, apr_pool_t *pool) {
+ contextinfo_t *in = (contextinfo_t *)*data;
+ contextinfo_t *ou = (contextinfo_t *)mem;
+ if (strcmp(in->context, ou->context) == 0 && in->vhost ==
ou->vhost) {
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+APR_DECLARE(contextinfo_t *) read_context(mem_t *s, contextinfo_t *context)
+{
+ apr_status_t rv;
+ contextinfo_t *ou = context;
+
+ if (context->id)
+ rv = s->storage->ap_slotmem_mem(s->slotmem, context->id, (void **)
&ou);
+ else {
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_context, &ou,
s->p);
+ }
+ if (rv == APR_SUCCESS)
+ return ou;
+ return NULL;
+}
+/**
+ * get a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context address where the context is locate in the shared table.
+ * @param ids in the context table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) get_context(mem_t *s, contextinfo_t **context, int ids)
+{
+ return(s->storage->ap_slotmem_mem(s->slotmem, ids, (void **) context));
+}
+
+/**
+ * remove(free) a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context context to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) remove_context(mem_t *s, contextinfo_t *context)
+{
+ apr_status_t rv;
+ contextinfo_t *ou = context;
+ if (context->id)
+ s->storage->ap_slotmem_free(s->slotmem, context->id, context);
+ else {
+ /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_context, &ou,
s->p);
+ if (rv == APR_SUCCESS)
+ rv = s->storage->ap_slotmem_free(s->slotmem, ou->id, context);
+ }
+ return rv;
+}
+
+/*
+ * get the ids for the used (not free) contexts in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of context existing or -1 if error.
+ */
+APR_DECLARE(int) get_ids_used_context(mem_t *s, int *ids)
+{
+ return (s->storage->ap_slotmem_get_used(s->slotmem, ids));
+}
+
+/*
+ * read the size of the table.
+ * @param pointer to the shared table.
+ * @return number of context existing or -1 if error.
+ */
+APR_DECLARE(int) get_max_size_context(mem_t *s)
+{
+ return (s->storage->ap_slotmem_get_max_size(s->slotmem));
+}
+
+/**
+ * attach to the shared context table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * get_mem_context(char *string, int *num, apr_pool_t *p)
+{
+ return(create_attach_mem_context(string, num, 0, p));
+}
+/**
+ * create a shared context table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * create_mem_context(char *string, int *num, apr_pool_t *p)
+{
+ return(create_attach_mem_context(string, num, 1, p));
+}
Added: sandbox/httpd/src/native/common/context.h
===================================================================
--- sandbox/httpd/src/native/common/context.h (rev 0)
+++ sandbox/httpd/src/native/common/context.h 2008-03-18 14:12:42 UTC (rev 1445)
@@ -0,0 +1,143 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+#ifndef CONTEXT_H
+#define CONTEXT_H
+
+/**
+ * @file context.h
+ * @brief context description Storage Module for Apache
+ *
+ * @defgroup MEM contexts
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#define CONTEXTEXE ".contexts"
+
+typedef struct mem mem_t;
+
+/* status of the context as read/store in httpd. */
+struct contextinfo {
+ char context[40]; /* Context where the application is mapped. */
+ int vhost; /* id of the correspond virtual host in hosts table */
+ int status; /* status: ENABLED/DISABLED/STOPPED */
+
+ unsigned long updatetime; /* time of last received message */
+ int id; /* id in table */
+};
+typedef struct contextinfo contextinfo_t;
+
+
+/**
+ * Insert(alloc) and update a context record in the shared table
+ * @param pointer to the shared table.
+ * @param context context to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+APR_DECLARE(apr_status_t) insert_update_context(mem_t *s, contextinfo_t *context);
+
+/**
+ * read a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context context to read from the shared table.
+ * @return address of the read context or NULL if error.
+ */
+APR_DECLARE(contextinfo_t *) read_context(mem_t *s, contextinfo_t *context);
+
+/**
+ * get a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context address of the context read from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) get_context(mem_t *s, contextinfo_t **context, int ids);
+
+/**
+ * remove(free) a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context context to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) remove_context(mem_t *s, contextinfo_t *context);
+
+/*
+ * get the ids for the used (not free) contexts in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of context existing or -1 if error.
+ */
+APR_DECLARE(int) get_ids_used_context(mem_t *s, int *ids);
+
+/*
+ * get the size of the table (max size).
+ * @param pointer to the shared table.
+ * @return size of the existing table or -1 if error.
+ */
+APR_DECLARE(int) get_max_size_context(mem_t *s);
+
+/**
+ * attach to the shared context table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+APR_DECLARE(mem_t *) get_mem_context(char *string, int *num, apr_pool_t *p);
+/**
+ * create a shared context table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+APR_DECLARE(mem_t *) create_mem_context(char *string, int *num, apr_pool_t *p);
+
+/**
+ * provider for the mod_proxy_cluster or mod_jk modules.
+ */
+struct context_storage_method {
+/**
+ * the context corresponding to the ident
+ * @param ids ident of the context to read.
+ * @param context address of pointer to return the context.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) (* read_context)(int ids, contextinfo_t **context);
+/**
+ * read the list of ident of used contexts.
+ * @param ids address to store the idents.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(int) (* get_ids_used_context)(int *ids);
+/**
+ * read the max number of contexts in the shared table
+ */
+APR_DECLARE(int) (*get_max_size_context)();
+};
+#endif /*CONTEXT_H*/
Added: sandbox/httpd/src/native/common/host.c
===================================================================
--- sandbox/httpd/src/native/common/host.c (rev 0)
+++ sandbox/httpd/src/native/common/host.c 2008-03-18 14:12:42 UTC (rev 1445)
@@ -0,0 +1,228 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+/**
+ * @file host.c
+ * @brief host description Storage Module for Apache
+ *
+ * @defgroup MEM hosts
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_pools.h"
+#include "apr_time.h"
+
+#include "host.h"
+#include "slotmem.h"
+
+struct mem {
+ ap_slotmem_t *slotmem;
+ const slotmem_storage_method *storage;
+ int num;
+ apr_pool_t *p;
+};
+
+static mem_t * create_attach_mem_host(char *string, int *num, int type, apr_pool_t *p) {
+ mem_t *ptr;
+ const char *storename;
+ apr_status_t rv;
+
+ ptr = apr_pcalloc(p, sizeof(mem_t));
+ if (!ptr) {
+ return NULL;
+ }
+ ptr->storage = mem_getstorage(p, "shared");
+ if (!ptr->storage) {
+ return NULL;
+ }
+ storename = apr_pstrcat(p, string, HOSTEXE, NULL);
+ if (type)
+ rv = ptr->storage->ap_slotmem_create(&ptr->slotmem, storename,
sizeof(hostinfo_t), *num, p);
+ else {
+ apr_size_t size = sizeof(hostinfo_t);
+ rv = ptr->storage->ap_slotmem_attach(&ptr->slotmem, storename,
&size, num, p);
+ }
+ if (rv != APR_SUCCESS) {
+ return NULL;
+ }
+ ptr->num = *num;
+ ptr->p = p;
+ return ptr;
+}
+/**
+ * Insert(alloc) and update a host record in the shared table
+ * @param pointer to the shared table.
+ * @param host host to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+static apr_status_t insert_update(void* mem, void **data, int id, apr_pool_t *pool)
+{
+ hostinfo_t *in = (hostinfo_t *)*data;
+ hostinfo_t *ou = (hostinfo_t *)mem;
+ if (strcmp(in->host, ou->host) == 0 && in->vhost == ou->vhost
&& in->node == ou->node) {
+ memcpy(ou, in, sizeof(hostinfo_t));
+ ou->id = id;
+ ou->updatetime = apr_time_sec(apr_time_now());
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+apr_status_t insert_update_host(mem_t *s, hostinfo_t *host)
+{
+ apr_status_t rv;
+ hostinfo_t *ou;
+ int ident;
+
+ host->id = 0;
+ rv = s->storage->ap_slotmem_do(s->slotmem, insert_update, &host,
s->p);
+ if (host->id != 0 && rv == APR_SUCCESS) {
+ return APR_SUCCESS; /* updated */
+ }
+
+ /* we have to insert it */
+ rv = s->storage->ap_slotmem_alloc(s->slotmem, &ident, (void **)
&ou);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ memcpy(ou, host, sizeof(hostinfo_t));
+ ou->id = ident;
+ ou->updatetime = apr_time_sec(apr_time_now());
+
+ return APR_SUCCESS;
+}
+
+/**
+ * read a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host host to read from the shared table.
+ * @return address of the read host or NULL if error.
+ */
+static apr_status_t loc_read_host(void* mem, void **data, int id, apr_pool_t *pool) {
+ hostinfo_t *in = (hostinfo_t *)*data;
+ hostinfo_t *ou = (hostinfo_t *)mem;
+
+ if (strcmp(in->host, ou->host) == 0 && in->vhost == ou->vhost
&& in->node == ou->node ) {
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+APR_DECLARE(hostinfo_t *) read_host(mem_t *s, hostinfo_t *host)
+{
+ apr_status_t rv;
+ hostinfo_t *ou = host;
+
+ if (host->id)
+ rv = s->storage->ap_slotmem_mem(s->slotmem, host->id, (void **)
&ou);
+ else {
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_host, &ou,
s->p);
+ }
+ if (rv == APR_SUCCESS)
+ return ou;
+ return NULL;
+}
+/**
+ * get a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host address where the host is locate in the shared table.
+ * @param ids in the host table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) get_host(mem_t *s, hostinfo_t **host, int ids)
+{
+ return(s->storage->ap_slotmem_mem(s->slotmem, ids, (void **) host));
+}
+
+/**
+ * remove(free) a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host host to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) remove_host(mem_t *s, hostinfo_t *host)
+{
+ apr_status_t rv;
+ hostinfo_t *ou = host;
+ if (host->id)
+ s->storage->ap_slotmem_free(s->slotmem, host->id, host);
+ else {
+ /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_host, &ou,
s->p);
+ if (rv == APR_SUCCESS)
+ rv = s->storage->ap_slotmem_free(s->slotmem, ou->id, host);
+ }
+ return rv;
+}
+
+/*
+ * get the ids for the used (not free) hosts in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of host existing or -1 if error.
+ */
+APR_DECLARE(int) get_ids_used_host(mem_t *s, int *ids)
+{
+ return (s->storage->ap_slotmem_get_used(s->slotmem, ids));
+}
+
+/*
+ * read the size of the table.
+ * @param pointer to the shared table.
+ * @return number of host existing or -1 if error.
+ */
+APR_DECLARE(int) get_max_size_host(mem_t *s)
+{
+ return (s->storage->ap_slotmem_get_max_size(s->slotmem));
+}
+
+/**
+ * attach to the shared host table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * get_mem_host(char *string, int *num, apr_pool_t *p)
+{
+ return(create_attach_mem_host(string, num, 0, p));
+}
+/**
+ * create a shared host table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * create_mem_host(char *string, int *num, apr_pool_t *p)
+{
+ return(create_attach_mem_host(string, num, 1, p));
+}
Added: sandbox/httpd/src/native/common/host.h
===================================================================
--- sandbox/httpd/src/native/common/host.h (rev 0)
+++ sandbox/httpd/src/native/common/host.h 2008-03-18 14:12:42 UTC (rev 1445)
@@ -0,0 +1,143 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2007 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+#ifndef HOST_H
+#define HOST_H
+
+/**
+ * @file host.h
+ * @brief host description Storage Module for Apache
+ *
+ * @defgroup MEM hosts
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#define HOSTEXE ".hosts"
+
+typedef struct mem mem_t;
+
+/* status of the host as read/store in httpd. */
+struct hostinfo {
+ char host[40]; /* Alias element of the virtual host */
+ int vhost; /* id of the correspond virtual host */
+ int node; /* id of the node containing the virtual host */
+
+ unsigned long updatetime; /* time of last received message */
+ int id; /* id in table */
+};
+typedef struct hostinfo hostinfo_t;
+
+
+/**
+ * Insert(alloc) and update a host record in the shared table
+ * @param pointer to the shared table.
+ * @param host host to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+APR_DECLARE(apr_status_t) insert_update_host(mem_t *s, hostinfo_t *host);
+
+/**
+ * read a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host host to read from the shared table.
+ * @return address of the read host or NULL if error.
+ */
+APR_DECLARE(hostinfo_t *) read_host(mem_t *s, hostinfo_t *host);
+
+/**
+ * get a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host address of the host read from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) get_host(mem_t *s, hostinfo_t **host, int ids);
+
+/**
+ * remove(free) a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host host to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) remove_host(mem_t *s, hostinfo_t *host);
+
+/*
+ * get the ids for the used (not free) hosts in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of host existing or -1 if error.
+ */
+APR_DECLARE(int) get_ids_used_host(mem_t *s, int *ids);
+
+/*
+ * get the size of the table (max size).
+ * @param pointer to the shared table.
+ * @return size of the existing table or -1 if error.
+ */
+APR_DECLARE(int) get_max_size_host(mem_t *s);
+
+/**
+ * attach to the shared host table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+APR_DECLARE(mem_t *) get_mem_host(char *string, int *num, apr_pool_t *p);
+/**
+ * create a shared host table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+APR_DECLARE(mem_t *) create_mem_host(char *string, int *num, apr_pool_t *p);
+
+/**
+ * provider for the mod_proxy_cluster or mod_jk modules.
+ */
+struct host_storage_method {
+/**
+ * the host corresponding to the ident
+ * @param ids ident of the host to read.
+ * @param host address of pointer to return the host.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) (* read_host)(int ids, hostinfo_t **host);
+/**
+ * read the list of ident of used hosts.
+ * @param ids address to store the idents.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(int) (* get_ids_used_host)(int *ids);
+/**
+ * read the max number of hosts in the shared table
+ */
+APR_DECLARE(int) (*get_max_size_host)();
+};
+#endif /*HOST_H*/
Modified: sandbox/httpd/src/native/mod_manager/configure.in
===================================================================
--- sandbox/httpd/src/native/mod_manager/configure.in 2008-03-16 21:29:21 UTC (rev 1444)
+++ sandbox/httpd/src/native/mod_manager/configure.in 2008-03-18 14:12:42 UTC (rev 1445)
@@ -21,4 +21,4 @@
AC_SUBST(APACHE_BASE)
AC_SUBST(MANAGER_BASE)
-AC_OUTPUT(Makefile)
+AC_OUTPUT(Makefile ../common/Makefile)