ZOO-Project
|
#include "cgic.h"
#include <libxml/tree.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include "ulinet.h"
#include <libintl.h>
#include <locale.h>
#include <string.h>
#include "service_internal.h"
#include "server_internal.h"
#include "response_print.h"
#include "request_parser.h"
#include "service.h"
#include "sqlapi.h"
#include <dirent.h>
#include <signal.h>
#include <execinfo.h>
#include <unistd.h>
#include <dlfcn.h>
#include <libgen.h>
#include <fcntl.h>
#include <time.h>
#include <stdarg.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
Macros | |
#define | _(String) dgettext ("zoo-kernel",String) |
Translation function for zoo-kernel. More... | |
#define | __(String) dgettext ("zoo-service",String) |
Translation function for zoo-service. More... | |
Functions | |
int | yylex () |
int | crlex () |
void | translateChar (char *str, char toReplace, char toReplaceBy) |
Replace a char by another one in a string. More... | |
int | dumpBackFinalFile (maps *m, char *fbkp, char *fbkp1) |
Dump back the final file fbkp1 to fbkp. More... | |
int | recursReaddirF (maps *m, registry *r, void *doc1, void *n1, char *conf_dir, char *prefix, int saved_stdout, int level, void(func)(registry *, maps *, void *, void *, service *)) |
Recursivelly parse zcfg starting from the ZOO-Kernel cwd. More... | |
void | exitAndCleanUp (registry *zooRegistry, maps *m, const char *zcfg, const char *code, const char *locator, char *orig, char *corig, void(funcError)(maps *, map *)) |
When th zcfg file is not found, print error message and cleanup memory. More... | |
int | fetchService (registry *zooRegistry, maps *m, service **spService, map *request_inputs, char *ntmp, char *cIdentifier, void(funcError)(maps *, map *)) |
Parse the ZOO-Service ZCFG to fill the service datastructure. More... | |
int | fetchServicesForDescription (registry *zooRegistry, maps *m, char *r_inputs, void(func)(registry *, maps *, void *, void *, service *), void *doc, void *n, char *conf_dir, map *request_inputs, void(funcError)(maps *, map *)) |
Search services from various possible sources. More... | |
void | initAllEnvironment (maps *conf, map *request_inputs, const char *cPath, const char *request) |
Initialize environment sections, load env, and populate lenv and renv. More... | |
void | donothing (int sig) |
Signal handling function which simply call exit(0). More... | |
void | sig_handler (int sig) |
Signal handling function which create an ExceptionReport node containing the information message corresponding to the signal number. More... | |
void | loadServiceAndRun (maps **myMap, service *s1, map *request_inputs, maps **inputs, maps **ioutputs, int *eres) |
Load a service provider and run the service function. More... | |
int | runRequest (map **inputs) |
Process the request. More... | |
Variables | |
char ** | environ |
Macro Definition Documentation
#define _ | ( | String | ) | dgettext ("zoo-kernel",String) |
Translation function for zoo-kernel.
#define __ | ( | String | ) | dgettext ("zoo-service",String) |
Translation function for zoo-service.
Function Documentation
int crlex | ( | ) |
void donothing | ( | int | sig | ) |
Signal handling function which simply call exit(0).
- Parameters
-
sig the signal number
int dumpBackFinalFile | ( | maps * | m, |
char * | fbkp, | ||
char * | fbkp1 | ||
) |
Dump back the final file fbkp1 to fbkp.
- Parameters
-
m the conf maps containing the main.cfg settings fbkp the string corresponding to the name of the file fbkp1 the string corresponding to the name of the file
void exitAndCleanUp | ( | registry * | zooRegistry, |
maps * | m, | ||
const char * | zcfg, | ||
const char * | code, | ||
const char * | locator, | ||
char * | orig, | ||
char * | corig, | ||
void(funcError)(maps *, map *) | |||
) |
When th zcfg file is not found, print error message and cleanup memory.
- Parameters
-
zooRegistry the populated registry m the maps pointer to the content of main.cfg file zcfg the zcfg file name code the string determining the nature of the error locator the string determining which parameter the error refer to orig the service name corig the current service name (in case multiple services was parsed) funcError the function used to print the error back
int fetchService | ( | registry * | zooRegistry, |
maps * | m, | ||
service ** | spService, | ||
map * | request_inputs, | ||
char * | ntmp, | ||
char * | cIdentifier, | ||
void(funcError)(maps *, map *) | |||
) |
Parse the ZOO-Service ZCFG to fill the service datastructure.
- Parameters
-
zooRegistry the populated registry m the maps pointer to the content of main.cfg file spService the pointer to the service pointer to be filled request_inputs the map pointer for http request inputs ntmp the path where the ZCFG files are stored cIdentifier the service identifier funcError the error function to be used in case of error
int fetchServicesForDescription | ( | registry * | zooRegistry, |
maps * | m, | ||
char * | r_inputs, | ||
void(func)(registry *, maps *, void *, void *, service *) | , | ||
void * | doc, | ||
void * | n, | ||
char * | conf_dir, | ||
map * | request_inputs, | ||
void(funcError)(maps *, map *) | |||
) |
Search services from various possible sources.
- Parameters
-
zopRegistry the populated registry m the maps pointer to the content of main.cfg file r_inputs the service(s) name(s) func the function used to print the result back doc the xml document or NULL (for json) n the xmlNode of JSON object pointer to the current element conf_dir the directory where the main.cfg has been found request_inputs the map pointer to the request KVP if any funcError the function used to print the error back
- Returns
- 0 in case of success, 1 otherwise
No support for dot in service name stored in metadb!? #ifdef META_DB service* s2=extractServiceFromDb(m,tmpMapI->value,0); if(s2==NULL){ #endif
void initAllEnvironment | ( | maps * | conf, |
map * | request_inputs, | ||
const char * | cPath, | ||
const char * | request | ||
) |
Initialize environment sections, load env, and populate lenv and renv.
- Parameters
-
conf the maps pointing to the main.cfg file content request_inputs the map pointing to the request KVP cPath a string pointing to the cwd request a string pointing to the request key (xrequest or jrequest)
Initialize the specific [lenv] section which contains runtime variables:
- usid : it is an universally unique identifier
- osid : it is an idenfitication number
- sid : it is the process idenfitication number (OS)
- uusid : it is an universally unique identifier
- status : value between 0 and 100 to express the completude of the operations of the running service
- message : is a string where you can store error messages, in case service is failing, or o provide details on the ongoing operation.
- cwd : the current working directory or servicePath if defined
- soap : is a boolean value, true if the request was contained in a SOAP Envelop
- sessid : string storing the session identifier (only when cookie is used)
- cgiSid : only defined on Window platforms (for being able to identify the created process)
void loadServiceAndRun | ( | maps ** | myMap, |
service * | s1, | ||
map * | request_inputs, | ||
maps ** | inputs, | ||
maps ** | ioutputs, | ||
int * | eres | ||
) |
Load a service provider and run the service function.
- Parameters
-
myMap the conf maps containing the main.cfg settings s1 the service structure request_inputs map storing all the request parameters inputs the inputs maps ioutputs the outputs maps eres the result returned by the service execution
Extract serviceType to know what kind of service should be loaded
Unable to load the specified shared library
int recursReaddirF | ( | maps * | m, |
registry * | r, | ||
void * | doc1, | ||
void * | n1, | ||
char * | conf_dir, | ||
char * | prefix, | ||
int | saved_stdout, | ||
int | level, | ||
void(func)(registry *, maps *, void *, void *, service *) | |||
) |
Recursivelly parse zcfg starting from the ZOO-Kernel cwd.
Call the func function given in arguments after parsing the ZCFG file.
- Parameters
-
m the conf maps containing the main.cfg settings r the registry containing profiles hierarchy n the root XML Node to add the sub-elements conf_dir the location of the main.cfg file (basically cwd) prefix the current prefix if any, or NULL saved_stdout the saved stdout identifier level the current level (number of sub-directories to reach the current path) func a pointer to a function having 4 parameters (registry*, maps*, xmlNodePtr and service*).
- See also
- inheritance, readServiceFile
int runRequest | ( | map ** | inputs | ) |
Process the request.
Specific includes.
- Parameters
-
inputs the request parameters map
- Returns
- 0 on sucess, other value on failure
- See also
- conf_read,recursReaddirF
Parsing service specfic configuration file
Manage our own error log file (usefull to separate standard apache debug messages from the ZOO-Kernel ones but also for IIS users to avoid wrong headers messages returned by the CGI due to wrong redirection of stderr)
Language gesture
Here we need to close stdout to ensure that unsupported chars has been found in the zcfg and then printed on stdout
Loop over Identifier list
Create the input and output maps data structure
05-007r7 WPS 1.0.0 page 57 : 'If status="true" and storeExecuteResponse is "false" then the service shall raise an exception.'
error server don't accept the process need to output a valid error response here !!!
Ensure that if error occurs when freeing memory, no signal will return an ExceptionReport document as the result was already returned to the client.
void sig_handler | ( | int | sig | ) |
Signal handling function which create an ExceptionReport node containing the information message corresponding to the signal number.
- Parameters
-
sig the signal number
void translateChar | ( | char * | str, |
char | toReplace, | ||
char | toReplaceBy | ||
) |
Replace a char by another one in a string.
- Parameters
-
str the string to update toReplace the char to replace toReplaceBy the char that will be used
int yylex | ( | ) |
Variable Documentation
char** environ |
Generated on Wed Feb 5 2025 12:00:17 for ZOO-Project by 1.8.9.1