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

Last change on this file since 579 was 579, checked in by djay, 6 years ago

Add initial doxygen comments in some C files, for future documentation generation.

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 6.2 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  char* JSValToChar(JSContext*,jsval*);
171  JSBool JSUpdateStatus(JSContext*,uintN,jsval *);
172#endif
173 
174  void readGeneratedFile(maps*,map*,char*);
175
176  void URLDecode(char *);
177  char *url_encode(char *);
178  char *url_decode(char *);
179  char* getEncoding(maps*);
180
181  int zooXmlSearchForNs(const char*);
182  int zooXmlAddNs(xmlNodePtr,const char*,const char*);
183  void zooXmlCleanupNs();
184
185  int zooXmlAddDoc(xmlNodePtr,const char*,const char*);
186  void zooXmlCleanupDocs();
187 
188  void printExceptionReportResponse(maps*,map*);
189  xmlNodePtr createExceptionReportNode(maps*,map*,int);
190  void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*);
191  xmlNodePtr printWPSHeader(xmlDocPtr,maps*,const char*,const char*);
192  xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,maps*);
193  void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*);
194  void printDescribeProcessForProcess(maps*,xmlNodePtr,service*);
195  void printFullDescription(int,elements*,const char*,xmlNsPtr,xmlNodePtr);
196  void printDocument(maps*,xmlDocPtr,int);
197  void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*);
198  void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*);
199  map* parseBoundingBox(const char*);
200  void printBoundingBox(xmlNsPtr,xmlNodePtr,map*);
201  void printBoundingBoxDocument(maps*,maps*,FILE*);
202  void printOutputDefinitions(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*);
203
204  void outputResponse(service*,maps*,maps*,map*,int,maps*,int);
205
206  char *base64(const char*,int);
207  char *base64d(const char*,int,int*);
208  void ensureDecodedBase64(maps**);
209  void checkValidValue(map*,map**,const char*,const char**,int);
210  char* addDefaultValues(maps**,elements*,maps*,int,map**);
211
212  int errorException(maps *, const char *, const char *, const char*);
213
214  xmlNodePtr soapEnvelope(maps*,xmlNodePtr);
215  int checkForSoapEnvelope(xmlDocPtr);
216
217  void addToCache(maps*,char*,char*,char*,int);
218  char* isInCache(maps*,char*);
219  int runHttpRequests(maps**,maps**,HINTERNET*);
220  int loadRemoteFile(maps**,map**,HINTERNET*,char*);
221
222  char *readVSIFile(maps*,const char*);
223  void parseIdentifier(maps*,char*,char*,char*);
224  int updateStatus( maps*,const int,const char*);
225  char* getInputValue( maps*,const char*,size_t*);
226  int  setOutputValue( maps*, const char*, char*, size_t);
227 
228  char* getLastErrorMessage();
229#ifdef __cplusplus
230}
231#endif
232
233#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