[mapserver-commits] r7326 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Jan 29 20:58:56 EST 2008


Author: tomkralidis
Date: 2008-01-29 20:58:56 -0500 (Tue, 29 Jan 2008)
New Revision: 7326

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapowscommon.c
   trunk/mapserver/mapowscommon.h
Log:
add OWS Common style version negotiation (#996)


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-01-29 18:43:03 UTC (rev 7325)
+++ trunk/mapserver/HISTORY.TXT	2008-01-30 01:58:56 UTC (rev 7326)
@@ -13,6 +13,8 @@
 Current Version (5.1-dev, SVN trunk):
 -------------------------------------
 
+- mapowscommon.c: add OWS Common style version negotiation (#996)
+
 - mapwcs.c: better section parameter handling for CITE (#2485)
 
 - mapwfs.c: point to the correct schema for exceptions (#2480)

Modified: trunk/mapserver/mapowscommon.c
===================================================================
--- trunk/mapserver/mapowscommon.c	2008-01-29 18:43:03 UTC (rev 7325)
+++ trunk/mapserver/mapowscommon.c	2008-01-30 01:58:56 UTC (rev 7326)
@@ -45,6 +45,37 @@
 MS_CVSID("$Id$")
 
 /**
+ * msOWSCommonNegotiateVersion()
+ *
+ * returns a supported version as per subclause 7.3.2
+ *
+ * @param requested_version the version passed by the client
+ * @param supported_versions an array of supported versions
+ * @param num_supported_versions size of supported_versions
+ *
+ * @return supported version integer, or -1 on error
+ *
+ */
+
+int msOWSCommonNegotiateVersion(int requested_version, int supported_versions[], int num_supported_versions) {
+  int i;
+
+  /* if version is not set return error */
+  if (! requested_version)
+    return -1;
+
+  /* return the first entry that's equal to the requested version */
+  for (i = 0; i < num_supported_versions; i++) {
+    if (supported_versions[i] == requested_version)
+      return supported_versions[i];
+  }
+
+  /* no match; calling code should throw an exception */
+  return -1;
+}
+
+
+/**
  * msOWSCommonServiceIdentification()
  *
  * returns an object of ServiceIdentification as per:

Modified: trunk/mapserver/mapowscommon.h
===================================================================
--- trunk/mapserver/mapowscommon.h	2008-01-29 18:43:03 UTC (rev 7325)
+++ trunk/mapserver/mapowscommon.h	2008-01-30 01:58:56 UTC (rev 7326)
@@ -70,6 +70,8 @@
 
 /* function prototypes */
 
+int msOWSCommonNegotiateVersion(int requested_version, int supported_versions[], int num_supported_versions);
+
 xmlNodePtr msOWSCommonServiceIdentification(xmlNsPtr psNsOws, mapObj *map, const char *servicetype, const char *version);
 
 xmlNodePtr msOWSCommonServiceProvider(xmlNsPtr psNsOws, xmlNsPtr psXLinkNs, mapObj *map);



More information about the mapserver-commits mailing list