JBoss Native SVN: r1682 - trunk/httpd/httpd-2.2/modules/advertise.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-06-10 04:36:25 -0400 (Tue, 10 Jun 2008)
New Revision: 1682
Modified:
trunk/httpd/httpd-2.2/modules/advertise/modules.mk
Log:
Set properties
Property changes on: trunk/httpd/httpd-2.2/modules/advertise/modules.mk
___________________________________________________________________
Name: svn:eol-style
+ native
16 years, 6 months
JBoss Native SVN: r1681 - in trunk/httpd/httpd-2.2/modules: advertise and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-06-10 04:30:04 -0400 (Tue, 10 Jun 2008)
New Revision: 1681
Added:
trunk/httpd/httpd-2.2/modules/advertise/
trunk/httpd/httpd-2.2/modules/advertise/Makefile.in
trunk/httpd/httpd-2.2/modules/advertise/NMAKEadvertise
trunk/httpd/httpd-2.2/modules/advertise/NMAKEmakefile
trunk/httpd/httpd-2.2/modules/advertise/config.m4
trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.c
trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.h
trunk/httpd/httpd-2.2/modules/advertise/modules.mk
Modified:
trunk/httpd/httpd-2.2/modules/NMAKEmakefile
Log:
Add advertise module
Modified: trunk/httpd/httpd-2.2/modules/NMAKEmakefile
===================================================================
--- trunk/httpd/httpd-2.2/modules/NMAKEmakefile 2008-06-09 13:18:35 UTC (rev 1680)
+++ trunk/httpd/httpd-2.2/modules/NMAKEmakefile 2008-06-10 08:30:04 UTC (rev 1681)
@@ -46,6 +46,7 @@
metadata\~ \
ssl\~ \
proxy\~ \
+ advertise\~ \
mod_slotmem\~ \
mod_manager\~ \
jk\~
Added: trunk/httpd/httpd-2.2/modules/advertise/Makefile.in
===================================================================
--- trunk/httpd/httpd-2.2/modules/advertise/Makefile.in (rev 0)
+++ trunk/httpd/httpd-2.2/modules/advertise/Makefile.in 2008-06-10 08:30:04 UTC (rev 1681)
@@ -0,0 +1,3 @@
+# a modules Makefile has no explicit targets -- they will be defined by
+# whatever modules are enabled. just grab special.mk to deal with this.
+include $(top_srcdir)/build/special.mk
Property changes on: trunk/httpd/httpd-2.2/modules/advertise/Makefile.in
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/httpd/httpd-2.2/modules/advertise/NMAKEadvertise
===================================================================
--- trunk/httpd/httpd-2.2/modules/advertise/NMAKEadvertise (rev 0)
+++ trunk/httpd/httpd-2.2/modules/advertise/NMAKEadvertise 2008-06-10 08:30:04 UTC (rev 1681)
@@ -0,0 +1,63 @@
+# Copyright 2001-2008 The Apache Software Foundation or its licensors, as
+# applicable.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ====================================================================
+#
+# NMAKEmakefile mod_advertise module makefile.
+#
+# Originally contributed by Mladen Turk <mturk redhat.com>
+#
+# ====================================================================
+#
+
+TARGET=DLL
+PROJECT = mod_advertise
+
+!IF !DEFINED(SRCDIR) || "$(SRCDIR)" == ""
+SRCDIR = .
+!ENDIF
+
+!include <..\..\NMAKEcommon.inc>
+!include <..\..\NMAKEhttpd.inc>
+
+LDIRS = /libpath:"$(BUILDLIB)"
+LFLAGS = $(LFLAGS) user32.lib psapi.lib gdi32.lib shlwapi.lib wldap32.lib ole32.lib $(LIBAPR) $(LIBAPU) $(LIBHTTPD)
+CFLAGS = $(CFLAGS) -DCLUSTER_DECLARE_EXPORT
+
+INCLUDES = -I$(SRCDIR) -I$(BUILDINC)
+PDBFLAGS = -Fo$(WORKDIR)\ -Fd$(WORKDIR)\$(PROJECT)-src
+
+BUILDBIN = $(WORKDIR)\$(PROJECT).so
+BUILDPDB = $(WORKDIR)\$(PROJECT).pdb
+BUILDRES = $(WORKDIR)\$(PROJECT).res
+BUILDMFT = $(BUILDBIN).manifest
+
+RCFLAGS = $(RCFLAGS) /d BIN_NAME="$(PROJECT).so" /d LONG_NAME="mod_advertise module for Apache"
+
+OBJECTS = \
+ $(WORKDIR)\mod_advertise.obj
+
+{$(SRCDIR)}.c{$(WORKDIR)}.obj:
+ $(CC) $(CFLAGS) $(INCLUDES) $(PDBFLAGS) $<
+
+$(BUILDRES): ..\..\build\win32\httpd.rc
+ $(RC) $(RCFLAGS) /i "$(BUILDINC)" /fo $(BUILDRES) ..\..\build\win32\httpd.rc
+
+$(BUILDBIN): $(OBJECTS) $(BUILDRES)
+ $(LINK) $(LFLAGS) $(OBJECTS) $(BUILDRES) $(LIBS) $(LDIRS) /pdb:$(BUILDPDB) /out:$(BUILDBIN)
+ IF EXIST $(BUILDMFT) \
+ mt -nologo -manifest $(BUILDMFT) -outputresource:$(BUILDBIN);2
+
+install: $(BUILDBIN)
Added: trunk/httpd/httpd-2.2/modules/advertise/NMAKEmakefile
===================================================================
--- trunk/httpd/httpd-2.2/modules/advertise/NMAKEmakefile (rev 0)
+++ trunk/httpd/httpd-2.2/modules/advertise/NMAKEmakefile 2008-06-10 08:30:04 UTC (rev 1681)
@@ -0,0 +1,43 @@
+# Copyright 2001-2008 The Apache Software Foundation or its licensors, as
+# applicable.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ====================================================================
+#
+# NMAKEmakefile Master HTTPD cluster module makefile.
+#
+# Originally contributed by Mladen Turk <mturk redhat.com>
+#
+# ====================================================================
+#
+
+TARGET=DLL
+!IF !DEFINED(SRCDIR) || "$(SRCDIR)" == ""
+SRCDIR = .
+!ENDIF
+
+!include <..\..\NMAKEcommon.inc>
+!include <..\..\NMAKEhttpd.inc>
+
+MODULES = \
+ $(SRCDIR)\NMAKEadvertise
+
+$(MODULES):
+ @$(MAKE) -nologo -f $@ PREFIX=$(PREFIX) install
+
+$(WORKDIR):
+ @$(MAKEWORKDIR)
+
+install: $(WORKDIR) $(MODULES)
+ @xcopy "$(WORKDIR)\*.so" "$(BUILDMOD)" /Y /Q 2>NUL
Property changes on: trunk/httpd/httpd-2.2/modules/advertise/NMAKEmakefile
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/httpd/httpd-2.2/modules/advertise/config.m4
===================================================================
--- trunk/httpd/httpd-2.2/modules/advertise/config.m4 (rev 0)
+++ trunk/httpd/httpd-2.2/modules/advertise/config.m4 2008-06-10 08:30:04 UTC (rev 1681)
@@ -0,0 +1,19 @@
+dnl modules enabled in this directory by default
+
+APACHE_MODPATH_INIT(advertise)
+
+if test "$enable_advertise" = "shared"; then
+ advertise_mods_enable=shared
+elif test "$enable_advertise" = "yes"; then
+ advertise_mods_enable=yes
+else
+ advertise_mods_enable=no
+fi
+
+advertise_objs="mod_advertise.lo"
+APACHE_MODULE(advertise, Apache advertise module, $advertise_objs, , $advertise_mods_enable)
+
+
+APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current/../generators])
+
+APACHE_MODPATH_FINISH
Property changes on: trunk/httpd/httpd-2.2/modules/advertise/config.m4
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.c
===================================================================
--- trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.c (rev 0)
+++ trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.c 2008-06-10 08:30:04 UTC (rev 1681)
@@ -0,0 +1,642 @@
+/*
+ * ModAdvertise - Apache Httpd advertising module
+ *
+ * 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 Mladen Turk
+ */
+
+#define CORE_PRIVATE
+
+#include "mod_advertise.h"
+#include "mod_core.h"
+#include "util_script.h"
+
+#ifndef MAX
+#define MAX(x,y) ((x) >= (y) ? (x) : (y))
+#endif
+
+#define MOD_SRVCONF(p) ap_get_module_config((p)->server->module_config, \
+ &advertise_module)
+#define MOD_GETCONF(s) ap_get_module_config((s)->module_config, \
+ &advertise_module)
+
+/*
+ * Declare ourselves so the configuration routines can find and know us.
+ * We'll fill it in at the end of the module.
+ */
+module AP_MODULE_DECLARE_DATA advertise_module;
+
+
+
+/*
+ * Server private data
+ */
+static int ma_generation = 0;
+static apr_time_t ma_child_started = 0;
+static pid_t ma_parent_pid = -1;
+
+/*
+ * Global configuration
+ */
+static int ma_manager_strict = 0;
+static int ma_advertise_set = 0;
+static int ma_advertise_run = 0;
+static int ma_advertise_stat = 0;
+static char *ma_advertise_adrs = NULL;
+static char *ma_advertise_adsi = NULL;
+static char *ma_advertise_srvm = NULL;
+static char *ma_advertise_srvh = NULL;
+static char *ma_advertise_srvs = NULL;
+static char *ma_advertise_srvi = NULL;
+static char *ma_advertise_uuid = NULL;
+
+static char *ma_advertise_skey = NULL;
+
+
+static ma_advertise_srv_t ma_advs_server;
+
+
+/* Advertise is by default turned off */
+static apr_port_t ma_advertise_port = MA_DEFAULT_ADVPORT;
+static apr_port_t ma_advertise_srvp = 0;
+static ma_advertise_e ma_advertise_mode = ma_advertise_off;
+static apr_interval_time_t ma_advertise_freq = MA_DEFAULT_ADV_FREQ;
+
+/* Advertise sockets */
+static apr_socket_t *ma_mgroup_socket = NULL;
+static apr_socket_t *ma_listen_socket = NULL;
+static apr_sockaddr_t *ma_mgroup_sa = NULL;
+static apr_sockaddr_t *ma_listen_sa = NULL;
+
+static server_rec *ma_server_rec = NULL;
+
+/* Advertise sequence number */
+static volatile apr_int64_t ma_sequence = 0;
+
+
+/* Parent and child manager thread statuses */
+static volatile int is_mp_running = 0;
+static volatile int is_mp_created = 0;
+
+/*
+ * Server global data
+ */
+typedef struct ma_global_data_t {
+ int generation;
+ unsigned char ssalt[APR_MD5_DIGESTSIZE];
+ apr_uuid_t suuid;
+ char srvid[APR_UUID_FORMATTED_LENGTH + 2];
+ apr_pool_t *ppool;
+ apr_pool_t *cpool;
+} ma_global_data_t;
+
+/*
+ * Global data instance
+ * For parent, registered in process pool
+ */
+static ma_global_data_t *magd = NULL;
+
+/* Evaluates to true if the (apr_sockaddr_t *) addr argument is the
+ * IPv4 match-any-address, 0.0.0.0. */
+#define IS_INADDR_ANY(addr) ((addr)->family == APR_INET && \
+ (addr)->sa.sin.sin_addr.s_addr == INADDR_ANY)
+
+/* Evaluates to true if the (apr_sockaddr_t *) addr argument is the
+ * IPv6 match-any-address, [::]. */
+#define IS_IN6ADDR_ANY(addr) ((addr)->family == APR_INET6 && \
+ IN6_IS_ADDR_UNSPECIFIED(&(addr)->sa.sin6.sin6_addr))
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* ServerAdvertise directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_m(cmd_parms *cmd, void *dummy,
+ const char *arg, const char *opt)
+{
+ const char *errs = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+
+ if (errs != NULL)
+ return errs;
+
+ if (strcasecmp(arg, "Off") == 0)
+ ma_advertise_mode = ma_advertise_off;
+ else if (strcasecmp(arg, "On") == 0)
+ ma_advertise_mode = ma_advertise_on;
+ else
+ return "ServerAdvertise must be Off or On";
+ if (opt) {
+ const char *p = strstr(opt, "://");
+ if (p) {
+ ma_advertise_srvm = apr_pstrndup(cmd->pool, opt, p - opt);
+ opt = p + 3;
+ }
+ if (apr_parse_addr_port(&ma_advertise_srvs,
+ &ma_advertise_srvi,
+ &ma_advertise_srvp,
+ opt, cmd->pool) != APR_SUCCESS ||
+ !ma_advertise_srvs ||
+ !ma_advertise_srvp)
+ return "Invalid ServerAdvertise Address";
+ }
+ return NULL;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* AdvertiseGroup directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_g(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ const char *errs = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+
+ if (errs != NULL)
+ return errs;
+ if (ma_advertise_set)
+ return "Duplicate AdvertiseGroup directives are not allowed";
+
+ if (apr_parse_addr_port(&ma_advertise_adrs,
+ &ma_advertise_adsi,
+ &ma_advertise_port,
+ arg, cmd->pool) != APR_SUCCESS)
+ return "Invalid AdvertiseGroup address";
+ if (!ma_advertise_adrs)
+ return "Missing Ip part from AdvertiseGroup address";
+ if (!ma_advertise_port)
+ ma_advertise_port = MA_DEFAULT_ADVPORT;
+ ma_advertise_set = 1;
+ return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* AdvertiseFrequency directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_f(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ apr_time_t s, u = 0;
+ const char *p;
+ const char *errs = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+
+ if (errs != NULL)
+ return errs;
+ if ((p = strchr(arg, '.')) || (p = strchr(arg, ',')))
+ u = atoi(p + 1);
+
+ s = atoi(arg);
+ ma_advertise_freq = s * APR_USEC_PER_SEC + u * APR_TIME_C(1000);
+ if (ma_advertise_freq == 0)
+ return "Invalid AdvertiseFrequency value";
+
+ return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* AdvertiseSecurityKey directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_k(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ const char *errs = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+
+ if (errs != NULL)
+ return errs;
+ ma_advertise_skey = apr_pstrdup(cmd->pool, arg);
+ return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* AdvertiseManagerUrl directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_advertise_h(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ const char *errs = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+
+ if (errs != NULL)
+ return errs;
+ ma_advertise_srvh = apr_pstrdup(cmd->pool, arg);
+ return NULL;
+}
+
+#define MA_ADVERTISE_SERVER_FMT \
+ "HTTP/1.0 %s" CRLF \
+ "Date: %s" CRLF \
+ "Sequence: %" APR_INT64_T_FMT CRLF \
+ "Digest: %s" CRLF \
+ "Server: %s" CRLF
+
+static const char *hex = "0123456789abcdef";
+
+apr_status_t ma_advertise_server(server_rec *server, int type)
+{
+ char buf[MA_BSIZE];
+ char dat[APR_RFC822_DATE_LEN];
+ unsigned char msig[APR_MD5_DIGESTSIZE];
+ unsigned char ssig[APR_MD5_DIGESTSIZE * 2 + 1];
+ const char *asl;
+ char *p = buf;
+ int i, c = 0;
+ apr_size_t l = MA_BSIZE - 8;
+ apr_size_t n = 0;
+ apr_md5_ctx_t md;
+
+ ma_sequence++;
+ if (ma_sequence < 1)
+ ma_sequence = 1;
+ sprintf(buf, "%" APR_INT64_T_FMT, ma_sequence);
+ ap_recent_rfc822_date(dat, apr_time_now());
+ asl = ap_get_status_line(ma_advertise_stat);
+
+ /* Create MD5 digest
+ * salt + date + sequence + srvid
+ */
+ apr_md5_init(&md);
+ apr_md5_update(&md, magd->ssalt, APR_MD5_DIGESTSIZE);
+ apr_md5_update(&md, dat, strlen(dat));
+ apr_md5_update(&md, buf, strlen(buf));
+ apr_md5_update(&md, magd->srvid + 1, strlen(magd->srvid) - 1);
+ apr_md5_final(msig, &md);
+ /* Convert MD5 digest to hex string */
+ for (i = 0; i < APR_MD5_DIGESTSIZE; i++) {
+ ssig[c++] = hex[msig[i] >> 4];
+ ssig[c++] = hex[msig[i] & 0x0F];
+ }
+ ssig[c] = '\0';
+ n = apr_snprintf(p, l, MA_ADVERTISE_SERVER_FMT,
+ asl, dat, ma_sequence, ssig, magd->srvid + 1);
+ if (type == MA_ADVERTISE_SERVER) {
+ l -= n;
+ n += apr_snprintf(p + n, l,
+ "X-Manager-Address: %s:%u" CRLF
+ "X-Manager-Url: %s" CRLF
+ "X-Manager-Protocol: %s" CRLF
+ "X-Manager-Host: %s" CRLF,
+ ma_advertise_srvs,
+ ma_advertise_srvp,
+ ma_advertise_srvh,
+ ma_advertise_srvm,
+ server->server_hostname);
+
+ }
+ strcat(p, CRLF);
+ n += 2;
+ return apr_socket_sendto(ma_mgroup_socket,
+ ma_mgroup_sa, 0, buf, &n);
+}
+
+static apr_status_t ma_group_join(const char *addr, apr_port_t port,
+ apr_pool_t *pool)
+{
+ apr_status_t rv;
+
+ if ((rv = apr_sockaddr_info_get(&ma_mgroup_sa, addr,
+ APR_INET, port,
+ APR_UNSPEC, pool)) != APR_SUCCESS)
+ return rv;
+ if ((rv = apr_socket_create(&ma_mgroup_socket,
+ ma_mgroup_sa->family,
+ SOCK_DGRAM,
+ APR_PROTO_UDP,
+ pool)) != APR_SUCCESS)
+ return rv;
+ if ((rv = apr_mcast_join(ma_mgroup_socket, ma_mgroup_sa,
+ NULL, NULL)) != APR_SUCCESS) {
+ apr_socket_close(ma_mgroup_socket);
+ return rv;
+ }
+ if ((rv = apr_mcast_hops(ma_mgroup_socket,
+ MA_ADVERTISE_HOPS)) != APR_SUCCESS) {
+ apr_mcast_leave(ma_mgroup_socket, ma_mgroup_sa,
+ NULL, NULL);
+ apr_socket_close(ma_mgroup_socket);
+ return rv;
+ }
+ return APR_SUCCESS;
+}
+
+static void ma_group_leave()
+{
+ if (ma_mgroup_socket) {
+ apr_mcast_leave(ma_mgroup_socket, ma_mgroup_sa,
+ NULL, NULL);
+ apr_socket_close(ma_mgroup_socket);
+ ma_mgroup_socket = NULL;
+ }
+}
+
+static void * APR_THREAD_FUNC parent_thread(apr_thread_t *thd, void *data)
+{
+ static int current_status = 0;
+ int f_time = 1;
+ apr_interval_time_t a_step = 0;
+ server_rec *s = (server_rec *)data;
+ is_mp_created = 1;
+
+ while (is_mp_running) {
+ apr_sleep(MA_TM_RESOLUTION);
+ if (!is_mp_running)
+ break;
+ if (ma_advertise_run) {
+ a_step += MA_TM_RESOLUTION;
+ if (current_status != ma_advertise_stat) {
+ /* Force advertise on status change */
+ current_status = ma_advertise_stat;
+ f_time = 1;
+ }
+ if (a_step >= ma_advertise_freq || f_time) {
+ /* Run advertise */
+ ma_advertise_server(s, MA_ADVERTISE_SERVER);
+ a_step = 0;
+ f_time = 0;
+ }
+ if (!is_mp_running)
+ break;
+ }
+ /* TODO: Implement actual work for parent thread */
+ if (!is_mp_running)
+ break;
+ }
+ is_mp_created = 0;
+ return NULL;
+}
+
+static apr_status_t pconfig_cleanup(void *data);
+
+static apr_status_t process_cleanup(void *data)
+{
+ int advertise_run = ma_advertise_run;
+
+ is_mp_running = 0;
+ ma_advertise_run = 0;
+ if (advertise_run) {
+ ma_advertise_stat = HTTP_FORBIDDEN;
+ ma_advertise_server(ma_server_rec, MA_ADVERTISE_STATUS);
+ }
+ if (is_mp_created) {
+ apr_sleep(1000);
+ /* Wait for the parent maintenance thread to finish */
+ while (is_mp_created) {
+ apr_sleep(MA_TM_RESOLUTION);
+ }
+ }
+ if (advertise_run) {
+ ma_advertise_stat = HTTP_GONE;
+ ma_advertise_server(ma_server_rec, MA_ADVERTISE_STATUS);
+ ma_group_leave();
+ }
+ /* We don't need the post_config cleanup to run,
+ */
+ apr_pool_cleanup_kill(magd->cpool, magd, pconfig_cleanup);
+ magd = NULL;
+
+ return APR_SUCCESS;
+}
+
+static apr_status_t pconfig_cleanup(void *data)
+{
+ int advertise_run = ma_advertise_run;
+
+ is_mp_running = 0;
+ ma_advertise_run = 0;
+ if (advertise_run) {
+ ma_advertise_stat = HTTP_FORBIDDEN;
+ ma_advertise_server(ma_server_rec, MA_ADVERTISE_STATUS);
+ }
+
+ if (is_mp_created) {
+ apr_sleep(1000);
+ /* Wait for the parent maintenance thread to finish */
+ while (is_mp_created) {
+ apr_sleep(MA_TM_RESOLUTION);
+ }
+ }
+ if (advertise_run) {
+ ma_advertise_stat = HTTP_FORBIDDEN;
+ ma_advertise_server(ma_server_rec, MA_ADVERTISE_STATUS);
+ }
+ if (magd) {
+ /* Remove the process_cleanup.
+ * We need to reattach again because the
+ * module can be reloaded on different address
+ */
+ apr_pool_cleanup_kill(magd->ppool, magd, process_cleanup);
+ }
+ return APR_SUCCESS;
+}
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* Post config hook. */
+/* Create management thread in parent and initializes Manager */
+/* */
+/*--------------------------------------------------------------------------*/
+static int post_config_hook(apr_pool_t *pconf, apr_pool_t *plog,
+ apr_pool_t *ptemp, server_rec *s)
+{
+ apr_status_t rv;
+ const char *pk = "advertise_init_module_tag";
+ apr_pool_t *pproc = s->process->pool;
+ apr_thread_t *tp;
+
+ apr_pool_userdata_get((void *)&magd, pk, pproc);
+ if (!magd) {
+ if (!(magd = apr_pcalloc(pproc, sizeof(ma_global_data_t))))
+ return apr_get_os_error();
+ apr_pool_create(&magd->ppool, pproc);
+ apr_pool_userdata_set(magd, pk, apr_pool_cleanup_null, pproc);
+ /* First time config phase -- skip. */
+ return OK;
+ }
+#if defined(WIN32)
+ {
+ const char *ppid = getenv("AP_PARENT_PID");
+ if (ppid) {
+ ma_parent_pid = atol(ppid);
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+ "[%" APR_PID_T_FMT " - %" APR_PID_T_FMT
+ "] in child post config hook",
+ getpid(), ma_parent_pid);
+ return OK;
+ }
+ }
+#endif
+ ma_server_rec = s;
+ if (!magd->generation) {
+ /* Favor dynamic configuration */
+ if (ma_advertise_skey) {
+ apr_md5_ctx_t mc;
+ apr_md5_init(&mc);
+ apr_md5_update(&mc, ma_advertise_skey, strlen(ma_advertise_skey));
+ apr_md5_final(magd->ssalt, &mc);
+ }
+ apr_uuid_get(&magd->suuid);
+ magd->srvid[0] = '/';
+ apr_uuid_format(&magd->srvid[1], &magd->suuid);
+ }
+ if (!ma_advertise_srvh)
+ ma_advertise_srvh = magd->srvid;
+ if (!ma_advertise_srvm)
+ ma_advertise_srvm = apr_pstrdup(pconf, "http");
+
+ /* Check if we have advertise set */
+ if (ma_advertise_mode != ma_advertise_off &&
+ ma_advertise_set && ma_advertise_adrs) {
+ rv = ma_group_join(ma_advertise_adrs, ma_advertise_port, pconf);
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
+ "mod_advertise: multicast join failed for %s:%d.",
+ ma_advertise_adrs, ma_advertise_port);
+ ma_advertise_run = 0;
+ }
+ else {
+ ma_advertise_run = 1;
+ ma_advertise_stat = 200;
+ }
+ }
+
+ /* Create parent management thread */
+ is_mp_running = 1;
+ rv = apr_thread_create(&tp, NULL, parent_thread, s, pconf);
+ if (rv != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
+ "mod_advertise: parent apr_thread_create");
+ return rv;
+ }
+ apr_thread_detach(tp);
+
+ /* Create cleanup pool that will be destroyed first
+ * in future use new apr_pool_pre_cleanup_register from APR 1.3
+ */
+ apr_pool_create(&magd->cpool, pconf);
+ apr_pool_cleanup_register(magd->cpool, magd, pconfig_cleanup,
+ apr_pool_cleanup_null);
+
+ if (magd->generation++) {
+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
+ "Advertise reinitialized for process %" APR_PID_T_FMT,
+ getpid());
+ }
+ else {
+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
+ "Advertise initialized for process %" APR_PID_T_FMT,
+ getpid());
+ }
+
+ apr_pool_cleanup_register(magd->ppool, magd, process_cleanup,
+ apr_pool_cleanup_null);
+
+
+
+ return OK;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* List of directives specific to our module. */
+/* */
+/*--------------------------------------------------------------------------*/
+static const command_rec cmd_table[] =
+{
+ AP_INIT_TAKE12(
+ "ServerAdvertise", /* directive name */
+ cmd_advertise_m, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Server advertise mode: On | Off [Address]"
+ ),
+ AP_INIT_TAKE1(
+ "AdvertiseGroup", /* directive name */
+ cmd_advertise_g, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Multicast group address"
+ ),
+ AP_INIT_TAKE1(
+ "AdvertiseFrequency", /* directive name */
+ cmd_advertise_f, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Advertise frequency in seconds[.miliseconds]"
+ ),
+ AP_INIT_TAKE1(
+ "AdvertiseSecurityKey", /* directive name */
+ cmd_advertise_k, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Advertise security key"
+ ),
+ AP_INIT_TAKE1(
+ "AdvertiseManagerUrl", /* directive name */
+ cmd_advertise_h, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Advertise manager url"
+ ),
+ {NULL}
+
+};
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* Which functions are responsible for which hooks in the server. */
+/* */
+/*--------------------------------------------------------------------------*/
+static void register_hooks(apr_pool_t *p)
+{
+
+ /* Post config handling
+ */
+ ap_hook_post_config(post_config_hook,
+ NULL,
+ NULL,
+ APR_HOOK_LAST);
+
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* */
+/* The list of callback routines and data structures that provide */
+/* the static hooks into our module from the other parts of the server. */
+/* */
+/*--------------------------------------------------------------------------*/
+module AP_MODULE_DECLARE_DATA advertise_module =
+{
+ STANDARD20_MODULE_STUFF,
+ NULL, /* per-directory config creator */
+ NULL, /* dir config merger */
+ NULL, /* server config creator */
+ NULL, /* server config merger */
+ cmd_table, /* command table */
+ register_hooks /* set up other request processing hooks */
+};
Property changes on: trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.h
===================================================================
--- trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.h (rev 0)
+++ trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.h 2008-06-10 08:30:04 UTC (rev 1681)
@@ -0,0 +1,145 @@
+/*
+ * ModAdvertise - Apache Httpd advertising module
+ *
+ * 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 Mladen Turk
+ */
+
+#ifndef MOD_ADVERTISE_H
+#define MOD_ADVERTISE_H
+
+/**
+ * @file mod_advertise.h
+ * @brief Advertise Module for Apache Httpd
+ *
+ * @defgroup MOD_ADVERTISE mod_advertise
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#define CORE_PRIVATE
+
+#include "apr_hooks.h"
+#include "apr.h"
+#include "apr_lib.h"
+#include "apr_strings.h"
+#include "apr_buckets.h"
+#include "apr_md5.h"
+#include "apr_network_io.h"
+#include "apr_pools.h"
+#include "apr_strings.h"
+#include "apr_uri.h"
+#include "apr_date.h"
+#include "apr_uuid.h"
+#include "apr_version.h"
+#include "apr_atomic.h"
+
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_core.h"
+#include "http_protocol.h"
+#include "http_request.h"
+#include "http_vhost.h"
+#include "http_main.h"
+#include "http_log.h"
+#include "http_connection.h"
+#include "util_filter.h"
+#include "util_ebcdic.h"
+#include "util_time.h"
+#include "ap_provider.h"
+#include "ap_mpm.h"
+
+#if APR_HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if APR_HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if !APR_HAS_THREADS
+#error This module does not compile unless you have a thread capable APR!
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define MA_BSIZE 4096
+#define MA_SSIZE 1024
+#define MA_DEFAULT_ADVPORT 23364
+#define MA_TM_RESOLUTION APR_TIME_C(100000)
+#define MA_DEFAULT_ADV_FREQ apr_time_from_sec(10)
+#define MA_TM_MAINTAIN_STEP 10
+
+/**
+ * Multicast Time to Live (ttl) for a advertise transmission.
+ */
+#define MA_ADVERTISE_HOPS 10
+
+/**
+ * Advertise protocol types
+ */
+#define MA_ADVERTISE_SERVER 0
+#define MA_ADVERTISE_STATUS 1
+
+/**
+ * Advertise mode enumeration.
+ */
+typedef enum {
+ ma_advertise_off,
+ ma_advertise_status,
+ ma_advertise_on
+} ma_advertise_e;
+
+/**
+ * Advertise header data structure
+ */
+typedef struct ma_advertise_hdr_t ma_advertise_hdr_t;
+struct ma_advertise_hdr_t {
+ int type;
+ apr_status_t status;
+ char suuid[APR_UUID_FORMATTED_LENGTH + 1];
+};
+
+/**
+ * Advertise server data structure
+ */
+typedef struct ma_advertise_srv_t ma_advertise_srv_t;
+struct ma_advertise_srv_t {
+ const char *handle;
+ const char *address;
+ const char *protocol;
+ server_rec *server;
+ apr_port_t port;
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+#endif /* MOD_ADVERTISE_H */
Property changes on: trunk/httpd/httpd-2.2/modules/advertise/mod_advertise.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/httpd/httpd-2.2/modules/advertise/modules.mk
===================================================================
--- trunk/httpd/httpd-2.2/modules/advertise/modules.mk (rev 0)
+++ trunk/httpd/httpd-2.2/modules/advertise/modules.mk 2008-06-10 08:30:04 UTC (rev 1681)
@@ -0,0 +1,5 @@
+mod_advertise.la: mod_advertise.slo
+ $(SH_LINK) -rpath $(libexecdir) -module -avoid-version mod_advertise.lo $(MOD_MANAGER_LDADD)
+DISTCLEAN_TARGETS = modules.mk
+static =
+shared = mod_advertise.la
16 years, 6 months
JBoss Native SVN: r1680 - in trunk/mod_cluster/native: mod_slotmem and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-06-09 09:18:35 -0400 (Mon, 09 Jun 2008)
New Revision: 1680
Modified:
trunk/mod_cluster/native/include/slotmem.h
trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c
trunk/mod_cluster/native/mod_slotmem/sharedmem_util.c
Log:
Arrange warnings.
Modified: trunk/mod_cluster/native/include/slotmem.h
===================================================================
--- trunk/mod_cluster/native/include/slotmem.h 2008-06-09 13:15:16 UTC (rev 1679)
+++ trunk/mod_cluster/native/include/slotmem.h 2008-06-09 13:18:35 UTC (rev 1680)
@@ -153,4 +153,6 @@
*/
const slotmem_storage_method *mem_getstorage(apr_pool_t *p, char *type);
+void sharedmem_initialize_cleanup(apr_pool_t *p);
+
#endif /*SLOTMEM_H*/
Modified: trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c
===================================================================
--- trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c 2008-06-09 13:15:16 UTC (rev 1679)
+++ trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c 2008-06-09 13:18:35 UTC (rev 1680)
@@ -37,6 +37,7 @@
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
+#include "ap_provider.h"
#include "slotmem.h"
#include "sharedmem_util.h"
Modified: trunk/mod_cluster/native/mod_slotmem/sharedmem_util.c
===================================================================
--- trunk/mod_cluster/native/mod_slotmem/sharedmem_util.c 2008-06-09 13:15:16 UTC (rev 1679)
+++ trunk/mod_cluster/native/mod_slotmem/sharedmem_util.c 2008-06-09 13:18:35 UTC (rev 1680)
@@ -168,7 +168,6 @@
}
static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_size_t item_size, int item_num, apr_pool_t *pool)
{
- void *slotmem = NULL;
char *ptr;
struct sharedslotdesc desc;
ap_slotmem_t *res;
@@ -282,7 +281,6 @@
}
static apr_status_t ap_slotmem_attach(ap_slotmem_t **new, const char *name, apr_size_t *item_size, int *item_num, apr_pool_t *pool)
{
- void *slotmem = NULL;
char *ptr;
ap_slotmem_t *res;
ap_slotmem_t *next = globallistmem;
@@ -416,7 +414,6 @@
{
int ff;
int *ident;
- apr_status_t rv;
if (item_id > score->num || item_id <=0) {
return APR_EINVAL;
} else {
16 years, 6 months
JBoss Native SVN: r1679 - trunk/mod_cluster/native/mod_slotmem.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-06-09 09:15:16 -0400 (Mon, 09 Jun 2008)
New Revision: 1679
Modified:
trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c
Log:
Arrange licence
Modified: trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c
===================================================================
--- trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c 2008-06-09 13:04:03 UTC (rev 1678)
+++ trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c 2008-06-09 13:15:16 UTC (rev 1679)
@@ -1,17 +1,28 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * mod_cluster.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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$
*/
/* Memory handler for a shared memory divided in slot.
16 years, 6 months
JBoss Native SVN: r1678 - trunk/mod_cluster/native/mod_slotmem.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-06-09 09:04:03 -0400 (Mon, 09 Jun 2008)
New Revision: 1678
Modified:
trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c
Log:
Add a comment on the pre_config() hook.
Modified: trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c
===================================================================
--- trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c 2008-06-09 12:25:25 UTC (rev 1677)
+++ trunk/mod_cluster/native/mod_slotmem/mod_sharedmem.c 2008-06-09 13:04:03 UTC (rev 1678)
@@ -47,6 +47,10 @@
return OK;
}
+/* XXX: The global pool is clean up upon graceful restart,
+ * that is to allow the resize the shared memory area using a graceful start
+ * No sure that is a very good idea...
+ */
static int pre_config(apr_pool_t *p, apr_pool_t *plog,
apr_pool_t *ptemp)
{
16 years, 6 months
JBoss Native SVN: r1677 - trunk/mod_cluster/native/mod_manager.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-06-09 08:25:25 -0400 (Mon, 09 Jun 2008)
New Revision: 1677
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Fix the C++ warnings when using -Wall -pedantic
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-06-09 11:16:05 UTC (rev 1676)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-06-09 12:25:25 UTC (rev 1677)
@@ -449,16 +449,14 @@
nodeinfo_t nodeinfo;
balancerinfo_t balancerinfo;
int mpm_threads;
- char *JVMRoute;
- char *Domain;
- char *Host;
- char *Port;
- char *Type;
- /* XXX node conf */
struct cluster_host *vhost;
struct cluster_host *phost;
+ int i = 0;
+ int id;
+ int vid = 1; /* zero and "" is empty */
+
char **ptr = process_buff(r, buff);
if (ptr == NULL) {
*errtype = TYPESYNTAX;
@@ -497,7 +495,6 @@
balancerinfo.Maxattempts = 1;
balancerinfo.Timeout = 0;
- int i = 0;
while (ptr[i]) {
/* XXX: balancer part */
if (strcasecmp(ptr[i], "Balancer") == 0) {
@@ -639,7 +636,6 @@
}
/* Insert or update node description */
- int id;
if (insert_update_node(nodestatsmem, &nodeinfo, &id) != APR_SUCCESS) {
*errtype = TYPEMEM;
return MNODEUI;
@@ -649,7 +645,6 @@
phost = vhost;
if (phost->host == NULL && phost->context == NULL)
return NULL; /* Alias and Context missing */
- int vid = 1; /* zero and "" is empty */
while (phost) {
insert_update_hosts(hoststatsmem, phost->host, id, vid);
insert_update_contexts(contextstatsmem, phost->context, id, vid, STOPPED);
@@ -730,12 +725,15 @@
size = get_ids_used_host(hoststatsmem, id);
for (i=0; i<size; i++) {
hostinfo_t *ou;
+ int sizecontext;
+ int *idcontext;
+
get_host(hoststatsmem, &ou, id[i]);
if (ou->node != node->mess.id)
continue;
/* If the host corresponds to a node process all contextes */
- int sizecontext = get_max_size_context(contextstatsmem);
- int *idcontext = apr_palloc(r->pool, sizeof(int) * sizecontext);
+ sizecontext = get_max_size_context(contextstatsmem);
+ idcontext = apr_palloc(r->pool, sizeof(int) * sizecontext);
sizecontext = get_ids_used_context(contextstatsmem, idcontext);
for (j=0; j<sizecontext; j++) {
contextinfo_t *context;
@@ -769,11 +767,15 @@
/* Process an enable/disable/stop/remove application message */
static char * process_appl_cmd(request_rec *r, char *buff, int status, int *errtype)
{
- char *JVMRoute;
nodeinfo_t nodeinfo;
nodeinfo_t *node;
struct cluster_host *vhost;
+ int i = 0;
+ hostinfo_t hostinfo;
+ hostinfo_t *host;
+
+
char **ptr = process_buff(r, buff);
if (ptr == NULL) {
*errtype = TYPESYNTAX;
@@ -786,7 +788,6 @@
vhost->context = NULL;
vhost->next = NULL;
- int i = 0;
while (ptr[i]) {
if (strcasecmp(ptr[i], "JVMRoute") == 0) {
if (strlen(ptr[i+1])>=sizeof(nodeinfo.mess.JVMRoute)) {
@@ -840,9 +841,6 @@
}
/* Read the ID of the virtual corresponding to the first Alias */
- hostinfo_t hostinfo;
- hostinfo_t *host;
-
hostinfo.node = node->mess.id;
if (vhost->host != NULL)
strcpy(hostinfo.host, vhost->host);
@@ -852,11 +850,11 @@
hostinfo.id = 0;
host = read_host(hoststatsmem, &hostinfo);
if (host == NULL) {
+ int vid = 1; /* XXX: That is not really the right value, but that works most time */
/* If REMOVE ignores it */
if (status == REMOVE)
return NULL;
/* If the Host doesn't exist yet create it */
- int vid = 1; /* XXX: That is not really the right value, but that works most time */
insert_update_hosts(hoststatsmem, vhost->host, node->mess.id, vid);
hostinfo.id = 0;
if (vhost->host != NULL)
@@ -928,16 +926,18 @@
*/
static char * process_status(request_rec *r, char *buff, int *errtype)
{
- int Load;
+ int Load = -1;
nodeinfo_t nodeinfo;
nodeinfo_t *node;
+
+ int i = 0;
+
char **ptr = process_buff(r, buff);
if (ptr == NULL) {
*errtype = TYPESYNTAX;
return SMESPAR;
}
- int i = 0;
while (ptr[i]) {
if (strcasecmp(ptr[i], "JVMRoute") == 0) {
if (strlen(ptr[i+1])>=sizeof(nodeinfo.mess.JVMRoute)) {
@@ -1143,7 +1143,7 @@
node = "manager.node";
context = "manager.context";
host = "manager.host";
- host = "manager.balancer";
+ balancer = "manager.balancer";
}
nodestatsmem = get_mem_node(node, &mconf->maxnode, p, storage);
16 years, 6 months
JBoss Native SVN: r1676 - in trunk/httpd/httpd-2.2/modules: mod_manager and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-06-09 07:16:05 -0400 (Mon, 09 Jun 2008)
New Revision: 1676
Added:
trunk/httpd/httpd-2.2/modules/mod_manager/
trunk/httpd/httpd-2.2/modules/mod_manager/NMAKEmakefile
trunk/httpd/httpd-2.2/modules/mod_manager/NMAKEmanager
trunk/httpd/httpd-2.2/modules/mod_slotmem/
trunk/httpd/httpd-2.2/modules/mod_slotmem/NMAKEmakefile
trunk/httpd/httpd-2.2/modules/mod_slotmem/NMAKEslotmem
Modified:
trunk/httpd/httpd-2.2/modules/NMAKEmakefile
Log:
Add slotmem and manager windows makefiles
Modified: trunk/httpd/httpd-2.2/modules/NMAKEmakefile
===================================================================
--- trunk/httpd/httpd-2.2/modules/NMAKEmakefile 2008-06-09 11:00:12 UTC (rev 1675)
+++ trunk/httpd/httpd-2.2/modules/NMAKEmakefile 2008-06-09 11:16:05 UTC (rev 1676)
@@ -46,6 +46,8 @@
metadata\~ \
ssl\~ \
proxy\~ \
+ mod_slotmem\~ \
+ mod_manager\~ \
jk\~
all: $(SUBDIRS)
Added: trunk/httpd/httpd-2.2/modules/mod_manager/NMAKEmakefile
===================================================================
--- trunk/httpd/httpd-2.2/modules/mod_manager/NMAKEmakefile (rev 0)
+++ trunk/httpd/httpd-2.2/modules/mod_manager/NMAKEmakefile 2008-06-09 11:16:05 UTC (rev 1676)
@@ -0,0 +1,43 @@
+# Copyright 2001-2007 The Apache Software Foundation or its licensors, as
+# applicable.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ====================================================================
+#
+# NMAKEmakefile Master HTTPD cluster module makefile.
+#
+# Originally contributed by Mladen Turk <mturk redhat.com>
+#
+# ====================================================================
+#
+
+TARGET=DLL
+!IF !DEFINED(SRCDIR) || "$(SRCDIR)" == ""
+SRCDIR = .
+!ENDIF
+
+!include <..\..\NMAKEcommon.inc>
+!include <..\..\NMAKEhttpd.inc>
+
+MODULES = \
+ $(SRCDIR)\NMAKEmanager
+
+$(MODULES):
+ @$(MAKE) -nologo -f $@ PREFIX=$(PREFIX) install
+
+$(WORKDIR):
+ @$(MAKEWORKDIR)
+
+install: $(WORKDIR) $(MODULES)
+ @xcopy "$(WORKDIR)\*.so" "$(BUILDMOD)" /Y /Q 2>NUL
Property changes on: trunk/httpd/httpd-2.2/modules/mod_manager/NMAKEmakefile
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/httpd/httpd-2.2/modules/mod_manager/NMAKEmanager
===================================================================
--- trunk/httpd/httpd-2.2/modules/mod_manager/NMAKEmanager (rev 0)
+++ trunk/httpd/httpd-2.2/modules/mod_manager/NMAKEmanager 2008-06-09 11:16:05 UTC (rev 1676)
@@ -0,0 +1,67 @@
+# Copyright 2001-2007 The Apache Software Foundation or its licensors, as
+# applicable.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ====================================================================
+#
+# NMAKEmakefile mod_manager module makefile.
+#
+# Originally contributed by Mladen Turk <mturk redhat.com>
+#
+# ====================================================================
+#
+
+TARGET=DLL
+PROJECT = mod_manager
+
+!IF !DEFINED(SRCDIR) || "$(SRCDIR)" == ""
+SRCDIR = .
+!ENDIF
+
+!include <..\..\NMAKEcommon.inc>
+!include <..\..\NMAKEhttpd.inc>
+
+LDIRS = /libpath:"$(BUILDLIB)"
+LFLAGS = $(LFLAGS) user32.lib psapi.lib gdi32.lib shlwapi.lib wldap32.lib ole32.lib $(LIBAPR) $(LIBAPU) $(LIBHTTPD) mod_proxy.lib
+CFLAGS = $(CFLAGS) -DCLUSTER_DECLARE_EXPORT
+
+INCLUDES = -I$(SRCDIR) -I$(BUILDINC) -I../generators -I../proxy -I../ssl
+PDBFLAGS = -Fo$(WORKDIR)\ -Fd$(WORKDIR)\$(PROJECT)-src
+
+BUILDBIN = $(WORKDIR)\$(PROJECT).so
+BUILDPDB = $(WORKDIR)\$(PROJECT).pdb
+BUILDRES = $(WORKDIR)\$(PROJECT).res
+BUILDMFT = $(BUILDBIN).manifest
+
+RCFLAGS = $(RCFLAGS) /d BIN_NAME="$(PROJECT).so" /d LONG_NAME="mod_manager module for Apache"
+
+OBJECTS = \
+ $(WORKDIR)\balancer.obj \
+ $(WORKDIR)\context.obj \
+ $(WORKDIR)\host.obj \
+ $(WORKDIR)\node.obj \
+ $(WORKDIR)\mod_manager.obj
+
+{$(SRCDIR)}.c{$(WORKDIR)}.obj:
+ $(CC) $(CFLAGS) $(INCLUDES) $(PDBFLAGS) $<
+
+$(BUILDRES): ..\..\build\win32\httpd.rc
+ $(RC) $(RCFLAGS) /i "$(BUILDINC)" /fo $(BUILDRES) ..\..\build\win32\httpd.rc
+
+$(BUILDBIN): $(OBJECTS) $(BUILDRES)
+ $(LINK) $(LFLAGS) $(OBJECTS) $(BUILDRES) $(LIBS) $(LDIRS) /pdb:$(BUILDPDB) /out:$(BUILDBIN)
+ IF EXIST $(BUILDMFT) \
+ mt -nologo -manifest $(BUILDMFT) -outputresource:$(BUILDBIN);2
+
+install: $(BUILDBIN)
Added: trunk/httpd/httpd-2.2/modules/mod_slotmem/NMAKEmakefile
===================================================================
--- trunk/httpd/httpd-2.2/modules/mod_slotmem/NMAKEmakefile (rev 0)
+++ trunk/httpd/httpd-2.2/modules/mod_slotmem/NMAKEmakefile 2008-06-09 11:16:05 UTC (rev 1676)
@@ -0,0 +1,43 @@
+# Copyright 2001-2007 The Apache Software Foundation or its licensors, as
+# applicable.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ====================================================================
+#
+# NMAKEmakefile Master HTTPD cluster module makefile.
+#
+# Originally contributed by Mladen Turk <mturk redhat.com>
+#
+# ====================================================================
+#
+
+TARGET=DLL
+!IF !DEFINED(SRCDIR) || "$(SRCDIR)" == ""
+SRCDIR = .
+!ENDIF
+
+!include <..\..\NMAKEcommon.inc>
+!include <..\..\NMAKEhttpd.inc>
+
+MODULES = \
+ $(SRCDIR)\NMAKEslotmem
+
+$(MODULES):
+ @$(MAKE) -nologo -f $@ PREFIX=$(PREFIX) install
+
+$(WORKDIR):
+ @$(MAKEWORKDIR)
+
+install: $(WORKDIR) $(MODULES)
+ @xcopy "$(WORKDIR)\*.so" "$(BUILDMOD)" /Y /Q 2>NUL
Property changes on: trunk/httpd/httpd-2.2/modules/mod_slotmem/NMAKEmakefile
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/httpd/httpd-2.2/modules/mod_slotmem/NMAKEslotmem
===================================================================
--- trunk/httpd/httpd-2.2/modules/mod_slotmem/NMAKEslotmem (rev 0)
+++ trunk/httpd/httpd-2.2/modules/mod_slotmem/NMAKEslotmem 2008-06-09 11:16:05 UTC (rev 1676)
@@ -0,0 +1,64 @@
+# Copyright 2001-2007 The Apache Software Foundation or its licensors, as
+# applicable.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ====================================================================
+#
+# NMAKEmakefile mod_sharedmem module makefile.
+#
+# Originally contributed by Mladen Turk <mturk redhat.com>
+#
+# ====================================================================
+#
+
+TARGET=DLL
+PROJECT = mod_sharedmem
+
+!IF !DEFINED(SRCDIR) || "$(SRCDIR)" == ""
+SRCDIR = .
+!ENDIF
+
+!include <..\..\NMAKEcommon.inc>
+!include <..\..\NMAKEhttpd.inc>
+
+LDIRS = /libpath:"$(BUILDLIB)"
+LFLAGS = $(LFLAGS) user32.lib psapi.lib gdi32.lib shlwapi.lib wldap32.lib ole32.lib $(LIBAPR) $(LIBAPU) $(LIBHTTPD)
+CFLAGS = $(CFLAGS) -DCLUSTER_DECLARE_EXPORT
+
+INCLUDES = -I$(SRCDIR) -I$(BUILDINC)
+PDBFLAGS = -Fo$(WORKDIR)\ -Fd$(WORKDIR)\$(PROJECT)-src
+
+BUILDBIN = $(WORKDIR)\$(PROJECT).so
+BUILDPDB = $(WORKDIR)\$(PROJECT).pdb
+BUILDRES = $(WORKDIR)\$(PROJECT).res
+BUILDMFT = $(BUILDBIN).manifest
+
+RCFLAGS = $(RCFLAGS) /d BIN_NAME="$(PROJECT).so" /d LONG_NAME="mod_sharedmem module for Apache"
+
+OBJECTS = \
+ $(WORKDIR)\sharedmem_util.obj \
+ $(WORKDIR)\mod_sharedmem.obj
+
+{$(SRCDIR)}.c{$(WORKDIR)}.obj:
+ $(CC) $(CFLAGS) $(INCLUDES) $(PDBFLAGS) $<
+
+$(BUILDRES): ..\..\build\win32\httpd.rc
+ $(RC) $(RCFLAGS) /i "$(BUILDINC)" /fo $(BUILDRES) ..\..\build\win32\httpd.rc
+
+$(BUILDBIN): $(OBJECTS) $(BUILDRES)
+ $(LINK) $(LFLAGS) $(OBJECTS) $(BUILDRES) $(LIBS) $(LDIRS) /pdb:$(BUILDPDB) /out:$(BUILDBIN)
+ IF EXIST $(BUILDMFT) \
+ mt -nologo -manifest $(BUILDMFT) -outputresource:$(BUILDBIN);2
+
+install: $(BUILDBIN)
16 years, 6 months
JBoss Native SVN: r1675 - trunk/httpd/httpd-2.2/modules/proxy.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-06-09 07:00:12 -0400 (Mon, 09 Jun 2008)
New Revision: 1675
Modified:
trunk/httpd/httpd-2.2/modules/proxy/NMAKEmakefile
Log:
mod_proxy_cluster is last module to build
Modified: trunk/httpd/httpd-2.2/modules/proxy/NMAKEmakefile
===================================================================
--- trunk/httpd/httpd-2.2/modules/proxy/NMAKEmakefile 2008-06-09 10:58:07 UTC (rev 1674)
+++ trunk/httpd/httpd-2.2/modules/proxy/NMAKEmakefile 2008-06-09 11:00:12 UTC (rev 1675)
@@ -37,7 +37,7 @@
$(SRCDIR)\NMAKEproxyftp \
$(SRCDIR)\NMAKEproxyconnect \
$(SRCDIR)\NMAKEproxybalancer \
- $(SRCDIR)\NMAKEproxycluster \
+ $(SRCDIR)\NMAKEproxycluster
$(MODULES):
@$(MAKE) -nologo -f $@ PREFIX=$(PREFIX) install
16 years, 6 months
JBoss Native SVN: r1674 - trunk/httpd/httpd-2.2.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-06-09 06:58:07 -0400 (Mon, 09 Jun 2008)
New Revision: 1674
Modified:
trunk/httpd/httpd-2.2/NMAKElibhttpd
Log:
Add GNU Iconv to the build
Modified: trunk/httpd/httpd-2.2/NMAKElibhttpd
===================================================================
--- trunk/httpd/httpd-2.2/NMAKElibhttpd 2008-06-09 10:53:56 UTC (rev 1673)
+++ trunk/httpd/httpd-2.2/NMAKElibhttpd 2008-06-09 10:58:07 UTC (rev 1674)
@@ -108,6 +108,7 @@
BUILDZLIB = $(BUILDLIB)\$(ZLIB)
BUILDPCRE = $(BUILDLIB)\$(PCRE)
BUILDTCHR = $(SRCDIR)\server\gen_test_char.exe
+BUILDICONV = $(BUILDOUT)\$(LIBICONV)
all: $(BUILDINS) $(WORKDIR) $(HEADERS) $(BUILDAPR) $(BUILDAPI) $(BUILDAPU) $(BUILDPCRE) $(BUILDZLIB) $(BUILDBIN)
@@ -119,6 +120,11 @@
$(BUILDINS): $(DISTSUBDIRS)
@copy /Y LICENSE $(@D) >NUL
+$(BUILDICONV):
+ @cd $(SRCDIR)\srclib\iconv
+ @$(MAKE) -nologo -f NMAKEmakefile PREFIX=$(PREFIX) install
+ @cd ..\..
+
$(BUILDAPR):
@cd $(SRCDIR)\srclib\apr
@$(MAKE) -nologo -f NMAKEmakefile PREFIX=$(PREFIX) install
@@ -203,7 +209,7 @@
$(BUILDRES): build\win32\httpd.rc
$(RC) $(RCFLAGS) /i "$(SRCDIR)\build\win32" /i "$(SRCDIR)\include" /i "$(SRCDIR)\srclib\apr\include" /fo $(BUILDRES) build\win32\httpd.rc
-$(BUILDBIN): $(WORKDIR) $(HEADERS) $(BUILDAPR) $(BUILDAPI) $(BUILDAPU) $(BUILDPCRE) $(BUILDZLIB) $(OBJECTS) $(BUILDRES)
+$(BUILDBIN): $(WORKDIR) $(HEADERS) $(BUILDAPR) $(BUILDAPI) $(BUILDICONV) $(BUILDAPU) $(BUILDPCRE) $(BUILDZLIB) $(OBJECTS) $(BUILDRES)
$(LINK) $(LFLAGS) $(OBJECTS) $(BUILDRES) $(LIBS) $(LDIRS) /pdb:$(BUILDPDB) /out:$(BUILDBIN)
IF EXIST $(BUILDMFT) \
mt -nologo -manifest $(BUILDMFT) -outputresource:$(BUILDBIN);2
16 years, 6 months
JBoss Native SVN: r1673 - trunk/httpd/httpd-2.2/modules.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-06-09 06:53:56 -0400 (Mon, 09 Jun 2008)
New Revision: 1673
Modified:
trunk/httpd/httpd-2.2/modules/NMAKEmakefile
Log:
Build proxy after ssl
Modified: trunk/httpd/httpd-2.2/modules/NMAKEmakefile
===================================================================
--- trunk/httpd/httpd-2.2/modules/NMAKEmakefile 2008-06-09 10:52:44 UTC (rev 1672)
+++ trunk/httpd/httpd-2.2/modules/NMAKEmakefile 2008-06-09 10:53:56 UTC (rev 1673)
@@ -44,8 +44,8 @@
loggers\~ \
mappers\~ \
metadata\~ \
+ ssl\~ \
proxy\~ \
- ssl\~ \
jk\~
all: $(SUBDIRS)
16 years, 6 months