ZOO-Project
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
service.h File Reference
#include <stdbool.h>
#include <sys/stat.h>
#include "unistd.h"
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include "version.h"

Go to the source code of this file.

Data Structures

struct  map
 KVP linked list. More...
 
struct  maps
 linked list of map pointer More...
 
struct  iotype
 Not named linked list. More...
 
struct  elements
 Metadata information about input or output. More...
 
struct  service
 Metadata information about a full Service. More...
 
struct  services
 Services chained list. More...
 
struct  registry
 Profile registry. More...
 

Macros

#define ZOO_SERVICE_H   1
 
#define ZOO_DLL_EXPORT
 
#define zStrdup   strdup
 
#define zOpen   open
 
#define zClose   close
 
#define zUnlink   unlink
 
#define zDup   dup
 
#define zDup2   dup2
 
#define zWrite   write
 
#define zGettimeofday   gettimeofday
 
#define ztimeval   timeval
 
#define zGetpid   getpid
 
#define zStatStruct   struct stat64
 
#define zStat   stat64
 
#define SERVICE_ACCEPTED   0
 
#define SERVICE_STARTED   1
 
#define SERVICE_PAUSED   2
 
#define SERVICE_SUCCEEDED   3
 
#define SERVICE_FAILED   4
 
#define SERVICE_DISMISSED   5
 
#define ELEMENTS_SIZE   (sizeof(char*)+(((2*sizeof(char*))+sizeof(maps*))*3)+sizeof(char*)+((sizeof(map*) + sizeof(iotype*))*2)+(2*sizeof(elements*)))
 
#define MAP_SIZE   (2*sizeof(char*))+sizeof(map*)
 
#define IOTYPE_SIZE   sizeof(map*) + sizeof(iotype*)
 
#define MAPS_SIZE   sizeof(char*)+sizeof(map*)+(2*sizeof(maps*))
 
#define SERVICE_SIZE   sizeof(char*) + 3*sizeof(map*) + 2*sizeof(elements*)
 
#define SERVICES_SIZE   sizeof(service*)+sizeof(services*)
 
#define REGISTRY_SIZE   sizeof(char*)+sizeof(services*)+sizeof(registry*)
 
#define SHMSZ   27
 
#define NULLMAP   NULL
 
#define zooLogMsg(file, message)   logMessage(__FILE__, __func__, __LINE__, (file), (message))
 
#define zooLog   logMessage(__FILE__, __func__, __LINE__)
 
#define ZOO_DLL_EXPORT
 
#define __bool_true_false_are_defined   1
 
#define zStrdup   strdup
 The crossplatform strdup alias. More...
 
#define zOpen   open
 The crossplatform open alias. More...
 
#define zClose   close
 The crossplatform close alias. More...
 
#define zUnlink   unlink
 The crossplatform unlink alias. More...
 
#define zDup   dup
 The crossplatform dup alias. More...
 
#define zDup2   dup2
 The crossplatform dup2 alias. More...
 
#define zWrite   write
 The crossplatform write alias. More...
 
#define zGettimeofday   gettimeofday
 The crossplatform gettimeofday alias. More...
 
#define ztimeval   timeval
 The crossplatform timeval alias. More...
 
#define zGetpid   getpid
 The crossplatform getpid alias. More...
 
#define zStatStruct   struct stat64
 
#define zStat   stat64
 
#define SERVICE_ACCEPTED   0
 The global accepted status for a service. More...
 
#define SERVICE_STARTED   1
 The global started status for a service. More...
 
#define SERVICE_PAUSED   2
 The global paused status for a service. More...
 
#define SERVICE_SUCCEEDED   3
 The global succeeded status for a service. More...
 
#define SERVICE_FAILED   4
 The global failed status for a service. More...
 
#define SERVICE_DISMISSED   5
 The global dismissed status for a service. More...
 
#define ELEMENTS_SIZE   (sizeof(char*)+(((2*sizeof(char*))+sizeof(maps*))*3)+sizeof(char*)+((sizeof(map*) + sizeof(iotype*))*2)+(2*sizeof(elements*)))
 The memory size to create an elements. More...
 
#define MAP_SIZE   (2*sizeof(char*))+sizeof(map*)
 The memory size to create a map. More...
 
#define IOTYPE_SIZE   sizeof(map*) + sizeof(iotype*)
 The memory size to create an iotype. More...
 
#define MAPS_SIZE   sizeof(char*)+sizeof(map*)+(2*sizeof(maps*))
 The memory size to create a maps. More...
 
#define SERVICE_SIZE   sizeof(char*) + 3*sizeof(map*) + 2*sizeof(elements*)
 The memory size to create a service. More...
 
#define SERVICES_SIZE   sizeof(service*)+sizeof(services*)
 The memory size to create a services. More...
 
#define REGISTRY_SIZE   sizeof(char*)+sizeof(services*)+sizeof(registry*)
 The memory size to create a registry. More...
 
#define SHMSZ   27
 
#define NULLMAP   NULL
 
#define zooLogMsg(file, message)   logMessage(__FILE__, __func__, __LINE__, (file), (message))
 
#define zooLog   logMessage(__FILE__, __func__, __LINE__)
 

Typedefs

typedef struct map map
 KVP linked list. More...
 
typedef struct maps maps
 linked list of map pointer More...
 
typedef struct iotype iotype
 Not named linked list. More...
 
typedef struct elements elements
 Metadata information about input or output. More...
 
typedef struct service service
 Metadata information about a full Service. More...
 
typedef struct services services
 Services chained list. More...
 
typedef struct registry registry
 Profile registry. More...
 

Enumerations

enum  WPSException {
  StatusOK, MissingParameterValue, InvalidParameterValue, NoApplicableCode,
  NotEnoughStorage, ServerBusy, FileSizeExceeded, StorageNotSupported,
  VersionNegotiationFailed, NoSuchProcess, NoSuchMode, NoSuchInput,
  NoSuchOutput, DataNotAccessible, SizeExceeded, TooManyInputs,
  TooManyOutputs, NoSuchFormat, WrongInputData, InternalServerError,
  NoSuchJob, ResultNotReady, StatusOK, MissingParameterValue,
  InvalidParameterValue, NoApplicableCode, NotEnoughStorage, ServerBusy,
  FileSizeExceeded, StorageNotSupported, VersionNegotiationFailed, NoSuchProcess,
  NoSuchMode, NoSuchInput, NoSuchOutput, DataNotAccessible,
  SizeExceeded, TooManyInputs, TooManyOutputs, NoSuchFormat,
  WrongInputData, InternalServerError, NoSuchJob, ResultNotReady
}
 

Functions

static int zMkdir (const char *pccPath)
 The crossplatform mkdir alias. More...
 
static int zSleep (const long millisecond)
 The crossplatform sleep alias. More...
 
ZOO_DLL_EXPORT void _dumpMap (map *)
 Dump a map on stderr. More...
 
ZOO_DLL_EXPORT void dumpMap (map *)
 Dump a map on stderr, see _dumpMap() More...
 
ZOO_DLL_EXPORT void dumpMaps (maps *m)
 Dump a maps on stderr, see dumpMap(). More...
 
ZOO_DLL_EXPORT void dumpMapToFile (map *, FILE *)
 Dump a map to a file. More...
 
ZOO_DLL_EXPORT void dumpMapsToFile (maps *, char *, int)
 Dump a maps to a file, see _dumpMapsToFile(). More...
 
ZOO_DLL_EXPORT mapcreateMap (const char *, const char *)
 Create a new map. More...
 
ZOO_DLL_EXPORT mapscreateMaps (const char *)
 Create a new maps with the given name. More...
 
ZOO_DLL_EXPORT int count (map *)
 Count number of map in a map. More...
 
ZOO_DLL_EXPORT bool hasKey (map *, const char *)
 Verify if a key exist in a map. More...
 
ZOO_DLL_EXPORT mapsgetMaps (maps *, const char *)
 Access a specific maps. More...
 
ZOO_DLL_EXPORT mapgetMap (map *, const char *)
 Access a specific map. More...
 
ZOO_DLL_EXPORT mapgetLastMap (map *)
 Access the last map. More...
 
ZOO_DLL_EXPORT mapgetMapFromMaps (maps *, const char *, const char *)
 Access a specific map from a maps. More...
 
ZOO_DLL_EXPORT void freeMap (map **)
 Free allocated memory of a map. More...
 
ZOO_DLL_EXPORT void freeMaps (maps **mo)
 Free allocated memory of a maps. More...
 
ZOO_DLL_EXPORT iotypecreateIoType ()
 Create a new iotype*. More...
 
ZOO_DLL_EXPORT elementscreateEmptyElements ()
 Create an empty elements. More...
 
ZOO_DLL_EXPORT elementscreateElements (const char *)
 Create a named elements. More...
 
ZOO_DLL_EXPORT void setElementsName (elements **, char *)
 Set the name of an elements. More...
 
ZOO_DLL_EXPORT bool hasElement (elements *, const char *)
 Verify if an elements contains a name equal to the given key. More...
 
ZOO_DLL_EXPORT elementsgetElements (elements *, const char *)
 Access a specific elements named key. More...
 
ZOO_DLL_EXPORT void freeIOType (iotype **)
 Free allocated memory of an iotype. More...
 
ZOO_DLL_EXPORT void freeElements (elements **)
 Free allocated memory of an elements. More...
 
ZOO_DLL_EXPORT void setServiceName (service **, char *)
 Set the name of a service. More...
 
ZOO_DLL_EXPORT servicecreateService ()
 Allocate memory for a service. More...
 
ZOO_DLL_EXPORT void freeService (service **)
 Free allocated memory of a service. More...
 
ZOO_DLL_EXPORT void addToMap (map *, const char *, const char *)
 Add key value pair to an existing map. More...
 
ZOO_DLL_EXPORT void addIntToMap (map *, const char *, const int)
 Add a key and an integer value to an existing map. More...
 
ZOO_DLL_EXPORT void addIntToMapArray (map *, const char *, int, const int)
 Add a key and an integer value to an existing map array. More...
 
ZOO_DLL_EXPORT mapaddToMapWithSize (map *, const char *, const char *, int)
 Add a key and a binary value to an existing map. More...
 
ZOO_DLL_EXPORT void addMapToMap (map **, map *)
 Add a map at the end of another map. More...
 
ZOO_DLL_EXPORT void addMapToIoType (iotype **, map *)
 Add a map to iotype. More...
 
ZOO_DLL_EXPORT mapgetMapOrFill (map **, const char *, const char *)
 Access a specific map or set its value. More...
 
ZOO_DLL_EXPORT bool contains (map *, map *)
 Verify if a map is contained in another map. More...
 
ZOO_DLL_EXPORT iotypegetIoTypeFromElement (elements *, char *, map *)
 Access a specific iotype from an elements. More...
 
ZOO_DLL_EXPORT void loadMapBinary (map **, map *, int)
 Load binary values from a map (in) and add them to another map (out) More...
 
ZOO_DLL_EXPORT void loadMapBinaries (map **, map *)
 Load binary values from a map (in) and add them to another map (out). More...
 
ZOO_DLL_EXPORT mapsdupMaps (maps **)
 Duplicate a Maps. More...
 
ZOO_DLL_EXPORT void addMapsToMaps (maps **, maps *)
 Add a maps at the end of another maps. More...
 
ZOO_DLL_EXPORT mapgetMapArray (map *, const char *, int)
 Access a specific map array element. More...
 
ZOO_DLL_EXPORT void setMapArray (map *, const char *, int, const char *)
 Add a key value in a MapArray for a specific index. More...
 
ZOO_DLL_EXPORT mapgetMapType (map *)
 Access the map "type". More...
 
ZOO_DLL_EXPORT int addMapsArrayToMaps (maps **, maps *, char *)
 Add a Maps containing a MapArray to a Maps. More...
 
ZOO_DLL_EXPORT void setMapInMaps (maps *, const char *, const char *, const char *)
 Set a key value pair to a map contained in a Maps. More...
 
ZOO_DLL_EXPORT void dumpElements (elements *)
 Dump an elements on stderr. More...
 
ZOO_DLL_EXPORT void dumpElementsAsYAML (elements *, int)
 Dump an elements on stderr using the YAML syntaxe. More...
 
ZOO_DLL_EXPORT elementsdupElements (elements *)
 Duplicate an elements. More...
 
ZOO_DLL_EXPORT void addToElements (elements **, elements *)
 Add an elements to another elements. More...
 
ZOO_DLL_EXPORT void dumpService (service *)
 Dump a service on stderr. More...
 
ZOO_DLL_EXPORT void dumpServiceAsYAML (service *)
 Dump a service on stderr using the YAML syntaxe. More...
 
ZOO_DLL_EXPORT servicedupService (service *)
 Duplicate a service. More...
 
ZOO_DLL_EXPORT void dumpRegistry (registry *)
 Print the registry on stderr. More...
 
ZOO_DLL_EXPORT bool addServiceToRegistry (registry **, char *, service *)
 Add a service to the registry. More...
 
ZOO_DLL_EXPORT void freeRegistry (registry **)
 Free memory allocated for the registry. More...
 
ZOO_DLL_EXPORT servicegetServiceFromRegistry (registry *, char *, char *)
 Access a service in the registry. More...
 
ZOO_DLL_EXPORT void inheritMap (map **, map *)
 Apply inheritance to an out map from a reference in map. More...
 
ZOO_DLL_EXPORT void inheritIOType (iotype **, iotype *)
 Apply inheritance to an out iotype from a reference in iotype. More...
 
ZOO_DLL_EXPORT void inheritElements (elements **, elements *)
 Apply inheritance to an out elements from a reference in elements. More...
 
ZOO_DLL_EXPORT void inheritance (registry *, service **)
 Apply inheritance to a service based on a registry. More...
 
ZOO_DLL_EXPORT void mapsToCharXXX (maps *, char ***)
 Convert a maps to a char*** (only used for Fortran support) More...
 
ZOO_DLL_EXPORT void charxxxToMaps (char ***, maps **)
 Convert a char*** to a maps (only used for Fortran support) More...
 
ZOO_DLL_EXPORT bool nonempty (map *map)
 Verify that a map has a value. More...
 
ZOO_DLL_EXPORT bool hasvalue (maps *source, const char *node, const char *key, map **kvp)
 Verify that a particular map value exists in a maps data structure, and obtain that value. More...
 
ZOO_DLL_EXPORT char * allocateMapValue (map *node, size_t num_bytes)
 

Variables

static const char *const WPSExceptionCode []
 
static const char *const WPSExceptionText []
 

Data Structure Documentation

struct map

KVP linked list.

Data Fields
char * name the key
struct map * next the pointer to the next map if any or NULL
char * value the value
struct maps

linked list of map pointer

Small object to store WPS KVP set.

Data Fields
struct maps * child the child maps
struct map * content the content map
char * name the maps name
struct maps * next the pointer to the next maps if any or NULL
struct iotype