[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 | |
---|
[512] | 28 | #pragma once |
---|
[1] | 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> |
---|
[512] | 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> |
---|
[490] | 59 | #include "ulinet.h" |
---|
| 60 | |
---|
[1] | 61 | #include "service.h" |
---|
| 62 | #include <openssl/sha.h> |
---|
[291] | 63 | #include <openssl/md5.h> |
---|
[1] | 64 | #include <openssl/hmac.h> |
---|
| 65 | #include <openssl/evp.h> |
---|
| 66 | #include <openssl/bio.h> |
---|
| 67 | #include <openssl/buffer.h> |
---|
| 68 | |
---|
[512] | 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 |
---|
[512] | 82 | extern "C" |
---|
| 83 | { |
---|
[1] | 84 | #endif |
---|
| 85 | #include <libxml/parser.h> |
---|
[280] | 86 | #include <libxml/xpath.h> |
---|
| 87 | |
---|
[512] | 88 | static char *SERVICE_URL; |
---|
[280] | 89 | static xmlNsPtr usedNs[10]; |
---|
[512] | 90 | static char *nsName[10]; |
---|
[490] | 91 | static xmlDocPtr iDocs[10]; |
---|
[512] | 92 | static int nbNs = 0; |
---|
| 93 | static int nbDocs = 0; |
---|
[1] | 94 | |
---|
[512] | 95 | int getServiceFromYAML (maps *, char *, service **, char *name); |
---|
| 96 | int readServiceFile (maps *, char *, service **, char *); |
---|
| 97 | int isValidLang (maps *, const char *); |
---|
[465] | 98 | |
---|
[512] | 99 | void printHeaders (maps *); |
---|
| 100 | void unhandleStatus (maps *); |
---|
| 101 | int _updateStatus (maps *); |
---|
| 102 | char *getStatus (int); |
---|
[9] | 103 | |
---|
[26] | 104 | #ifdef USE_JS |
---|
[512] | 105 | char *JSValToChar (JSContext *, jsval *); |
---|
| 106 | JSBool JSUpdateStatus (JSContext *, uintN, jsval *); |
---|
[26] | 107 | #endif |
---|
[9] | 108 | |
---|
[512] | 109 | void URLDecode (char *); |
---|
| 110 | char *url_encode (char *); |
---|
| 111 | char *url_decode (char *); |
---|
| 112 | char *getEncoding (maps *); |
---|
[490] | 113 | |
---|
[512] | 114 | int zooXmlSearchForNs (const char *); |
---|
| 115 | int zooXmlAddNs (xmlNodePtr, const char *, const char *); |
---|
| 116 | void zooXmlCleanupNs (); |
---|
[1] | 117 | |
---|
[512] | 118 | int zooXmlAddDoc (xmlNodePtr, const char *, const char *); |
---|
| 119 | void zooXmlCleanupDocs (); |
---|
| 120 | void addPrefix (maps * conf, map * level, service * serv); |
---|
| 121 | void printExceptionReportResponse (maps *, map *); |
---|
| 122 | xmlNodePtr createExceptionReportNode (maps *, map *, int); |
---|
| 123 | void printProcessResponse (maps *, map *, int, service *, const char *, int, |
---|
| 124 | maps *, maps *); |
---|
| 125 | xmlNodePtr printGetCapabilitiesHeader (xmlDocPtr, const char *, maps *); |
---|
| 126 | void printGetCapabilitiesForProcess (maps *, xmlNodePtr, service *); |
---|
| 127 | xmlNodePtr printDescribeProcessHeader (xmlDocPtr, const char *, maps *); |
---|
| 128 | void printDescribeProcessForProcess (maps *, xmlNodePtr, service *); |
---|
| 129 | void printFullDescription (int, elements *, const char *, xmlNsPtr, |
---|
| 130 | xmlNodePtr); |
---|
| 131 | void printDocument (maps *, xmlDocPtr, int); |
---|
| 132 | void printDescription (xmlNodePtr, xmlNsPtr, const char *, map *); |
---|
| 133 | void printIOType (xmlDocPtr, xmlNodePtr, xmlNsPtr, xmlNsPtr, xmlNsPtr, |
---|
| 134 | elements *, maps *, const char *); |
---|
| 135 | map *parseBoundingBox (const char *); |
---|
| 136 | void printBoundingBox (xmlNsPtr, xmlNodePtr, map *); |
---|
| 137 | void printBoundingBoxDocument (maps *, maps *, FILE *); |
---|
| 138 | void printOutputDefinitions1 (xmlDocPtr, xmlNodePtr, xmlNsPtr, xmlNsPtr, |
---|
| 139 | elements *, maps *, const char *); |
---|
[1] | 140 | |
---|
[512] | 141 | void outputResponse (service *, maps *, maps *, map *, int, maps *, int); |
---|
[1] | 142 | |
---|
[512] | 143 | char *base64 (const char *, int); |
---|
| 144 | char *base64d (const char *, int, int *); |
---|
| 145 | void ensureDecodedBase64 (maps **); |
---|
[9] | 146 | |
---|
[512] | 147 | char *addDefaultValues (maps **, elements *, maps *, int); |
---|
[280] | 148 | |
---|
[512] | 149 | int errorException (maps *, const char *, const char *, const char *); |
---|
[392] | 150 | |
---|
[512] | 151 | int checkForSoapEnvelope (xmlDocPtr); |
---|
[469] | 152 | |
---|
[512] | 153 | void addToCache (maps *, char *, char *, char *, int); |
---|
| 154 | char *isInCache (maps *, char *); |
---|
| 155 | int runHttpRequests (maps **, maps **, HINTERNET *); |
---|
| 156 | int loadRemoteFile (maps **, map **, HINTERNET *, char *); |
---|
| 157 | |
---|
| 158 | char *readVSIFile (maps *, const char *); |
---|
| 159 | void parseIdentifier (maps *, char *, char *, char *); |
---|
| 160 | int updateStatus (maps *, const int, const char *); |
---|
| 161 | char *getInputValue (maps *, const char *, size_t *); |
---|
| 162 | int setOutputValue (maps *, const char *, char *, size_t); |
---|
| 163 | |
---|
[1] | 164 | #ifdef __cplusplus |
---|
| 165 | } |
---|
| 166 | #endif |
---|
| 167 | |
---|
| 168 | #endif |
---|