[579] | 1 | /* |
---|
[1] | 2 | * Author : Gérald FENOY |
---|
| 3 | * |
---|
[917] | 4 | * Copyright (c) 2009-2019 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_H |
---|
| 26 | #define ZOO_SERVICE_H 1 |
---|
| 27 | |
---|
| 28 | #pragma once |
---|
| 29 | |
---|
[216] | 30 | #ifdef WIN32 |
---|
[680] | 31 | #define ZOO_DLL_EXPORT __declspec( dllexport ) |
---|
| 32 | #else |
---|
| 33 | #define ZOO_DLL_EXPORT |
---|
| 34 | #endif |
---|
| 35 | |
---|
[917] | 36 | // knut: add bool if necessary |
---|
| 37 | #ifndef __cplusplus |
---|
| 38 | #ifndef WIN32 |
---|
| 39 | #include <stdbool.h> |
---|
| 40 | #else |
---|
| 41 | typedef int bool; |
---|
| 42 | #define false 0 |
---|
| 43 | #define true 1 |
---|
[843] | 44 | #endif |
---|
[847] | 45 | #endif |
---|
[889] | 46 | #ifndef __bool_true_false_are_defined |
---|
[917] | 47 | #define __bool_true_false_are_defined 1 |
---|
[889] | 48 | #endif |
---|
| 49 | |
---|
[843] | 50 | #ifdef WIN32 |
---|
[917] | 51 | #define strtok_r strtok_s |
---|
[375] | 52 | #define strncasecmp _strnicmp |
---|
| 53 | #define strcasecmp _stricmp |
---|
[757] | 54 | #if defined(_MSC_VER) && _MSC_VER < 1900 |
---|
| 55 | #define snprintf _snprintf |
---|
[453] | 56 | #endif |
---|
| 57 | #define zStrdup _strdup |
---|
| 58 | #define zMkdir _mkdir |
---|
[917] | 59 | #define zGetpid _getpid |
---|
[453] | 60 | #define zOpen _open |
---|
[917] | 61 | #define zClose _close |
---|
| 62 | #define zUnlink _unlink |
---|
| 63 | #define zDup _dup |
---|
| 64 | #define zDup2 _dup2 |
---|
[453] | 65 | #define zWrite _write |
---|
[507] | 66 | #define zSleep Sleep |
---|
[514] | 67 | #include <sys/timeb.h> |
---|
| 68 | struct ztimeval { |
---|
| 69 | long tv_sec; /* seconds */ |
---|
| 70 | long tv_usec; /* and microseconds */ |
---|
| 71 | }; |
---|
[554] | 72 | static int zGettimeofday(struct ztimeval* tp, void* tzp) |
---|
[514] | 73 | { |
---|
[554] | 74 | if (tp == 0) { |
---|
| 75 | return -1; |
---|
| 76 | } |
---|
| 77 | |
---|
[917] | 78 | struct _timeb theTime; |
---|
[514] | 79 | _ftime(&theTime); |
---|
| 80 | tp->tv_sec = theTime.time; |
---|
| 81 | tp->tv_usec = theTime.millitm * 1000; |
---|
[554] | 82 | |
---|
| 83 | return 0; // The gettimeofday() function shall return 0 on success |
---|
[514] | 84 | } |
---|
[712] | 85 | |
---|
[917] | 86 | #define zStatStruct struct _stati64 |
---|
| 87 | #define zStat _stati64 |
---|
| 88 | |
---|
[379] | 89 | #else |
---|
[579] | 90 | /** |
---|
| 91 | * The crossplatform strdup alias |
---|
| 92 | */ |
---|
[453] | 93 | #define zStrdup strdup |
---|
[579] | 94 | /** |
---|
| 95 | * The crossplatform mkdir alias |
---|
| 96 | */ |
---|
[453] | 97 | #define zMkdir mkdir |
---|
[579] | 98 | /** |
---|
| 99 | * The crossplatform open alias |
---|
| 100 | */ |
---|
[454] | 101 | #define zOpen open |
---|
[579] | 102 | /** |
---|
[917] | 103 | * The crossplatform close alias |
---|
| 104 | */ |
---|
| 105 | #define zClose close |
---|
| 106 | /** |
---|
| 107 | * The crossplatform unlink alias |
---|
| 108 | */ |
---|
| 109 | #define zUnlink unlink |
---|
| 110 | /** |
---|
| 111 | * The crossplatform dup alias |
---|
| 112 | */ |
---|
| 113 | #define zDup dup |
---|
| 114 | /** |
---|
| 115 | * The crossplatform dup2 alias |
---|
| 116 | */ |
---|
| 117 | #define zDup2 dup2 |
---|
| 118 | /** |
---|
[579] | 119 | * The crossplatform write alias |
---|
| 120 | */ |
---|
[454] | 121 | #define zWrite write |
---|
[917] | 122 | #include "unistd.h" |
---|
[579] | 123 | /** |
---|
| 124 | * The crossplatform sleep alias |
---|
| 125 | */ |
---|
[917] | 126 | static int zSleep(const long millisecond){ |
---|
| 127 | return usleep(millisecond*1000); |
---|
| 128 | } |
---|
[579] | 129 | /** |
---|
| 130 | * The crossplatform gettimeofday alias |
---|
| 131 | */ |
---|
[514] | 132 | #define zGettimeofday gettimeofday |
---|
[579] | 133 | /** |
---|
| 134 | * The crossplatform timeval alias |
---|
| 135 | */ |
---|
[514] | 136 | #define ztimeval timeval |
---|
[917] | 137 | /** |
---|
| 138 | * The crossplatform getpid alias |
---|
| 139 | */ |
---|
| 140 | #define zGetpid getpid |
---|
| 141 | |
---|
| 142 | #define zStatStruct struct stat64 |
---|
| 143 | #define zStat stat64 |
---|
| 144 | |
---|
[216] | 145 | #endif |
---|
| 146 | |
---|
[1] | 147 | #ifdef __cplusplus |
---|
| 148 | extern "C" { |
---|
| 149 | #endif |
---|
| 150 | |
---|
[444] | 151 | #ifdef WIN32 |
---|
| 152 | #ifdef USE_MS |
---|
| 153 | #include <mapserver.h> |
---|
| 154 | #endif |
---|
| 155 | #endif |
---|
[1] | 156 | #include <stdlib.h> |
---|
| 157 | #include <ctype.h> |
---|
[712] | 158 | |
---|
[1] | 159 | #include <stdio.h> |
---|
[712] | 160 | |
---|
[1] | 161 | #include <string.h> |
---|
[364] | 162 | #ifndef WIN32 |
---|
[618] | 163 | #include <ctype.h> |
---|
[917] | 164 | #include <stdbool.h> |
---|
[490] | 165 | #endif |
---|
[9] | 166 | |
---|
[579] | 167 | /** |
---|
| 168 | * The global accepted status for a service |
---|
| 169 | */ |
---|
[1] | 170 | #define SERVICE_ACCEPTED 0 |
---|
[579] | 171 | /** |
---|
| 172 | * The global started status for a service |
---|
| 173 | */ |
---|
[1] | 174 | #define SERVICE_STARTED 1 |
---|
[579] | 175 | /** |
---|
| 176 | * The global paused status for a service |
---|
| 177 | */ |
---|
[1] | 178 | #define SERVICE_PAUSED 2 |
---|
[579] | 179 | /** |
---|
| 180 | * The global succeeded status for a service |
---|
| 181 | */ |
---|
[1] | 182 | #define SERVICE_SUCCEEDED 3 |
---|
[579] | 183 | /** |
---|
| 184 | * The global failed status for a service |
---|
| 185 | */ |
---|
[1] | 186 | #define SERVICE_FAILED 4 |
---|
[962] | 187 | /** |
---|
| 188 | * The global dismissed status for a service |
---|
| 189 | */ |
---|
| 190 | #define SERVICE_DISMISSED 5 |
---|
[9] | 191 | |
---|
[579] | 192 | /** |
---|
| 193 | * The memory size to create an elements |
---|
| 194 | */ |
---|
[917] | 195 | #define ELEMENTS_SIZE (sizeof(char*)+(((2*sizeof(char*))+sizeof(maps*))*3)+sizeof(char*)+((sizeof(map*) + sizeof(iotype*))*2)+(2*sizeof(elements*))) |
---|
[579] | 196 | /** |
---|
| 197 | * The memory size to create a map |
---|
| 198 | */ |
---|
[788] | 199 | //#define MAP_SIZE (2*sizeof(char*))+sizeof(NULL) // knut: size of NULL pointer may be different from regular pointer (platform dependent) |
---|
| 200 | #define MAP_SIZE (2*sizeof(char*))+sizeof(map*) |
---|
[579] | 201 | /** |
---|
| 202 | * The memory size to create an iotype |
---|
| 203 | */ |
---|
[788] | 204 | //#define IOTYPE_SIZE MAP_SIZE+sizeof(NULL) |
---|
| 205 | #define IOTYPE_SIZE sizeof(map*) + sizeof(iotype*) |
---|
[579] | 206 | /** |
---|
| 207 | * The memory size to create a maps |
---|
| 208 | */ |
---|
[788] | 209 | //#define MAPS_SIZE (2*sizeof(char*))+sizeof(map*)+MAP_SIZE |
---|
[790] | 210 | #define MAPS_SIZE sizeof(char*)+sizeof(map*)+(2*sizeof(maps*)) |
---|
[579] | 211 | /** |
---|
| 212 | * The memory size to create a service |
---|
| 213 | */ |
---|
[788] | 214 | //#define SERVICE_SIZE (ELEMENTS_SIZE*2)+(MAP_SIZE*2)+sizeof(char*) |
---|
[917] | 215 | #define SERVICE_SIZE sizeof(char*) + 3*sizeof(map*) + 2*sizeof(elements*) |
---|
[607] | 216 | /** |
---|
| 217 | * The memory size to create a services |
---|
| 218 | */ |
---|
[788] | 219 | //#define SERVICES_SIZE SERVICE_SIZE+sizeof(services*) |
---|
| 220 | #define SERVICES_SIZE sizeof(service*)+sizeof(services*) |
---|
[607] | 221 | /** |
---|
| 222 | * The memory size to create a registry |
---|
| 223 | */ |
---|
[788] | 224 | //#define REGISTRY_SIZE SERVICES_SIZE+sizeof(char*) |
---|
| 225 | #define REGISTRY_SIZE sizeof(char*)+sizeof(services*)+sizeof(registry*) |
---|
[1] | 226 | |
---|
[26] | 227 | #define SHMSZ 27 |
---|
[1] | 228 | |
---|
[465] | 229 | #include "version.h" |
---|
[1] | 230 | |
---|
[375] | 231 | #ifdef DEBUG_STACK |
---|
| 232 | void debugStack(const char* file,const int line){ |
---|
| 233 | int stack; |
---|
| 234 | fprintf(stderr,"stack %p (%s: %d) \n",&stack,file,line); |
---|
| 235 | } |
---|
| 236 | #endif |
---|
| 237 | |
---|
[9] | 238 | /** |
---|
[579] | 239 | * KVP linked list |
---|
[9] | 240 | */ |
---|
[1] | 241 | typedef struct map{ |
---|
[607] | 242 | char* name; //!< the key |
---|
| 243 | char* value; //!< the value |
---|
| 244 | struct map* next; //!< the pointer to the next map if any or NULL |
---|
[1] | 245 | } map; |
---|
| 246 | |
---|
| 247 | #ifdef WIN32 |
---|
| 248 | #define NULLMAP ((map*) 0) |
---|
[917] | 249 | // knut: see new definition above |
---|
| 250 | //#define bool int |
---|
| 251 | //#define true 1 |
---|
| 252 | //#define false 0 |
---|
[1] | 253 | #else |
---|
| 254 | #define NULLMAP NULL |
---|
| 255 | #endif |
---|
| 256 | |
---|
[114] | 257 | /** |
---|
[579] | 258 | * linked list of map pointer |
---|
[114] | 259 | * |
---|
| 260 | * Small object to store WPS KVP set. |
---|
| 261 | */ |
---|
| 262 | typedef struct maps{ |
---|
[607] | 263 | char* name; //!< the maps name |
---|
| 264 | struct map* content; //!< the content map |
---|
[790] | 265 | struct maps* child; //!< the child maps |
---|
[607] | 266 | struct maps* next; //!< the pointer to the next maps if any or NULL |
---|
[114] | 267 | } maps; |
---|
[601] | 268 | |
---|
[579] | 269 | /** |
---|
| 270 | * Not named linked list |
---|
[114] | 271 | * |
---|
[781] | 272 | * Used to store information about formats, such as mimeType, encoding ... |
---|
[114] | 273 | */ |
---|
[1] | 274 | typedef struct iotype{ |
---|
[607] | 275 | struct map* content; //!< the content map |
---|
| 276 | struct iotype* next; //!< the pointer to the next iotype if any or NULL |
---|
[1] | 277 | } iotype; |
---|
| 278 | |
---|
[114] | 279 | /** |
---|
[579] | 280 | * Metadata information about input or output. |
---|
[114] | 281 | * |
---|
[781] | 282 | * The elements are used to store metadata information defined in the ZCFG. |
---|
[114] | 283 | */ |
---|
[1] | 284 | typedef struct elements{ |
---|
[607] | 285 | char* name; //!< the name |
---|
| 286 | struct map* content; //!< the content map |
---|
| 287 | struct map* metadata; //!< the metadata map |
---|
[917] | 288 | struct map* additional_parameters; //!< the additional parameters map |
---|
[607] | 289 | char* format; //!< the format: LiteralData or ComplexData or BoundingBoxData |
---|
| 290 | struct iotype* defaults; //!< the default iotype |
---|
| 291 | struct iotype* supported; //!< the supported iotype |
---|
[640] | 292 | struct elements* child; //!< the pointer to the children element if any (or NULL) |
---|
[607] | 293 | struct elements* next; //!< the pointer to the next element if any (or NULL) |
---|
[1] | 294 | } elements; |
---|
| 295 | |
---|
[579] | 296 | /** |
---|
[781] | 297 | * Metadata information about a full Service. |
---|
[579] | 298 | */ |
---|
[1] | 299 | typedef struct service{ |
---|
[607] | 300 | char* name; //!< the name |
---|
| 301 | struct map* content; //!< the content map |
---|
| 302 | struct map* metadata; //!< the metadata map |
---|
[917] | 303 | struct map* additional_parameters; //!< the additional parameters map |
---|
[607] | 304 | struct elements* inputs; //!< the inputs elements |
---|
| 305 | struct elements* outputs; //!< the outputs elements |
---|
[1] | 306 | } service; |
---|
| 307 | |
---|
[579] | 308 | /** |
---|
[607] | 309 | * Services chained list. |
---|
[579] | 310 | */ |
---|
[1] | 311 | typedef struct services{ |
---|
[607] | 312 | struct service* content; //!< the content service pointer |
---|
| 313 | struct services* next; //!< the pointer to the next services* |
---|
[1] | 314 | } services; |
---|
| 315 | |
---|
[579] | 316 | /** |
---|
[607] | 317 | * Profile registry. |
---|
| 318 | */ |
---|
| 319 | typedef struct registry{ |
---|
| 320 | char *name; //!< the name |
---|
| 321 | struct services* content; //!< the content services pointer |
---|
| 322 | struct registry* next; //!< the next registry pointer |
---|
| 323 | } registry; |
---|
[917] | 324 | |
---|
[889] | 325 | // knut |
---|
| 326 | enum WPSException { |
---|
[917] | 327 | /* |
---|
| 328 | * StatusOK is not a WPS exception, it is added |
---|
| 329 | * here for convenience. |
---|
| 330 | */ |
---|
| 331 | StatusOK, |
---|
| 332 | /* |
---|
| 333 | * See WPS 1.0 specification, Table 38 and Table 62. |
---|
| 334 | */ |
---|
| 335 | MissingParameterValue, |
---|
| 336 | InvalidParameterValue, |
---|
| 337 | NoApplicableCode, |
---|
| 338 | NotEnoughStorage, |
---|
| 339 | ServerBusy, |
---|
| 340 | FileSizeExceeded, |
---|
| 341 | StorageNotSupported, |
---|
| 342 | VersionNegotiationFailed, |
---|
| 343 | /* |
---|
| 344 | * See WPS 2.0 specification, Tables 41, 46, 48, and 50. |
---|
| 345 | */ |
---|
| 346 | NoSuchProcess, |
---|
| 347 | NoSuchMode, |
---|
| 348 | NoSuchInput, |
---|
| 349 | NoSuchOutput, |
---|
| 350 | DataNotAccessible, |
---|
| 351 | SizeExceeded, |
---|
| 352 | TooManyInputs, |
---|
| 353 | TooManyOutputs, |
---|
| 354 | NoSuchFormat, |
---|
| 355 | WrongInputData, |
---|
| 356 | InternalServerError, |
---|
| 357 | NoSuchJob, |
---|
| 358 | ResultNotReady |
---|
| 359 | }; |
---|
| 360 | |
---|
[889] | 361 | static const char* const WPSExceptionCode[] = { |
---|
[917] | 362 | "StatusOK", |
---|
| 363 | "MissingParameterValue", |
---|
| 364 | "InvalidParameterValue", |
---|
| 365 | "NoApplicableCode", |
---|
| 366 | "NotEnoughStorage", |
---|
| 367 | "ServerBusy", |
---|
| 368 | "FileSizeExceeded", |
---|
| 369 | "StorageNotSupported", |
---|
| 370 | "VersionNegotiationFailed", |
---|
| 371 | "NoSuchProcess", |
---|
| 372 | "NoSuchMode", |
---|
| 373 | "NoSuchInput", |
---|
| 374 | "NoSuchOutput", |
---|
| 375 | "DataNotAccessible", |
---|
| 376 | "SizeExceeded", |
---|
| 377 | "TooManyInputs", |
---|
| 378 | "TooManyOutputs", |
---|
| 379 | "NoSuchFormat", |
---|
| 380 | "WrongInputData", |
---|
| 381 | "InternalServerError", |
---|
| 382 | "NoSuchJob", |
---|
| 383 | "ResultNotReady" |
---|
| 384 | }; |
---|
[607] | 385 | |
---|
[889] | 386 | static const char* const WPSExceptionText[] = { |
---|
[917] | 387 | "No problem detected", |
---|
| 388 | "Operation request does not include a parameter value, and this server did not declare a default value for that parameter.", |
---|
| 389 | "Operation request contains an invalid parameter value.", |
---|
| 390 | "No other exceptionCode specified by this service and server applies to this exception.", |
---|
| 391 | "The server does not have enough space available to store the inputs and outputs associated with the request.", |
---|
| 392 | "The server is too busy to accept and queue the request at this time.", |
---|
| 393 | "The file size of one of the input parameters was too large for this process to handle.", |
---|
| 394 | "Execute operation request included transmission=”reference” for one of the outputs, but storage is not offered by this server.", |
---|
| 395 | "Service version for a ComplexData xlink:href input was not supported by the referenced server, and version negotiation failed.", |
---|
| 396 | "One of the identifiers passed does not match with any of the processes offered by this server.", |
---|
| 397 | "The process does not permit the desired execution mode.", |
---|
| 398 | "One or more of the input identifiers passed does not match with any of the input identifiers of this process.", |
---|
| 399 | "One or more of the output identifiers passed does not match with any of the input identifiers of this process.", |
---|
| 400 | "One of the referenced input data sets was inaccessible.", |
---|
| 401 | "The size of one of the input parameters was too large for this process to handle.", |
---|
| 402 | "Too many input items have been specified.", |
---|
| 403 | "Too many output items have been specified.", |
---|
| 404 | "One or more of the input or output formats specified in the request did not match with any of the formats defined for that particular input or output.", |
---|
| 405 | "One or more of inputs for which the service was able to retrieve the data but could not read it.", |
---|
| 406 | "", |
---|
| 407 | "The JobID from the request does not match any of the Jobs running on this server.", |
---|
| 408 | "The result for the requested JobID has not yet been generated." |
---|
[889] | 409 | }; |
---|
| 410 | |
---|
[680] | 411 | ZOO_DLL_EXPORT void _dumpMap(map*); |
---|
| 412 | ZOO_DLL_EXPORT void dumpMap(map*); |
---|
| 413 | ZOO_DLL_EXPORT void dumpMaps(maps* m); |
---|
[682] | 414 | ZOO_DLL_EXPORT void dumpMapToFile(map*,FILE*); // (used only internally) |
---|
| 415 | ZOO_DLL_EXPORT void dumpMapsToFile(maps*,char*,int); |
---|
[680] | 416 | ZOO_DLL_EXPORT map* createMap(const char*,const char*); |
---|
[790] | 417 | ZOO_DLL_EXPORT maps* createMaps(const char*); |
---|
[680] | 418 | ZOO_DLL_EXPORT int count(map*); |
---|
| 419 | ZOO_DLL_EXPORT bool hasKey(map*,const char*); |
---|
| 420 | ZOO_DLL_EXPORT maps* getMaps(maps*,const char*); |
---|
| 421 | ZOO_DLL_EXPORT map* getMap(map*,const char*); |
---|
| 422 | ZOO_DLL_EXPORT map* getLastMap(map*); |
---|
| 423 | ZOO_DLL_EXPORT map* getMapFromMaps(maps*,const char*,const char*); |
---|
| 424 | ZOO_DLL_EXPORT void freeMap(map**); |
---|
| 425 | ZOO_DLL_EXPORT void freeMaps(maps** mo); |
---|
[917] | 426 | ZOO_DLL_EXPORT iotype* createIoType(); |
---|
[790] | 427 | ZOO_DLL_EXPORT elements* createEmptyElements(); |
---|
[917] | 428 | ZOO_DLL_EXPORT elements* createElements(const char*); |
---|
[790] | 429 | ZOO_DLL_EXPORT void setElementsName(elements**,char*); |
---|
[680] | 430 | ZOO_DLL_EXPORT bool hasElement(elements*,const char*); |
---|
[949] | 431 | ZOO_DLL_EXPORT elements* getElements(elements*,const char*); |
---|
[680] | 432 | ZOO_DLL_EXPORT void freeIOType(iotype**); |
---|
| 433 | ZOO_DLL_EXPORT void freeElements(elements**); |
---|
[790] | 434 | ZOO_DLL_EXPORT void setServiceName(service**,char*); |
---|
[917] | 435 | ZOO_DLL_EXPORT service* createService(); |
---|
[680] | 436 | ZOO_DLL_EXPORT void freeService(service**); |
---|
| 437 | ZOO_DLL_EXPORT void addToMap(map*,const char*,const char*); |
---|
| 438 | ZOO_DLL_EXPORT void addIntToMap(map*,const char*,const int); |
---|
[917] | 439 | ZOO_DLL_EXPORT void addIntToMapArray(map*,const char*,int,const int); |
---|
[738] | 440 | ZOO_DLL_EXPORT map* addToMapWithSize(map*,const char*,const char*,int); |
---|
[680] | 441 | ZOO_DLL_EXPORT void addMapToMap(map**,map*); |
---|
| 442 | ZOO_DLL_EXPORT void addMapToIoType(iotype**,map*); |
---|
| 443 | ZOO_DLL_EXPORT map* getMapOrFill(map**,const char*,const char*); |
---|
| 444 | ZOO_DLL_EXPORT bool contains(map*,map*); |
---|
| 445 | ZOO_DLL_EXPORT iotype* getIoTypeFromElement(elements*,char*, map*); |
---|
| 446 | ZOO_DLL_EXPORT void loadMapBinary(map**,map*,int); |
---|
| 447 | ZOO_DLL_EXPORT void loadMapBinaries(map**,map*); |
---|
| 448 | ZOO_DLL_EXPORT maps* dupMaps(maps**); |
---|
| 449 | ZOO_DLL_EXPORT void addMapsToMaps(maps**,maps*); |
---|
| 450 | ZOO_DLL_EXPORT map* getMapArray(map*,const char*,int); |
---|
| 451 | ZOO_DLL_EXPORT void setMapArray(map*,const char*,int,const char*); |
---|
| 452 | ZOO_DLL_EXPORT map* getMapType(map*); |
---|
| 453 | ZOO_DLL_EXPORT int addMapsArrayToMaps(maps**,maps*,char*); |
---|
| 454 | ZOO_DLL_EXPORT void setMapInMaps(maps*,const char*,const char*,const char*); |
---|
| 455 | ZOO_DLL_EXPORT void dumpElements(elements*); |
---|
[790] | 456 | ZOO_DLL_EXPORT void dumpElementsAsYAML(elements*,int); |
---|
[680] | 457 | ZOO_DLL_EXPORT elements* dupElements(elements*); |
---|
| 458 | ZOO_DLL_EXPORT void addToElements(elements**,elements*); |
---|
| 459 | ZOO_DLL_EXPORT void dumpService(service*); |
---|
| 460 | ZOO_DLL_EXPORT void dumpServiceAsYAML(service*); |
---|
| 461 | ZOO_DLL_EXPORT service* dupService(service*); |
---|
| 462 | ZOO_DLL_EXPORT void dumpRegistry(registry*); |
---|
| 463 | ZOO_DLL_EXPORT bool addServiceToRegistry(registry**,char*,service*); |
---|
| 464 | ZOO_DLL_EXPORT void freeRegistry(registry**); |
---|
| 465 | ZOO_DLL_EXPORT service* getServiceFromRegistry(registry*,char*,char*); |
---|
| 466 | ZOO_DLL_EXPORT void inheritMap(map**,map*); |
---|
| 467 | ZOO_DLL_EXPORT void inheritIOType(iotype**,iotype*); |
---|
| 468 | ZOO_DLL_EXPORT void inheritElements(elements**,elements*); |
---|
| 469 | ZOO_DLL_EXPORT void inheritance(registry*,service**); |
---|
| 470 | ZOO_DLL_EXPORT void mapsToCharXXX(maps*,char***); |
---|
| 471 | ZOO_DLL_EXPORT void charxxxToMaps(char***,maps**); |
---|
[757] | 472 | #if defined(_MSC_VER) && _MSC_VER < 1800 |
---|
[712] | 473 | // snprintf for Visual Studio compiler; |
---|
| 474 | // it is also used by services (e.g., GetStatus), therefore exported to shared library |
---|
| 475 | ZOO_DLL_EXPORT int snprintf(char *buffer, size_t n, const char *format, ...); |
---|
[757] | 476 | #endif |
---|
[889] | 477 | |
---|
| 478 | // knut: some new utility functions; logMessage is primarily intended for debugging |
---|
| 479 | ZOO_DLL_EXPORT bool nonempty(map* map); |
---|
| 480 | ZOO_DLL_EXPORT bool hasvalue(maps* source, const char* node, const char* key, map** kvp); |
---|
[917] | 481 | #ifdef __cplusplus |
---|
[889] | 482 | ZOO_DLL_EXPORT void setErrorMessage(maps*& conf, const char* service, WPSException exc, const char* message = NULL); |
---|
[917] | 483 | ZOO_DLL_EXPORT void logMessage(const char* source, const char* function, int line, const char* file = NULL, const char* message = NULL); |
---|
| 484 | #endif |
---|
[889] | 485 | #define zooLogMsg(file,message) logMessage(__FILE__, __func__, __LINE__, (file), (message)) |
---|
| 486 | #define zooLog logMessage(__FILE__, __func__, __LINE__) |
---|
[957] | 487 | |
---|
| 488 | // knut : function for pre-allocated memory for a map value; |
---|
| 489 | // processing algorithms may be able to write directly to this space, thereby avoiding unneccesary copying of data |
---|
| 490 | ZOO_DLL_EXPORT char* allocateMapValue(map* node, size_t num_bytes); |
---|
| 491 | |
---|
[1] | 492 | #ifdef __cplusplus |
---|
| 493 | } |
---|
| 494 | #endif |
---|
| 495 | |
---|
| 496 | #endif |
---|