source: trunk/zoo-project/zoo-kernel/service_internal.h @ 610

Last change on this file since 610 was 587, checked in by knut, 10 years ago

Implemented asynchronous HTTP POST Execute requests on Windows platform (via caching). Fixed bug that caused only the last output variable in a HTTP POST Execute request to be returned. Modified the addToCache function so that the path of the cached file can be retrieved. Changed the parsing of KVPs in zoo_loader.c so that keys with missing values (e.g. "metapath=") are assigned the empty string instead of NULL (avoids segmentation fault in some situations). Added conditional definition of ZEND_DEBUG in service_internal_php.c. Deallocation of memory in function createProcess. In zoo_loader.c, applied url_decode to CGI form string (WIN32 only, but should check if this should apply to other platforms as well).

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 6.1 KB
Line 
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/**
31 * The default service url (overriden by serverAddress)
32 */
33#define DEFAULT_SERVICE_URL "http://www.zoo-project.org/"
34/**
35 * The time size
36 */
37#define TIME_SIZE 40
38
39#include <libintl.h>
40#include <locale.h>
41/**
42 * ZOO-Kernel internal messages translation function
43 */
44#define _(String) dgettext ("zoo-kernel",String)
45/**
46 * ZOO-Services messages translation function
47 */
48#define _ss(String) dgettext ("zoo-services",String)
49
50/**
51 * ZOO-Kernel was unable to create a lock
52 */
53#define ZOO_LOCK_CREATE_FAILED -4
54/**
55 * ZOO-Kernel was unable to acquire a lock
56 */
57#define ZOO_LOCK_ACQUIRE_FAILED -5
58/**
59 * ZOO-Kernel was unable to release a lock
60 */
61#define ZOO_LOCK_RELEASE_FAILED -6
62
63#include <sys/stat.h>
64#include <sys/types.h>
65#include "cgic.h"
66#ifndef WIN32
67#include <sys/ipc.h>
68#include <sys/shm.h>
69#include <sys/sem.h>
70#else
71#include <direct.h>
72#endif
73#include <stdio.h>
74#include <time.h>
75#include <ctype.h>
76#ifdef WIN32
77#ifndef USE_RUBY
78#include <unistd.h>
79#endif
80#endif
81#ifndef WIN32
82#include <xlocale.h>
83#endif
84#include "ulinet.h"
85
86#include "service.h"
87#include <openssl/sha.h>
88#include <openssl/md5.h>
89#include <openssl/hmac.h>
90#include <openssl/evp.h>
91#include <openssl/bio.h>
92#include <openssl/buffer.h>
93
94extern   int conf_read(const char*,maps*);
95
96#ifdef USE_JS
97#ifdef WIN32
98#define XP_WIN 1
99#else
100#define XP_UNIX 0
101#endif
102#include "service_internal_js.h"
103#endif
104
105
106#ifdef __cplusplus
107extern "C" {
108#endif
109#include <libxml/parser.h>
110#include <libxml/xpath.h>
111
112  /**
113   * Maximum number of XML namespaces
114   */
115#define ZOO_NS_MAX 10
116  /**
117   * Maximum number of XML docs
118   */
119#define ZOO_DOC_MAX 20
120
121  /**
122   * Global char* to store the serverAddress value of the mmmmmain section
123   */
124  static char* SERVICE_URL;
125  /**
126   * Array of xmlNsPtr storing all used XML namespace
127   */
128  static xmlNsPtr usedNs[ZOO_NS_MAX];
129  /**
130   * Array storing names of the used XML namespace
131   */
132  static char* nsName[ZOO_NS_MAX];
133  /**
134   * Number of XML namespaces
135   */
136  static int nbNs=0;
137  /**
138   * Array of xmlDocPtr storing XML docs
139   */
140  static xmlDocPtr iDocs[ZOO_DOC_MAX];
141  /**
142   * Number of XML docs
143   */
144  static int nbDocs=0;
145
146  int getServiceFromYAML(maps*,char*,service**,char *name);
147  int readServiceFile(maps*, char*,service**,char *);
148  int isValidLang(maps*,const char*);
149  void addLangAttr(xmlNodePtr,maps*);
150
151  void printHeaders(maps*);
152  void unhandleStatus(maps*);
153  int _updateStatus(maps*);
154  char* _getStatus(maps*,int);
155  char* getStatus(int);
156  int removeShmLock(maps*, int);
157  /**
158   * Cross platform type used for Lock identifier
159   */
160#ifndef WIN32
161#define semid int
162#else
163#define semid HANDLE
164#endif
165  semid getShmLockId(maps*,int);
166  int lockShm(semid);
167  int unlockShm(semid);
168
169#ifdef USE_JS
170#endif
171 
172  void readGeneratedFile(maps*,map*,char*);
173
174  void URLDecode(char *);
175  char *url_encode(char *);
176  char *url_decode(char *);
177  char* getEncoding(maps*);
178
179  int zooXmlSearchForNs(const char*);
180  int zooXmlAddNs(xmlNodePtr,const char*,const char*);
181  void zooXmlCleanupNs();
182
183  int zooXmlAddDoc(xmlNodePtr,const char*,const char*);
184  void zooXmlCleanupDocs();
185 
186  void printExceptionReportResponse(maps*,map*);
187  xmlNodePtr createExceptionReportNode(maps*,map*,int);
188  void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*);
189  xmlNodePtr printWPSHeader(xmlDocPtr,maps*,const char*,const char*);
190  xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,maps*);
191  void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*);
192  void printDescribeProcessForProcess(maps*,xmlNodePtr,service*);
193  void printFullDescription(int,elements*,const char*,xmlNsPtr,xmlNodePtr);
194  void printDocument(maps*,xmlDocPtr,int);
195  void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*);
196  void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*);
197  map* parseBoundingBox(const char*);
198  void printBoundingBox(xmlNsPtr,xmlNodePtr,map*);
199  void printBoundingBoxDocument(maps*,maps*,FILE*);
200  void printOutputDefinitions(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*);
201
202  void outputResponse(service*,maps*,maps*,map*,int,maps*,int);
203
204  char *base64(const char*,int);
205  char *base64d(const char*,int,int*);
206  void ensureDecodedBase64(maps**);
207  void checkValidValue(map*,map**,const char*,const char**,int);
208  char* addDefaultValues(maps**,elements*,maps*,int,map**);
209
210  int errorException(maps *, const char *, const char *, const char*);
211
212  xmlNodePtr soapEnvelope(maps*,xmlNodePtr);
213  int checkForSoapEnvelope(xmlDocPtr);
214 
215  void addToCache(maps*,char*,char*,char*,int,char*,size_t);
216  char* isInCache(maps*,char*);
217  int runHttpRequests(maps**,maps**,HINTERNET*);
218  int loadRemoteFile(maps**,map**,HINTERNET*,char*);
219
220  char *readVSIFile(maps*,const char*);
221  void parseIdentifier(maps*,char*,char*,char*);
222  int updateStatus( maps*,const int,const char*);
223  char* getInputValue( maps*,const char*,size_t*);
224  int  setOutputValue( maps*, const char*, char*, size_t);
225 
226  char* getLastErrorMessage();
227#ifdef __cplusplus
228}
229#endif
230
231#endif
Note: See TracBrowser for help on using the repository browser.

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png