MCPcopy Index your code
hub / github.com/MapServer/MapServer / msWCSGetCapabilities

Function msWCSGetCapabilities

mapwcs.c:939–1055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937/************************************************************************/
938
939static int msWCSGetCapabilities(mapObj *map, wcsParamsObj *params, cgiRequestObj *req, owsRequestObj *ows_request)
940{
941 char tmpString[OWS_VERSION_MAXLEN];
942 int i, tmpInt = 0;
943 int wcsSupportedVersions[] = {OWS_1_1_2, OWS_1_1_1, OWS_1_1_0, OWS_1_0_0};
944 int wcsNumSupportedVersions = 4;
945 const char *updatesequence=NULL;
946 const char *encoding;
947
948 encoding = msOWSLookupMetadata(&(map->web.metadata), "CO", "encoding");
949
950 /* check version is valid */
951 tmpInt = msOWSParseVersionString(params->version);
952 if (tmpInt == OWS_VERSION_BADFORMAT)
953 {
954 return msWCSException(map, "InvalidParameterValue",
955 "request", "1.0.0 ");
956 }
957
958 /* negotiate version */
959 tmpInt = msOWSNegotiateVersion(tmpInt, wcsSupportedVersions, wcsNumSupportedVersions);
960
961 /* set result as string and carry on */
962 free(params->version);
963 params->version = msStrdup(msOWSGetVersionString(tmpInt, tmpString));
964
965/* -------------------------------------------------------------------- */
966/* 1.1.x is sufficiently different we have a whole case for */
967/* it. The remainder of this function is for 1.0.0. */
968/* -------------------------------------------------------------------- */
969 if( strncmp(params->version,"1.1",3) == 0 )
970 return msWCSGetCapabilities11( map, params, req, ows_request);
971
972 updatesequence = msOWSLookupMetadata(&(map->web.metadata), "CO", "updatesequence");
973
974 if (params->updatesequence != NULL) {
975 i = msOWSNegotiateUpdateSequence(params->updatesequence, updatesequence);
976 if (i == 0) { /* current */
977 msSetError(MS_WCSERR, "UPDATESEQUENCE parameter (%s) is equal to server (%s)", "msWCSGetCapabilities()", params->updatesequence, updatesequence);
978 return msWCSException(map, "CurrentUpdateSequence",
979 "updatesequence", params->version );
980 }
981 if (i > 0) { /* invalid */
982 msSetError(MS_WCSERR, "UPDATESEQUENCE parameter (%s) is higher than server (%s)", "msWCSGetCapabilities()", params->updatesequence, updatesequence);
983 return msWCSException(map, "InvalidUpdateSequence",
984 "updatesequence", params->version );
985 }
986 }
987
988 else { /* set default updatesequence */
989 if(!updatesequence)
990 updatesequence = msStrdup("0");
991 params->updatesequence = msStrdup(updatesequence);
992 }
993
994 /* if a bum section param is passed, throw exception */
995 if (params->section &&
996 strcasecmp(params->section, "/WCS_Capabilities/Service") != 0 &&

Callers 1

msWCSDispatchFunction · 0.85

Calls 15

msOWSLookupMetadataFunction · 0.85
msOWSParseVersionStringFunction · 0.85
msWCSExceptionFunction · 0.85
msOWSNegotiateVersionFunction · 0.85
msStrdupFunction · 0.85
msOWSGetVersionStringFunction · 0.85
msWCSGetCapabilities11Function · 0.85
msSetErrorFunction · 0.85
strcasecmpFunction · 0.85
msIO_printfFunction · 0.85
msOWSPrintEncodeMetadataFunction · 0.85

Tested by

no test coverage detected