1 | /** |
---|
2 | * Author : Gérald FENOY |
---|
3 | * |
---|
4 | * Copyright (c) 2009-2011 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 <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> |
---|
55 | #include <openssl/hmac.h> |
---|
56 | #include <openssl/evp.h> |
---|
57 | #include <openssl/bio.h> |
---|
58 | #include <openssl/buffer.h> |
---|
59 | |
---|
60 | #include "cgic.h" |
---|
61 | |
---|
62 | extern int getServiceFromFile(const char*,service**); |
---|
63 | extern int conf_read(const char*,maps*); |
---|
64 | |
---|
65 | #ifdef USE_JS |
---|
66 | #define XP_UNIX 0 |
---|
67 | #include "service_internal_js.h" |
---|
68 | #endif |
---|
69 | |
---|
70 | #ifdef __cplusplus |
---|
71 | extern "C" { |
---|
72 | #endif |
---|
73 | #include <libxml/parser.h> |
---|
74 | static char* SERVICE_URL; |
---|
75 | static xmlNsPtr usedNs[5]; |
---|
76 | static char* nsName[5]; |
---|
77 | static int nbNs=0; |
---|
78 | |
---|
79 | void unhandleStatus(maps*); |
---|
80 | void updateStatus(maps*); |
---|
81 | char* getStatus(int); |
---|
82 | |
---|
83 | #ifdef USE_JS |
---|
84 | char* JSValToChar(JSContext*,jsval*); |
---|
85 | JSBool JSUpdateStatus(JSContext*,uintN,jsval *); |
---|
86 | #endif |
---|
87 | |
---|
88 | void URLDecode(char *); |
---|
89 | char *url_encode(char *); |
---|
90 | char* getEncoding(maps*); |
---|
91 | |
---|
92 | int zooXmlSearchForNs(const char*); |
---|
93 | int zooXmlAddNs(xmlNodePtr,const char*,const char*); |
---|
94 | void zooXmlCleanupNs(); |
---|
95 | |
---|
96 | void printExceptionReportResponse(maps*,map*); |
---|
97 | xmlNodePtr createExceptionReportNode(maps*,map*,int); |
---|
98 | void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*); |
---|
99 | xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,const char*,maps*); |
---|
100 | void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*); |
---|
101 | xmlNodePtr printDescribeProcessHeader(xmlDocPtr,const char*,maps*); |
---|
102 | void printDescribeProcessForProcess(maps*,xmlNodePtr,service*,int); |
---|
103 | void printFullDescription(elements*,const char*,xmlNsPtr,xmlNodePtr); |
---|
104 | void printDocument(maps*,xmlDocPtr,int); |
---|
105 | void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*); |
---|
106 | void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
107 | map* parseBoundingBox(const char*); |
---|
108 | void printBoundingBox(xmlNsPtr,xmlNodePtr,map*); |
---|
109 | void printBoundingBoxDocument(maps*,maps*,FILE*); |
---|
110 | void printOutputDefinitions1(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); |
---|
111 | |
---|
112 | void outputResponse(service*,maps*,maps*,map*,int,maps*,int); |
---|
113 | |
---|
114 | char *base64(const char*,int); |
---|
115 | char *base64d(const char*,int,int*); |
---|
116 | void ensureDecodedBase64(maps**); |
---|
117 | |
---|
118 | char* addDefaultValues(maps**,elements*,maps*,int); |
---|
119 | |
---|
120 | /*defined in zoo_loader.c*/ |
---|
121 | int errorException(maps *m, const char *message, const char *errorcode); |
---|
122 | |
---|
123 | #ifdef __cplusplus |
---|
124 | } |
---|
125 | #endif |
---|
126 | |
---|
127 | #endif |
---|