1 | /** |
---|
2 | * Author : Gérald FENOY |
---|
3 | * |
---|
4 | * Copyright (c) 2009-2013 GeoLabs SARL |
---|
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 | |
---|
30 | #define DEFAULT_SERVICE_URL "http://www.zoo-project.org/" |
---|
31 | #define TIME_SIZE 40 |
---|
32 | |
---|
33 | #include <libintl.h> |
---|
34 | #include <locale.h> |
---|
35 | #define _(String) dgettext ("zoo-kernel",String) |
---|
36 | #define _ss(String) dgettext ("zoo-services",String) |
---|
37 | |
---|
38 | #include <sys/stat.h> |
---|
39 | #include <sys/types.h> |
---|
40 | #ifndef WIN32 |
---|
41 | #include <sys/ipc.h> |
---|
42 | #include <sys/shm.h> |
---|
43 | #else |
---|
44 | #include <direct.h> |
---|
45 | #endif |
---|
46 | #include <stdio.h> |
---|
47 | #include <time.h> |
---|
48 | #include <ctype.h> |
---|
49 | #ifdef WIN32 |
---|
50 | #ifndef USE_RUBY |
---|
51 | #include <unistd.h> |
---|
52 | #endif |
---|
53 | #endif |
---|
54 | #ifndef WIN32 |
---|
55 | #include <xlocale.h> |
---|
56 | #endif |
---|
57 | #include "service.h" |
---|
58 | #include <openssl/sha.h> |
---|
59 | #include <openssl/md5.h> |
---|
60 | #include <openssl/hmac.h> |
---|
61 | #include <openssl/evp.h> |
---|
62 | #include <openssl/bio.h> |
---|
63 | #include <openssl/buffer.h> |
---|
64 | |
---|
65 | #include "ulinet.h" |
---|
66 | |
---|
67 | extern int getServiceFromFile(const char*,service**); |
---|
68 | extern int conf_read(const char*,maps*); |
---|
69 | |
---|
70 | #ifdef USE_JS |
---|
71 | #ifdef WIN32 |
---|
72 | #define XP_WIN 1 |
---|
73 | #else |
---|
74 | #define XP_UNIX 0 |
---|
75 | #endif |
---|
76 | #include "service_internal_js.h" |
---|
77 | #endif |
---|
78 | |
---|
79 | |
---|
80 | #ifdef __cplusplus |
---|
81 | extern "C" { |
---|
82 | #endif |
---|
83 | #include <libxml/parser.h> |
---|
84 | #include <libxml/xpath.h> |
---|
85 | |
---|
86 | static char* SERVICE_URL; |
---|
87 | static xmlNsPtr usedNs[10]; |
---|
88 | static char* nsName[10]; |
---|
89 | static int nbNs=0; |
---|
90 | |
---|
91 | void printHeaders(maps*); |
---|
92 | void unhandleStatus(maps*); |
---|
93 | void updateStatus(maps*); |
---|
94 | char* getStatus(int); |
---|
95 | |
---|
96 | #ifdef USE_JS |
---|
97 | char* JSValToChar(JSContext*,jsval*); |
---|
98 | JSBool JSUpdateStatus(JSContext*,uintN,jsval *); |
---|
99 | #endif |
---|
100 | |
---|
101 | void URLDecode(char *); |
---|
102 | char *url_encode(char *); |
---|
103 | char *url_decode(char *); |
---|
104 | char* getEncoding(maps*); |
---|
105 | |
---|
106 | int zooXmlSearchForNs(const char*); |
---|
107 | int zooXmlAddNs(xmlNodePtr,const char*,const char*); |
---|
108 | void zooXmlCleanupNs(); |
---|
109 | |
---|
110 | void printExceptionReportResponse(maps*,map*); |
---|
111 | xmlNodePtr createExceptionReportNode(maps*,map*,int); |
---|
112 | void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*); |
---|
113 | xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,const char*,maps*); |
---|
114 | void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*); |
---|
115 | xmlNodePtr printDescribeProcessHeader(xmlDocPtr,const char*,maps*); |
---|
116 | void printDescribeProcessForProcess(maps*,xmlNodePtr,service*,int); |
---|
117 | void printFullDescription(elements*,const char*,xmlNsPtr,xmlNodePtr); |
---|
118 | void printDocument(maps*,xmlDocPtr,int); |
---|
119 | void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*); |
---|
120 | void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
121 | map* parseBoundingBox(const char*); |
---|
122 | void printBoundingBox(xmlNsPtr,xmlNodePtr,map*); |
---|
123 | void printBoundingBoxDocument(maps*,maps*,FILE*); |
---|
124 | void printOutputDefinitions1(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
125 | |
---|
126 | void outputResponse(service*,maps*,maps*,map*,int,maps*,int); |
---|
127 | |
---|
128 | char *base64(const char*,int); |
---|
129 | char *base64d(const char*,int,int*); |
---|
130 | void ensureDecodedBase64(maps**); |
---|
131 | |
---|
132 | char* addDefaultValues(maps**,elements*,maps*,int); |
---|
133 | |
---|
134 | int errorException(maps *m, const char *message, const char *errorcode); |
---|
135 | |
---|
136 | int checkForSoapEnvelope(xmlDocPtr); |
---|
137 | |
---|
138 | void addToCache(maps*,char*,char*,char*,int); |
---|
139 | char* isInCache(maps*,char*); |
---|
140 | int loadRemoteFile(maps*,map*,HINTERNET,char*); |
---|
141 | |
---|
142 | #ifdef __cplusplus |
---|
143 | } |
---|
144 | #endif |
---|
145 | |
---|
146 | #endif |
---|