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

Last change on this file since 508 was 507, checked in by djay, 10 years ago

Add concurrency gesture for background services. Fix tickets #102 and #103.

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 5.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#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#define ZOO_LOCK_CREATE_FAILED -4
39#define ZOO_LOCK_ACQUIRE_FAILED -5
40#define ZOO_LOCK_RELEASE_FAILED -6
41
42#include <sys/stat.h>
43#include <sys/types.h>
44#include "cgic.h"
45#ifndef WIN32
46#include <sys/ipc.h>
47#include <sys/shm.h>
48#include <sys/sem.h>
49#else
50#include <direct.h>
51#endif
52#include <stdio.h>
53#include <time.h>
54#include <ctype.h>
55#ifdef WIN32
56#ifndef USE_RUBY
57#include <unistd.h>
58#endif
59#endif
60#ifndef WIN32
61#include <xlocale.h>
62#endif
63#include <dirent.h>
64#include "ulinet.h"
65
66#include "service.h"
67#include <openssl/sha.h>
68#include <openssl/md5.h>
69#include <openssl/hmac.h>
70#include <openssl/evp.h>
71#include <openssl/bio.h>
72#include <openssl/buffer.h>
73
74extern   int conf_read(const char*,maps*);
75
76#ifdef USE_JS
77#ifdef WIN32
78#define XP_WIN 1
79#else
80#define XP_UNIX 0
81#endif
82#include "service_internal_js.h"
83#endif
84
85
86#ifdef __cplusplus
87extern "C" {
88#endif
89#include <libxml/parser.h>
90#include <libxml/xpath.h>
91
92  static char* SERVICE_URL;
93  static xmlNsPtr usedNs[10];
94  static char* nsName[10];
95  static xmlDocPtr iDocs[10];
96  static int nbNs=0;
97  static int nbDocs=0;
98
99  int getServiceFromYAML(maps*,char*,service**,char *name);
100  int readServiceFile(maps*, char*,service**,char *);
101  int isValidLang(maps*,const char*);
102
103  void printHeaders(maps*);
104  void unhandleStatus(maps*);
105  int _updateStatus(maps*);
106  char* _getStatus(maps*,int);
107  char* getStatus(int);
108  int removeShmLock(maps*, int);
109#ifndef WIN32
110#define semid int
111#else
112#define semid HANDLE
113#endif
114  semid getShmLockId(maps*,int);
115  int lockShm(semid);
116  int unlockShm(semid);
117
118#ifdef USE_JS
119  char* JSValToChar(JSContext*,jsval*);
120  JSBool JSUpdateStatus(JSContext*,uintN,jsval *);
121#endif
122 
123  void URLDecode(char *);
124  char *url_encode(char *);
125  char *url_decode(char *);
126  char* getEncoding(maps*);
127
128  int zooXmlSearchForNs(const char*);
129  int zooXmlAddNs(xmlNodePtr,const char*,const char*);
130  void zooXmlCleanupNs();
131
132  int zooXmlAddDoc(xmlNodePtr,const char*,const char*);
133  void zooXmlCleanupDocs();
134 
135  void printExceptionReportResponse(maps*,map*);
136  xmlNodePtr createExceptionReportNode(maps*,map*,int);
137  void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*);
138  xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,const char*,maps*);
139  void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*);
140  xmlNodePtr printDescribeProcessHeader(xmlDocPtr,const char*,maps*);
141  void printDescribeProcessForProcess(maps*,xmlNodePtr,service*);
142  void printFullDescription(int,elements*,const char*,xmlNsPtr,xmlNodePtr);
143  void printDocument(maps*,xmlDocPtr,int);
144  void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*);
145  void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*);
146  map* parseBoundingBox(const char*);
147  void printBoundingBox(xmlNsPtr,xmlNodePtr,map*);
148  void printBoundingBoxDocument(maps*,maps*,FILE*);
149  void printOutputDefinitions1(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*);
150 
151  void outputResponse(service*,maps*,maps*,map*,int,maps*,int);
152
153  char *base64(const char*,int);
154  char *base64d(const char*,int,int*);
155  void ensureDecodedBase64(maps**);
156
157  char* addDefaultValues(maps**,elements*,maps*,int);
158
159  int errorException(maps *, const char *, const char *, const char*);
160
161  int checkForSoapEnvelope(xmlDocPtr);
162
163  void addToCache(maps*,char*,char*,char*,int);
164  char* isInCache(maps*,char*);
165  int runHttpRequests(maps**,maps**,HINTERNET*);
166  int loadRemoteFile(maps**,map**,HINTERNET*,char*);
167
168  char *readVSIFile(maps*,const char*);
169  void parseIdentifier(maps*,char*,char*,char*);
170  int updateStatus( maps*,const int,const char*);
171  char* getInputValue( maps*,const char*,size_t*);
172  int  setOutputValue( maps*, const char*, char*, size_t);
173
174#ifdef __cplusplus
175}
176#endif
177
178#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