[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 |
---|
[9] | 187 | |
---|
[579] | 188 | /** |
---|
| 189 | * The memory size to create an elements |
---|
| 190 | */ |
---|
[917] | 191 | #define ELEMENTS_SIZE (sizeof(char*)+(((2*sizeof(char*))+sizeof(maps*))*3)+sizeof(char*)+((sizeof(map*) + sizeof(iotype*))*2)+(2*sizeof(elements*))) |
---|
[579] | 192 | /** |
---|
| 193 | * The memory size to create a map |
---|
| 194 | */ |
---|
[788] | 195 | //#define MAP_SIZE (2*sizeof(char*))+sizeof(NULL) // knut: size of NULL pointer may be different from regular pointer (platform dependent) |
---|
| 196 | #define MAP_SIZE (2*sizeof(char*))+sizeof(map*) |
---|
[579] | 197 | /** |
---|
| 198 | * The memory size to create an iotype |
---|
| 199 | */ |
---|
[788] | 200 | //#define IOTYPE_SIZE MAP_SIZE+sizeof(NULL) |
---|
| 201 | #define IOTYPE_SIZE sizeof(map*) + sizeof(iotype*) |
---|
[579] | 202 | /** |
---|
| 203 | * The memory size to create a maps |
---|
| 204 | */ |
---|
[788] | 205 | //#define MAPS_SIZE (2*sizeof(char*))+sizeof(map*)+MAP_SIZE |
---|
[790] | 206 | #define MAPS_SIZE sizeof(char*)+sizeof(map*)+(2*sizeof(maps*)) |
---|
[579] | 207 | /** |
---|
| 208 | * The memory size to create a service |
---|
| 209 | */ |
---|
[788] | 210 | //#define SERVICE_SIZE (ELEMENTS_SIZE*2)+(MAP_SIZE*2)+sizeof(char*) |
---|
[917] | 211 | #define SERVICE_SIZE sizeof(char*) + 3*sizeof(map*) + 2*sizeof(elements*) |
---|
[607] | 212 | /** |
---|
| 213 | * The memory size to create a services |
---|
| 214 | */ |
---|
[788] | 215 | //#define SERVICES_SIZE SERVICE_SIZE+sizeof(services*) |
---|
| 216 | #define SERVICES_SIZE sizeof(service*)+sizeof(services*) |
---|
[607] | 217 | /** |
---|
| 218 | * The memory size to create a registry |
---|
| 219 | */ |
---|
[788] | 220 | //#define REGISTRY_SIZE SERVICES_SIZE+sizeof(char*) |
---|
| 221 | #define REGISTRY_SIZE sizeof(char*)+sizeof(services*)+sizeof(registry*) |
---|
[1] | 222 | |
---|
[26] | 223 | #define SHMSZ 27 |
---|
[1] | 224 | |
---|
[465] | 225 | #include "version.h" |
---|
[1] | 226 | |
---|
[375] | 227 | #ifdef DEBUG_STACK |
---|
| 228 | void debugStack(const char* file,const int line){ |
---|
| 229 | int stack; |
---|
| 230 | fprintf(stderr,"stack %p (%s: %d) \n",&stack,file,line); |
---|
| 231 | } |
---|
| 232 | #endif |
---|
| 233 | |
---|
[9] | 234 | /** |
---|
[579] | 235 | * KVP linked list |
---|
[9] | 236 | */ |
---|
[1] | 237 | typedef struct map{ |
---|
[607] | 238 | char* name; //!< the key |
---|
| 239 | char* value; //!< the value |
---|
| 240 | struct map* next; //!< the pointer to the next map if any or NULL |
---|
[1] | 241 | } map; |
---|
| 242 | |
---|
| 243 | #ifdef WIN32 |
---|
| 244 | #define NULLMAP ((map*) 0) |
---|
[917] | 245 | // knut: see new definition above |
---|
| 246 | //#define bool int |
---|
| 247 | //#define true 1 |
---|
| 248 | //#define false 0 |
---|
[1] | 249 | #else |
---|
| 250 | #define NULLMAP NULL |
---|
| 251 | #endif |
---|
| 252 | |
---|
[114] | 253 | /** |
---|
[579] | 254 | * linked list of map pointer |
---|
[114] | 255 | * |
---|
| 256 | * Small object to store WPS KVP set. |
---|
| 257 | */ |
---|
| 258 | typedef struct maps{ |
---|
[607] | 259 | char* name; //!< the maps name |
---|
| 260 | struct map* content; //!< the content map |
---|
[790] | 261 | struct maps* child; //!< the child maps |
---|
[607] | 262 | struct maps* next; //!< the pointer to the next maps if any or NULL |
---|
[114] | 263 | } maps; |
---|
[601] | 264 | |
---|
[579] | 265 | /** |
---|
| 266 | * Not named linked list |
---|
[114] | 267 | * |
---|
[781] | 268 | * Used to store information about formats, such as mimeType, encoding ... |
---|
[114] | 269 | */ |
---|
[1] | 270 | typedef struct iotype{ |
---|
[607] | 271 | struct map* content; //!< the content map |
---|
| 272 | struct iotype* next; //!< the pointer to the next iotype if any or NULL |
---|
[1] | 273 | } iotype; |
---|
| 274 | |
---|
[114] | 275 | /** |
---|
[579] | 276 | * Metadata information about input or output. |
---|
[114] | 277 | * |
---|
[781] | 278 | * The elements are used to store metadata information defined in the ZCFG. |
---|
[114] | 279 | */ |
---|
[1] | 280 | typedef struct elements{ |
---|
[607] | 281 | char* name; //!< the name |
---|
| 282 | struct map* content; //!< the content map |
---|
| 283 | struct map* metadata; //!< the metadata map |
---|
[917] | 284 | struct map* additional_parameters; //!< the additional parameters map |
---|
[607] | 285 | char* format; //!< the format: LiteralData or ComplexData or BoundingBoxData |
---|
| 286 | struct iotype* defaults; //!< the default iotype |
---|
| 287 | struct iotype* supported; //!< the supported iotype |
---|
[640] | 288 | struct elements* child; //!< the pointer to the children element if any (or NULL) |
---|
[607] | 289 | struct elements* next; //!< the pointer to the next element if any (or NULL) |
---|
[1] | 290 | } elements; |
---|
| 291 | |
---|
[579] | 292 | /** |
---|
[781] | 293 | * Metadata information about a full Service. |
---|
[579] | 294 | */ |
---|
[1] | 295 | typedef struct service{ |
---|
[607] | 296 | char* name; //!< the name |
---|
| 297 | struct map* content; //!< the content map |
---|
| 298 | struct map* metadata; //!< the metadata map |
---|
[917] | 299 | struct map* additional_parameters; //!< the additional parameters map |
---|
[607] | 300 | struct elements* inputs; //!< the inputs elements |
---|
| 301 | struct elements* outputs; //!< the outputs elements |
---|
[1] | 302 | } service; |
---|
| 303 | |
---|
[579] | 304 | /** |
---|
[607] | 305 | * Services chained list. |
---|
[579] | 306 | */ |
---|
[1] | 307 | typedef struct services{ |
---|
[607] | 308 | struct service* content; //!< the content service pointer |
---|
| 309 | struct services* next; //!< the pointer to the next services* |
---|
[1] | 310 | } services; |
---|
| 311 | |
---|
[579] | 312 | /** |
---|
[607] | 313 | * Profile registry. |
---|
| 314 | */ |
---|
| 315 | typedef struct registry{ |
---|
| 316 | char *name; //!< the name |
---|
| 317 | struct services* content; //!< the content services pointer |
---|
| 318 | struct registry* next; //!< the next registry pointer |
---|
| 319 | } registry; |
---|
[917] | 320 | |
---|
[889] | 321 | // knut |
---|
| 322 | enum WPSException { |
---|
[917] | 323 | /* |
---|
| 324 | * StatusOK is not a WPS exception, it is added |
---|
| 325 | * here for convenience. |
---|
| 326 | */ |
---|
| 327 | StatusOK, |
---|
| 328 | /* |
---|
| 329 | * See WPS 1.0 specification, Table 38 and Table 62. |
---|
| 330 | */ |
---|
| 331 | MissingParameterValue, |
---|
| 332 | InvalidParameterValue, |
---|
| 333 | NoApplicableCode, |
---|
| 334 | NotEnoughStorage, |
---|
| 335 | ServerBusy, |
---|
| 336 | FileSizeExceeded, |
---|
| 337 | StorageNotSupported, |
---|
| 338 | VersionNegotiationFailed, |
---|
| 339 | /* |
---|
| 340 | * See WPS 2.0 specification, Tables 41, 46, 48, and 50. |
---|
| 341 | */ |
---|
| 342 | NoSuchProcess, |
---|
| 343 | NoSuchMode, |
---|
| 344 | NoSuchInput, |
---|
| 345 | NoSuchOutput, |
---|
| 346 | DataNotAccessible, |
---|
| 347 | SizeExceeded, |
---|
| 348 | TooManyInputs, |
---|
| 349 | TooManyOutputs, |
---|
| 350 | NoSuchFormat, |
---|
| 351 | WrongInputData, |
---|
| 352 | InternalServerError, |
---|
| 353 | NoSuchJob, |
---|
| 354 | ResultNotReady |
---|
| 355 | }; |
---|
| 356 | |
---|
[889] | 357 | static const char* const WPSExceptionCode[] = { |
---|
[917] | 358 | "StatusOK", |
---|
| 359 | "MissingParameterValue", |
---|
| 360 | "InvalidParameterValue", |
---|
| 361 | "NoApplicableCode", |
---|
| 362 | "NotEnoughStorage", |
---|
| 363 | "ServerBusy", |
---|
| 364 | "FileSizeExceeded", |
---|
| 365 | "StorageNotSupported", |
---|
| 366 | "VersionNegotiationFailed", |
---|
| 367 | "NoSuchProcess", |
---|
| 368 | "NoSuchMode", |
---|
| 369 | "NoSuchInput", |
---|
| 370 | "NoSuchOutput", |
---|
| 371 | "DataNotAccessible", |
---|
| 372 | "SizeExceeded", |
---|
| 373 | "TooManyInputs", |
---|
| 374 | "TooManyOutputs", |
---|
| 375 | "NoSuchFormat", |
---|
| 376 | "WrongInputData", |
---|
| 377 | "InternalServerError", |
---|
| 378 | "NoSuchJob", |
---|
| 379 | "ResultNotReady" |
---|
| 380 | }; |
---|
[607] | 381 | |
---|
[889] | 382 | static const char* const WPSExceptionText[] = { |
---|
[917] | 383 | "No problem detected", |
---|
| 384 | "Operation request does not include a parameter value, and this server did not declare a default value for that parameter.", |
---|
| 385 | "Operation request contains an invalid parameter value.", |
---|
| 386 | "No other exceptionCode specified by this service and server applies to this exception.", |
---|
| 387 | "The server does not have enough space available to store the inputs and outputs associated with the request.", |
---|
| 388 | "The server is too busy to accept and queue the request at this time.", |
---|
| 389 | "The file size of one of the input parameters was too large for this process to handle.", |
---|
| 390 | "Execute operation request included transmission=”reference” for one of the outputs, but storage is not offered by this server.", |
---|
| 391 | "Service version for a ComplexData xlink:href input was not supported by the referenced server, and version negotiation failed.", |
---|
| 392 | "One of the identifiers passed does not match with any of the processes offered by this server.", |
---|
| 393 | "The process does not permit the desired execution mode.", |
---|
| 394 | "One or more of the input identifiers passed does not match with any of the input identifiers of this process.", |
---|
| 395 | "One or more of the output identifiers passed does not match with any of the input identifiers of this process.", |
---|
| 396 | "One of the referenced input data sets was inaccessible.", |
---|
| 397 | "The size of one of the input parameters was too large for this process to handle.", |
---|
| 398 | "Too many input items have been specified.", |
---|
| 399 | "Too many output items have been specified.", |
---|
| 400 | "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.", |
---|
| 401 | "One or more of inputs for which the service was able to retrieve the data but could not read it.", |
---|
| 402 | "", |
---|
| 403 | "The JobID from the request does not match any of the Jobs running on this server.", |
---|
| 404 | "The result for the requested JobID has not yet been generated." |
---|
[889] | 405 | }; |
---|
| 406 | |
---|
[680] | 407 | ZOO_DLL_EXPORT void _dumpMap(map*); |
---|
| 408 | ZOO_DLL_EXPORT void dumpMap(map*); |
---|
| 409 | ZOO_DLL_EXPORT void dumpMaps(maps* m); |
---|
[682] | 410 | ZOO_DLL_EXPORT void dumpMapToFile(map*,FILE*); // (used only internally) |
---|
| 411 | ZOO_DLL_EXPORT void dumpMapsToFile(maps*,char*,int); |
---|
[680] | 412 | ZOO_DLL_EXPORT map* createMap(const char*,const char*); |
---|
[790] | 413 | ZOO_DLL_EXPORT maps* createMaps(const char*); |
---|
[680] | 414 | ZOO_DLL_EXPORT int count(map*); |
---|
| 415 | ZOO_DLL_EXPORT bool hasKey(map*,const char*); |
---|
| 416 | ZOO_DLL_EXPORT maps* getMaps(maps*,const char*); |
---|
| 417 | ZOO_DLL_EXPORT map* getMap(map*,const char*); |
---|
| 418 | ZOO_DLL_EXPORT map* getLastMap(map*); |
---|
| 419 | ZOO_DLL_EXPORT map* getMapFromMaps(maps*,const char*,const char*); |
---|
| 420 | ZOO_DLL_EXPORT void freeMap(map**); |
---|
| 421 | ZOO_DLL_EXPORT void freeMaps(maps** mo); |
---|
[917] | 422 | ZOO_DLL_EXPORT iotype* createIoType(); |
---|
[790] | 423 | ZOO_DLL_EXPORT elements* createEmptyElements(); |
---|
[917] | 424 | ZOO_DLL_EXPORT elements* createElements(const char*); |
---|
[790] | 425 | ZOO_DLL_EXPORT void setElementsName(elements**,char*); |
---|
[680] | 426 | ZOO_DLL_EXPORT bool hasElement(elements*,const char*); |
---|
[949] | 427 | ZOO_DLL_EXPORT elements* getElements(elements*,const char*); |
---|
[680] | 428 | ZOO_DLL_EXPORT void freeIOType(iotype**); |
---|
| 429 | ZOO_DLL_EXPORT void freeElements(elements**); |
---|
[790] | 430 | ZOO_DLL_EXPORT void setServiceName(service**,char*); |
---|
[917] | 431 | ZOO_DLL_EXPORT service* createService(); |
---|
[680] | 432 | ZOO_DLL_EXPORT void freeService(service**); |
---|
| 433 | ZOO_DLL_EXPORT void addToMap(map*,const char*,const char*); |
---|
| 434 | ZOO_DLL_EXPORT void addIntToMap(map*,const char*,const int); |
---|
[917] | 435 | ZOO_DLL_EXPORT void addIntToMapArray(map*,const char*,int,const int); |
---|
[738] | 436 | ZOO_DLL_EXPORT map* addToMapWithSize(map*,const char*,const char*,int); |
---|
[680] | 437 | ZOO_DLL_EXPORT void addMapToMap(map**,map*); |
---|
| 438 | ZOO_DLL_EXPORT void addMapToIoType(iotype**,map*); |
---|
| 439 | ZOO_DLL_EXPORT map* getMapOrFill(map**,const char*,const char*); |
---|
| 440 | ZOO_DLL_EXPORT bool contains(map*,map*); |
---|
| 441 | ZOO_DLL_EXPORT iotype* getIoTypeFromElement(elements*,char*, map*); |
---|
| 442 | ZOO_DLL_EXPORT void loadMapBinary(map**,map*,int); |
---|
| 443 | ZOO_DLL_EXPORT void loadMapBinaries(map**,map*); |
---|
| 444 | ZOO_DLL_EXPORT maps* dupMaps(maps**); |
---|
| 445 | ZOO_DLL_EXPORT void addMapsToMaps(maps**,maps*); |
---|
| 446 | ZOO_DLL_EXPORT map* getMapArray(map*,const char*,int); |
---|
| 447 | ZOO_DLL_EXPORT void setMapArray(map*,const char*,int,const char*); |
---|
| 448 | ZOO_DLL_EXPORT map* getMapType(map*); |
---|
| 449 | ZOO_DLL_EXPORT int addMapsArrayToMaps(maps**,maps*,char*); |
---|
| 450 | ZOO_DLL_EXPORT void setMapInMaps(maps*,const char*,const char*,const char*); |
---|
| 451 | ZOO_DLL_EXPORT void dumpElements(elements*); |
---|
[790] | 452 | ZOO_DLL_EXPORT void dumpElementsAsYAML(elements*,int); |
---|
[680] | 453 | ZOO_DLL_EXPORT elements* dupElements(elements*); |
---|
| 454 | ZOO_DLL_EXPORT void addToElements(elements**,elements*); |
---|
| 455 | ZOO_DLL_EXPORT void dumpService(service*); |
---|
| 456 | ZOO_DLL_EXPORT void dumpServiceAsYAML(service*); |
---|
| 457 | ZOO_DLL_EXPORT service* dupService(service*); |
---|
| 458 | ZOO_DLL_EXPORT void dumpRegistry(registry*); |
---|
| 459 | ZOO_DLL_EXPORT bool addServiceToRegistry(registry**,char*,service*); |
---|
| 460 | ZOO_DLL_EXPORT void freeRegistry(registry**); |
---|
| 461 | ZOO_DLL_EXPORT service* getServiceFromRegistry(registry*,char*,char*); |
---|
| 462 | ZOO_DLL_EXPORT void inheritMap(map**,map*); |
---|
| 463 | ZOO_DLL_EXPORT void inheritIOType(iotype**,iotype*); |
---|
| 464 | ZOO_DLL_EXPORT void inheritElements(elements**,elements*); |
---|
| 465 | ZOO_DLL_EXPORT void inheritance(registry*,service**); |
---|
| 466 | ZOO_DLL_EXPORT void mapsToCharXXX(maps*,char***); |
---|
| 467 | ZOO_DLL_EXPORT void charxxxToMaps(char***,maps**); |
---|
[757] | 468 | #if defined(_MSC_VER) && _MSC_VER < 1800 |
---|
[712] | 469 | // snprintf for Visual Studio compiler; |
---|
| 470 | // it is also used by services (e.g., GetStatus), therefore exported to shared library |
---|
| 471 | ZOO_DLL_EXPORT int snprintf(char *buffer, size_t n, const char *format, ...); |
---|
[757] | 472 | #endif |
---|
[889] | 473 | |
---|
| 474 | // knut: some new utility functions; logMessage is primarily intended for debugging |
---|
| 475 | ZOO_DLL_EXPORT bool nonempty(map* map); |
---|
| 476 | ZOO_DLL_EXPORT bool hasvalue(maps* source, const char* node, const char* key, map** kvp); |
---|
[917] | 477 | #ifdef __cplusplus |
---|
[889] | 478 | ZOO_DLL_EXPORT void setErrorMessage(maps*& conf, const char* service, WPSException exc, const char* message = NULL); |
---|
[917] | 479 | ZOO_DLL_EXPORT void logMessage(const char* source, const char* function, int line, const char* file = NULL, const char* message = NULL); |
---|
| 480 | #endif |
---|
[889] | 481 | #define zooLogMsg(file,message) logMessage(__FILE__, __func__, __LINE__, (file), (message)) |
---|
| 482 | #define zooLog logMessage(__FILE__, __func__, __LINE__) |
---|
[957] | 483 | |
---|
| 484 | // knut : function for pre-allocated memory for a map value; |
---|
| 485 | // processing algorithms may be able to write directly to this space, thereby avoiding unneccesary copying of data |
---|
| 486 | ZOO_DLL_EXPORT char* allocateMapValue(map* node, size_t num_bytes); |
---|
| 487 | |
---|
[1] | 488 | #ifdef __cplusplus |
---|
| 489 | } |
---|
| 490 | #endif |
---|
| 491 | |
---|
| 492 | #endif |
---|