]> granicus.if.org Git - apache/commitdiff
Add core version query function ap_get_server_revision and
authorAndré Malo <nd@apache.org>
Sun, 25 Jan 2004 22:03:38 +0000 (22:03 +0000)
committerAndré Malo <nd@apache.org>
Sun, 25 Jan 2004 22:03:38 +0000 (22:03 +0000)
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

CHANGES
include/ap_mmn.h
include/ap_release.h
include/httpd.h
server/core.c

diff --git a/CHANGES b/CHANGES
index 3447530b152e9e139304ed52c317dcff7edbe517..fece570d8b0e101e00633c59621aeb3b17798da9 100644 (file)
--- 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
index 157b1f578d7ccf50260e6e803aa4a2f172169c3d..aafb64586fa5be9838cc8fdc90c8ced14c8c3fb8 100644 (file)
  * 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" */
 #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
index f6ca9d4b65cb6cc2d246abad6477b2042d162e66..28222ec2be3071d69318482ec64b1c04ba8cb84f 100644 (file)
@@ -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.
  */
 #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
index c8ed789a7e6f9fb906a0a115ade0866c0b5e5de5..43437e29ce77742638e66327239d76e35c234bf8 100644 (file)
@@ -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
index 9ce87319bda0ff6bd524a4e445b5f158708f5a12..1547ea7481f1f300684e39c515f0da04843ae8d1 100644 (file)
@@ -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);