[1] | 1 | /** |
---|
| 2 | * Author : Gérald FENOY |
---|
| 3 | * |
---|
[76] | 4 | * Copyright (c) 2009-2011 GeoLabs SARL |
---|
[1] | 5 | * |
---|
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
| 7 | * of this software and associated documentation files (the "Software"), to deal |
---|
| 8 | * in the Software without restriction, including without limitation the rights |
---|
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
| 10 | * copies of the Software, and to permit persons to whom the Software is |
---|
| 11 | * furnished to do so, subject to the following conditions: |
---|
| 12 | * |
---|
| 13 | * The above copyright notice and this permission notice shall be included in |
---|
| 14 | * all copies or substantial portions of the Software. |
---|
| 15 | * |
---|
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
| 22 | * THE SOFTWARE. |
---|
| 23 | */ |
---|
| 24 | |
---|
| 25 | #ifndef ZOO_SERVICE_INTERNAL_H |
---|
| 26 | #define ZOO_SERVICE_INTERNAL_H 1 |
---|
| 27 | |
---|
| 28 | #pragma once |
---|
| 29 | |
---|
[34] | 30 | #define DEFAULT_SERVICE_URL "http://www.zoo-project.org/" |
---|
[1] | 31 | #define TIME_SIZE 40 |
---|
| 32 | |
---|
[34] | 33 | #include <libintl.h> |
---|
| 34 | #include <locale.h> |
---|
| 35 | #define _(String) dgettext ("zoo-kernel",String) |
---|
| 36 | #define _ss(String) dgettext ("zoo-services",String) |
---|
| 37 | |
---|
[26] | 38 | #include <sys/stat.h> |
---|
[1] | 39 | #include <sys/types.h> |
---|
[26] | 40 | #include <sys/ipc.h> |
---|
| 41 | #include <sys/shm.h> |
---|
| 42 | #include <stdio.h> |
---|
[1] | 43 | #include <unistd.h> |
---|
| 44 | #include <time.h> |
---|
| 45 | #include <ctype.h> |
---|
| 46 | #ifndef WIN32 |
---|
| 47 | #include <xlocale.h> |
---|
| 48 | #endif |
---|
| 49 | #include "service.h" |
---|
| 50 | #include <openssl/sha.h> |
---|
| 51 | #include <openssl/hmac.h> |
---|
| 52 | #include <openssl/evp.h> |
---|
| 53 | #include <openssl/bio.h> |
---|
| 54 | #include <openssl/buffer.h> |
---|
| 55 | |
---|
[114] | 56 | extern int getServiceFromFile(const char*,service**); |
---|
| 57 | extern int conf_read(const char*,maps*); |
---|
[1] | 58 | |
---|
[26] | 59 | #ifdef USE_JS |
---|
| 60 | #define XP_UNIX 0 |
---|
| 61 | #include "service_internal_js.h" |
---|
| 62 | #endif |
---|
| 63 | |
---|
[1] | 64 | #ifdef __cplusplus |
---|
| 65 | extern "C" { |
---|
| 66 | #endif |
---|
| 67 | #include <libxml/parser.h> |
---|
| 68 | static char* SERVICE_URL; |
---|
[9] | 69 | static xmlNsPtr usedNs[5]; |
---|
| 70 | static char* nsName[5]; |
---|
| 71 | static int nbNs=0; |
---|
[1] | 72 | |
---|
[26] | 73 | void* unhandleStatus(maps*); |
---|
| 74 | void* updateStatus(maps*); |
---|
| 75 | char* getStatus(int); |
---|
[9] | 76 | |
---|
[26] | 77 | #ifdef USE_JS |
---|
| 78 | char* JSValToChar(JSContext*,jsval*); |
---|
| 79 | JSBool JSUpdateStatus(JSContext*,JSObject*,uintN,jsval *,jsval *); |
---|
| 80 | #endif |
---|
| 81 | |
---|
[1] | 82 | void URLDecode(char *); |
---|
| 83 | char *url_encode(char *); |
---|
[9] | 84 | char* getEncoding(maps*); |
---|
| 85 | |
---|
[114] | 86 | int zooXmlSearchForNs(const char*); |
---|
| 87 | int zooXmlAddNs(xmlNodePtr,const char*,const char*); |
---|
[9] | 88 | void zooXmlCleanupNs(); |
---|
[1] | 89 | |
---|
| 90 | void printExceptionReportResponse(maps*,map*); |
---|
[26] | 91 | xmlNodePtr createExceptionReportNode(maps*,map*,int); |
---|
[114] | 92 | void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*); |
---|
| 93 | xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,const char*,maps*); |
---|
[1] | 94 | void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*); |
---|
[114] | 95 | xmlNodePtr printDescribeProcessHeader(xmlDocPtr,const char*,maps*); |
---|
[9] | 96 | void printDescribeProcessForProcess(maps*,xmlNodePtr,service*,int); |
---|
[114] | 97 | void printFullDescription(elements*,const char*,xmlNsPtr,xmlNodePtr); |
---|
[9] | 98 | void printDocument(maps*,xmlDocPtr,int); |
---|
[114] | 99 | void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*); |
---|
| 100 | void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
| 101 | map* parseBoundingBox(const char*); |
---|
[76] | 102 | void printBoundingBox(xmlNsPtr,xmlNodePtr,map*); |
---|
| 103 | void printBoundingBoxDocument(maps*,maps*,FILE*); |
---|
[114] | 104 | void printOutputDefinitions1(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
[1] | 105 | |
---|
| 106 | void outputResponse(service*,maps*,maps*,map*,int,maps*,int); |
---|
| 107 | |
---|
| 108 | char *base64(const unsigned char*,int); |
---|
[88] | 109 | char *base64d(unsigned char*,int,int*); |
---|
| 110 | void ensureDecodedBase64(maps**); |
---|
[1] | 111 | |
---|
[63] | 112 | char* addDefaultValues(maps**,elements*,maps*,int); |
---|
[1] | 113 | |
---|
[9] | 114 | /*defined in zoo_loader.c*/ |
---|
| 115 | int errorException(maps *m, const char *message, const char *errorcode); |
---|
| 116 | |
---|
[1] | 117 | #ifdef __cplusplus |
---|
| 118 | } |
---|
| 119 | #endif |
---|
| 120 | |
---|
| 121 | #endif |
---|