[1] | 1 | /** |
---|
| 2 | * Author : Gérald FENOY |
---|
| 3 | * |
---|
[392] | 4 | * Copyright (c) 2009-2013 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> |
---|
[478] | 40 | #include "cgic.h" |
---|
[216] | 41 | #ifndef WIN32 |
---|
[26] | 42 | #include <sys/ipc.h> |
---|
| 43 | #include <sys/shm.h> |
---|
[216] | 44 | #else |
---|
| 45 | #include <direct.h> |
---|
| 46 | #endif |
---|
[26] | 47 | #include <stdio.h> |
---|
[1] | 48 | #include <time.h> |
---|
| 49 | #include <ctype.h> |
---|
[453] | 50 | #ifdef WIN32 |
---|
| 51 | #ifndef USE_RUBY |
---|
| 52 | #include <unistd.h> |
---|
| 53 | #endif |
---|
| 54 | #endif |
---|
[1] | 55 | #ifndef WIN32 |
---|
| 56 | #include <xlocale.h> |
---|
| 57 | #endif |
---|
[469] | 58 | #include <dirent.h> |
---|
[1] | 59 | #include "service.h" |
---|
| 60 | #include <openssl/sha.h> |
---|
[291] | 61 | #include <openssl/md5.h> |
---|
[1] | 62 | #include <openssl/hmac.h> |
---|
| 63 | #include <openssl/evp.h> |
---|
| 64 | #include <openssl/bio.h> |
---|
| 65 | #include <openssl/buffer.h> |
---|
| 66 | |
---|
[281] | 67 | #include "ulinet.h" |
---|
[253] | 68 | |
---|
[114] | 69 | extern int conf_read(const char*,maps*); |
---|
[1] | 70 | |
---|
[26] | 71 | #ifdef USE_JS |
---|
[364] | 72 | #ifdef WIN32 |
---|
| 73 | #define XP_WIN 1 |
---|
| 74 | #else |
---|
[26] | 75 | #define XP_UNIX 0 |
---|
[364] | 76 | #endif |
---|
[26] | 77 | #include "service_internal_js.h" |
---|
| 78 | #endif |
---|
| 79 | |
---|
[453] | 80 | |
---|
[1] | 81 | #ifdef __cplusplus |
---|
| 82 | extern "C" { |
---|
| 83 | #endif |
---|
| 84 | #include <libxml/parser.h> |
---|
[280] | 85 | #include <libxml/xpath.h> |
---|
| 86 | |
---|
[1] | 87 | static char* SERVICE_URL; |
---|
[280] | 88 | static xmlNsPtr usedNs[10]; |
---|
| 89 | static char* nsName[10]; |
---|
[9] | 90 | static int nbNs=0; |
---|
[1] | 91 | |
---|
[465] | 92 | int getServiceFromYAML(maps*,char*,service**,char *name); |
---|
| 93 | int readServiceFile(maps*, char*,service**,char *); |
---|
| 94 | |
---|
| 95 | |
---|
[375] | 96 | void printHeaders(maps*); |
---|
[216] | 97 | void unhandleStatus(maps*); |
---|
[471] | 98 | int _updateStatus(maps*); |
---|
[26] | 99 | char* getStatus(int); |
---|
[9] | 100 | |
---|
[26] | 101 | #ifdef USE_JS |
---|
| 102 | char* JSValToChar(JSContext*,jsval*); |
---|
[274] | 103 | JSBool JSUpdateStatus(JSContext*,uintN,jsval *); |
---|
[26] | 104 | #endif |
---|
| 105 | |
---|
[1] | 106 | void URLDecode(char *); |
---|
| 107 | char *url_encode(char *); |
---|
[328] | 108 | char *url_decode(char *); |
---|
[9] | 109 | char* getEncoding(maps*); |
---|
| 110 | |
---|
[114] | 111 | int zooXmlSearchForNs(const char*); |
---|
| 112 | int zooXmlAddNs(xmlNodePtr,const char*,const char*); |
---|
[9] | 113 | void zooXmlCleanupNs(); |
---|
[1] | 114 | |
---|
| 115 | void printExceptionReportResponse(maps*,map*); |
---|
[26] | 116 | xmlNodePtr createExceptionReportNode(maps*,map*,int); |
---|
[114] | 117 | void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*); |
---|
| 118 | xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,const char*,maps*); |
---|
[1] | 119 | void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*); |
---|
[114] | 120 | xmlNodePtr printDescribeProcessHeader(xmlDocPtr,const char*,maps*); |
---|
[469] | 121 | void printDescribeProcessForProcess(maps*,xmlNodePtr,service*); |
---|
[114] | 122 | void printFullDescription(elements*,const char*,xmlNsPtr,xmlNodePtr); |
---|
[9] | 123 | void printDocument(maps*,xmlDocPtr,int); |
---|
[114] | 124 | void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*); |
---|
| 125 | void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
| 126 | map* parseBoundingBox(const char*); |
---|
[76] | 127 | void printBoundingBox(xmlNsPtr,xmlNodePtr,map*); |
---|
| 128 | void printBoundingBoxDocument(maps*,maps*,FILE*); |
---|
[114] | 129 | void printOutputDefinitions1(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
[1] | 130 | |
---|
| 131 | void outputResponse(service*,maps*,maps*,map*,int,maps*,int); |
---|
| 132 | |
---|
[216] | 133 | char *base64(const char*,int); |
---|
| 134 | char *base64d(const char*,int,int*); |
---|
[88] | 135 | void ensureDecodedBase64(maps**); |
---|
[1] | 136 | |
---|
[63] | 137 | char* addDefaultValues(maps**,elements*,maps*,int); |
---|
[1] | 138 | |
---|
[459] | 139 | int errorException(maps *, const char *, const char *, const char*); |
---|
[9] | 140 | |
---|
[280] | 141 | int checkForSoapEnvelope(xmlDocPtr); |
---|
| 142 | |
---|
[446] | 143 | void addToCache(maps*,char*,char*,char*,int); |
---|
[280] | 144 | char* isInCache(maps*,char*); |
---|
[471] | 145 | int loadRemoteFile(maps**,map**,HINTERNET,char*); |
---|
[392] | 146 | |
---|
[469] | 147 | char *readVSIFile(maps*,const char*); |
---|
| 148 | void parseIdentifier(maps*,char*,char*,char*); |
---|
[471] | 149 | int updateStatus( maps*,const int,const char*); |
---|
| 150 | char* getInputValue( maps*,const char*,size_t*); |
---|
| 151 | int setOutputValue( maps*, const char*, char*, size_t); |
---|
[469] | 152 | |
---|
[1] | 153 | #ifdef __cplusplus |
---|
| 154 | } |
---|
| 155 | #endif |
---|
| 156 | |
---|
| 157 | #endif |
---|