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

Last change on this file since 579 was 579, checked in by djay, 9 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
RevLine 
[579]1/*
[1]2 * Author : Gérald FENOY
3 *
[392]4 * Copyright (c) 2009-2013 GeoLabs SARL
[1]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
[579]30/**
31 * The default service url (overriden by serverAddress)
32 */
[34]33#define DEFAULT_SERVICE_URL "http://www.zoo-project.org/"
[579]34/**
35 * The time size
36 */
[1]37#define TIME_SIZE 40
38
[34]39#include <libintl.h>
40#include <locale.h>
[579]41/**
42 * ZOO-Kernel internal messages translation function
43 */
[34]44#define _(String) dgettext ("zoo-kernel",String)
[579]45/**
46 * ZOO-Services messages translation function
47 */
[34]48#define _ss(String) dgettext ("zoo-services",String)
49
[579]50/**
51 * ZOO-Kernel was unable to create a lock
52 */
[507]53#define ZOO_LOCK_CREATE_FAILED -4
[579]54/**
55 * ZOO-Kernel was unable to acquire a lock
56 */
[507]57#define ZOO_LOCK_ACQUIRE_FAILED -5
[579]58/**
59 * ZOO-Kernel was unable to release a lock
60 */
[507]61#define ZOO_LOCK_RELEASE_FAILED -6
62
[26]63#include <sys/stat.h>
[1]64#include <sys/types.h>
[478]65#include "cgic.h"
[216]66#ifndef WIN32
[26]67#include <sys/ipc.h>
68#include <sys/shm.h>
[507]69#include <sys/sem.h>
[216]70#else
71#include <direct.h>
72#endif
[26]73#include <stdio.h>
[1]74#include <time.h>
75#include <ctype.h>
[453]76#ifdef WIN32
77#ifndef USE_RUBY
78#include <unistd.h>
79#endif
80#endif
[1]81#ifndef WIN32
82#include <xlocale.h>
83#endif
[490]84#include "ulinet.h"
85
[1]86#include "service.h"
87#include <openssl/sha.h>
[291]88#include <openssl/md5.h>
[1]89#include <openssl/hmac.h>
90#include <openssl/evp.h>
91#include <openssl/bio.h>
92#include <openssl/buffer.h>
93
[114]94extern   int conf_read(const char*,maps*);
[1]95
[26]96#ifdef USE_JS
[364]97#ifdef WIN32
98#define XP_WIN 1
99#else
[26]100#define XP_UNIX 0
[364]101#endif
[26]102#include "service_internal_js.h"
103#endif
104
[453]105
[1]106#ifdef __cplusplus
107extern "C" {
108#endif
109#include <libxml/parser.h>
[280]110#include <libxml/xpath.h>
111
[579]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   */
[1]124  static char* SERVICE_URL;
[579]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   */
[9]136  static int nbNs=0;
[579]137  /**
138   * Array of xmlDocPtr storing XML docs
139   */
140  static xmlDocPtr iDocs[ZOO_DOC_MAX];
141  /**
142   * Number of XML docs
143   */
[490]144  static int nbDocs=0;
[1]145
[465]146  int getServiceFromYAML(maps*,char*,service**,char *name);
147  int readServiceFile(maps*, char*,service**,char *);
[501]148  int isValidLang(maps*,const char*);
[576]149  void addLangAttr(xmlNodePtr,maps*);
[465]150
[375]151  void printHeaders(maps*);
[216]152  void unhandleStatus(maps*);
[471]153  int _updateStatus(maps*);
[507]154  char* _getStatus(maps*,int);
[26]155  char* getStatus(int);
[507]156  int removeShmLock(maps*, int);
[579]157  /**
158   * Cross platform type used for Lock identifier
159   */
[507]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);
[9]168
[26]169#ifdef USE_JS
170  char* JSValToChar(JSContext*,jsval*);
[274]171  JSBool JSUpdateStatus(JSContext*,uintN,jsval *);
[26]172#endif
173 
[550]174  void readGeneratedFile(maps*,map*,char*);
175
[1]176  void URLDecode(char *);
177  char *url_encode(char *);
[328]178  char *url_decode(char *);
[9]179  char* getEncoding(maps*);
180
[114]181  int zooXmlSearchForNs(const char*);
182  int zooXmlAddNs(xmlNodePtr,const char*,const char*);
[9]183  void zooXmlCleanupNs();
[490]184
185  int zooXmlAddDoc(xmlNodePtr,const char*,const char*);
186  void zooXmlCleanupDocs();
[1]187 
188  void printExceptionReportResponse(maps*,map*);
[26]189  xmlNodePtr createExceptionReportNode(maps*,map*,int);
[114]190  void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*);
[576]191  xmlNodePtr printWPSHeader(xmlDocPtr,maps*,const char*,const char*);
192  xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,maps*);
[1]193  void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*);
[469]194  void printDescribeProcessForProcess(maps*,xmlNodePtr,service*);
[490]195  void printFullDescription(int,elements*,const char*,xmlNsPtr,xmlNodePtr);
[9]196  void printDocument(maps*,xmlDocPtr,int);
[114]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*);
[76]200  void printBoundingBox(xmlNsPtr,xmlNodePtr,map*);
201  void printBoundingBoxDocument(maps*,maps*,FILE*);
[576]202  void printOutputDefinitions(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*);
203
[1]204  void outputResponse(service*,maps*,maps*,map*,int,maps*,int);
205
[216]206  char *base64(const char*,int);
207  char *base64d(const char*,int,int*);
[88]208  void ensureDecodedBase64(maps**);
[576]209  void checkValidValue(map*,map**,const char*,const char**,int);
210  char* addDefaultValues(maps**,elements*,maps*,int,map**);
[1]211
[459]212  int errorException(maps *, const char *, const char *, const char*);
[9]213
[576]214  xmlNodePtr soapEnvelope(maps*,xmlNodePtr);
[280]215  int checkForSoapEnvelope(xmlDocPtr);
216
[446]217  void addToCache(maps*,char*,char*,char*,int);
[280]218  char* isInCache(maps*,char*);
[492]219  int runHttpRequests(maps**,maps**,HINTERNET*);
220  int loadRemoteFile(maps**,map**,HINTERNET*,char*);
[392]221
[469]222  char *readVSIFile(maps*,const char*);
223  void parseIdentifier(maps*,char*,char*,char*);
[471]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);
[578]227 
228  char* getLastErrorMessage();
[1]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