[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> |
---|
[217] | 40 | #ifndef WIN32 |
---|
[26] | 41 | #include <sys/ipc.h> |
---|
| 42 | #include <sys/shm.h> |
---|
[217] | 43 | #else |
---|
| 44 | #include <direct.h> |
---|
| 45 | #endif |
---|
[26] | 46 | #include <stdio.h> |
---|
[1] | 47 | #include <unistd.h> |
---|
| 48 | #include <time.h> |
---|
| 49 | #include <ctype.h> |
---|
| 50 | #ifndef WIN32 |
---|
| 51 | #include <xlocale.h> |
---|
| 52 | #endif |
---|
| 53 | #include "service.h" |
---|
| 54 | #include <openssl/sha.h> |
---|
[301] | 55 | #include <openssl/md5.h> |
---|
[1] | 56 | #include <openssl/hmac.h> |
---|
| 57 | #include <openssl/evp.h> |
---|
| 58 | #include <openssl/bio.h> |
---|
| 59 | #include <openssl/buffer.h> |
---|
| 60 | |
---|
[268] | 61 | #include "cgic.h" |
---|
[301] | 62 | #include "ulinet.h" |
---|
[268] | 63 | |
---|
[217] | 64 | extern int getServiceFromFile(const char*,service**); |
---|
| 65 | extern int conf_read(const char*,maps*); |
---|
[1] | 66 | |
---|
[26] | 67 | #ifdef USE_JS |
---|
| 68 | #define XP_UNIX 0 |
---|
| 69 | #include "service_internal_js.h" |
---|
| 70 | #endif |
---|
| 71 | |
---|
[1] | 72 | #ifdef __cplusplus |
---|
| 73 | extern "C" { |
---|
| 74 | #endif |
---|
| 75 | #include <libxml/parser.h> |
---|
[301] | 76 | #include <libxml/xpath.h> |
---|
| 77 | |
---|
[1] | 78 | static char* SERVICE_URL; |
---|
[301] | 79 | static xmlNsPtr usedNs[10]; |
---|
| 80 | static char* nsName[10]; |
---|
[9] | 81 | static int nbNs=0; |
---|
[1] | 82 | |
---|
[217] | 83 | void unhandleStatus(maps*); |
---|
| 84 | void updateStatus(maps*); |
---|
[26] | 85 | char* getStatus(int); |
---|
[9] | 86 | |
---|
[26] | 87 | #ifdef USE_JS |
---|
| 88 | char* JSValToChar(JSContext*,jsval*); |
---|
[301] | 89 | JSBool JSUpdateStatus(JSContext*,uintN,jsval *); |
---|
[26] | 90 | #endif |
---|
| 91 | |
---|
[1] | 92 | void URLDecode(char *); |
---|
| 93 | char *url_encode(char *); |
---|
[9] | 94 | char* getEncoding(maps*); |
---|
| 95 | |
---|
[217] | 96 | int zooXmlSearchForNs(const char*); |
---|
| 97 | int zooXmlAddNs(xmlNodePtr,const char*,const char*); |
---|
[9] | 98 | void zooXmlCleanupNs(); |
---|
[1] | 99 | |
---|
| 100 | void printExceptionReportResponse(maps*,map*); |
---|
[26] | 101 | xmlNodePtr createExceptionReportNode(maps*,map*,int); |
---|
[217] | 102 | void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*); |
---|
| 103 | xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,const char*,maps*); |
---|
[1] | 104 | void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*); |
---|
[217] | 105 | xmlNodePtr printDescribeProcessHeader(xmlDocPtr,const char*,maps*); |
---|
[9] | 106 | void printDescribeProcessForProcess(maps*,xmlNodePtr,service*,int); |
---|
[217] | 107 | void printFullDescription(elements*,const char*,xmlNsPtr,xmlNodePtr); |
---|
[9] | 108 | void printDocument(maps*,xmlDocPtr,int); |
---|
[217] | 109 | void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*); |
---|
| 110 | void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
| 111 | map* parseBoundingBox(const char*); |
---|
[76] | 112 | void printBoundingBox(xmlNsPtr,xmlNodePtr,map*); |
---|
| 113 | void printBoundingBoxDocument(maps*,maps*,FILE*); |
---|
[217] | 114 | void printOutputDefinitions1(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
[1] | 115 | |
---|
| 116 | void outputResponse(service*,maps*,maps*,map*,int,maps*,int); |
---|
| 117 | |
---|
[217] | 118 | char *base64(const char*,int); |
---|
| 119 | char *base64d(const char*,int,int*); |
---|
[88] | 120 | void ensureDecodedBase64(maps**); |
---|
[1] | 121 | |
---|
[63] | 122 | char* addDefaultValues(maps**,elements*,maps*,int); |
---|
[1] | 123 | |
---|
[9] | 124 | int errorException(maps *m, const char *message, const char *errorcode); |
---|
| 125 | |
---|
[301] | 126 | int checkForSoapEnvelope(xmlDocPtr); |
---|
| 127 | |
---|
| 128 | void addToCache(maps*,char*,char*,int); |
---|
| 129 | char* isInCache(maps*,char*); |
---|
| 130 | void loadRemoteFile(maps*,map*,HINTERNET,char*); |
---|
| 131 | |
---|
[1] | 132 | #ifdef __cplusplus |
---|
| 133 | } |
---|
| 134 | #endif |
---|
| 135 | |
---|
| 136 | #endif |
---|