From: André Malo Date: Sun, 25 Jan 2004 22:03:38 +0000 (+0000) Subject: Add core version query function ap_get_server_revision and X-Git-Tag: pre_ajp_proxy~770 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02bc2a93e8936d712822fe0035bea0864233be5a;p=apache Add core version query function ap_get_server_revision and accompanying ap_version_t structure (minor MMN bump). The function is similar to apr_version() and allow for exact querying of the core revision level. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102405 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 3447530b15..fece570d8b 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) Add core version query function (ap_get_server_revision) and + accompanying ap_version_t structure (minor MMN bump). + [André Malo] + *) mod_rewrite: EOLs sent by external rewritemaps are now consumed as whole. That way, on systems with more than one EOL character rewritemap programs no longer need to switch stdout to binary diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 157b1f578d..aafb64586f 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -118,6 +118,7 @@ * 20030821 (2.1.0-dev) bumped mod_include's entire API * 20030821.1 (2.1.0-dev) added XHTML doctypes * 20030821.2 (2.1.0-dev) added ap_escape_errorlog_item + * 20030821.3 (2.1.0-dev) added ap_get_server_revision / ap_version_t */ #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */ @@ -125,7 +126,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20030821 #endif -#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 3 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/ap_release.h b/include/ap_release.h index f6ca9d4b65..28222ec2be 100644 --- a/include/ap_release.h +++ b/include/ap_release.h @@ -59,6 +59,8 @@ #ifndef AP_RELEASE_H #define AP_RELEASE_H +#include "apr_general.h" /* stringify */ + /* * The below defines the base string of the Server: header. Additional * tokens can be added via the ap_add_version_component() API call. @@ -73,9 +75,18 @@ */ #define AP_SERVER_BASEVENDOR "Apache Software Foundation" #define AP_SERVER_BASEPRODUCT "Apache" -#define AP_SERVER_MAJORVERSION "2" -#define AP_SERVER_MINORVERSION "1" -#define AP_SERVER_PATCHLEVEL "0-dev" + +#define AP_SERVER_MAJORVERSION_NUMBER 2 +#define AP_SERVER_MINORVERSION_NUMBER 1 +#define AP_SERVER_PATCHLEVEL_NUMBER 0 +#define AP_SERVER_ADD_STRING "-dev" + +/* keep old macros as well */ +#define AP_SERVER_MAJORVERSION APR_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER) +#define AP_SERVER_MINORVERSION APR_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER) +#define AP_SERVER_PATCHLEVEL APR_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \ + AP_SERVER_ADD_STRING + #define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION #define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL #define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION diff --git a/include/httpd.h b/include/httpd.h index c8ed789a7e..43437e29ce 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -415,6 +415,25 @@ extern "C" { # define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD #endif +/** + * The numeric version information is broken out into fields within this + * structure. + */ +typedef struct { + int major; /**< major number */ + int minor; /**< minor number */ + int patch; /**< patch number */ + const char *add_string; /**< additional string like "-dev" */ +} ap_version_t; + +/** + * Return httpd's version information in a numeric form. + * + * @param version Pointer to a version structure for returning the version + * information. + */ +AP_DECLARE(void) ap_get_server_revision(ap_version_t *version); + /** * Get the server version string * @return The server version string diff --git a/server/core.c b/server/core.c index 9ce87319bd..1547ea7481 100644 --- a/server/core.c +++ b/server/core.c @@ -2364,6 +2364,14 @@ static apr_status_t reset_version(void *dummy) return APR_SUCCESS; } +AP_DECLARE(void) ap_get_server_revision(ap_version_t *version) +{ + version->major = AP_SERVER_MAJORVERSION_NUMBER; + version->minor = AP_SERVER_MINORVERSION_NUMBER; + version->patch = AP_SERVER_PATCHLEVEL_NUMBER; + version->add_string = AP_SERVER_ADD_STRING; +} + AP_DECLARE(const char *) ap_get_server_version(void) { return (server_version ? server_version : AP_SERVER_BASEVERSION);