ZOO-Project
Functions
request_parser.h File Reference
#include "service.h"
#include "ulinet.h"
#include <libxml/parser.h>
#include <libxml/xpath.h>

Go to the source code of this file.

Functions

xmlXPathObjectPtr extractFromDoc (xmlDocPtr, const char *)
 Apply XPath Expression on XML document. More...
 
int appendMapsToMaps (maps *, maps *, maps *, elements *)
 Create (or append to) an array valued maps value = "["",""]". More...
 
void ensureDecodedBase64 (maps **)
 Make sure that each value encoded in base64 in a maps is decoded. More...
 
int kvpParseInputs (maps **, service *, map *, maps **, HINTERNET *)
 Parse inputs provided as KVP and store them in a maps. More...
 
int xmlParseBoundingBox (maps **, map **, xmlDocPtr)
 Parse a BoundingBoxData node. More...
 
int kvpParseOutputs (maps **, map *, maps **)
 Parse outputs provided as KVP and store them in a maps. More...
 
int xmlParseInputs (maps **, service *, maps **, xmlDocPtr, xmlNodeSet *, HINTERNET *)
 Parse inputs from XML nodes and store them in a maps. More...
 
int xmlParseOutputs (maps **, map **, maps **, xmlDocPtr, xmlNodePtr, bool)
 Parse outputs from XML nodes and store them in a maps. More...
 
int xmlParseRequest (maps **, const char *, map **, service *, maps **, maps **, HINTERNET *)
 Parse XML request and store information in maps. More...
 
int parseRequest (maps **, map **, service *, maps **, maps **, HINTERNET *)
 Parse request and store information in maps. More...
 
void checkValidValue (map *, map **, const char *, const char **, int)
 Verify if a parameter value is valid. More...
 
int validateRequest (maps **, service *, map *, maps **, maps **, HINTERNET *)
 Ensure that each requested arguments are present in the request DataInputs and ResponseDocument / RawDataOutput. More...
 
void parseCookie (maps **, const char *)
 Parse cookie contained in request headers. More...
 

Function Documentation

int appendMapsToMaps ( maps m,
maps mo,
maps mi,
elements elem 
)

Create (or append to) an array valued maps value = "["",""]".

Parameters
mthe conf maps containing the main.cfg settings
mothe map to update
mithe map to append
elemthe elements containing default definitions
Returns
0 on success, -1 on failure
void checkValidValue ( map request,
map **  res,
const char *  toCheck,
const char **  avalues,
int  mandatory 
)

Verify if a parameter value is valid.

Parameters
requestthe request map
resthe error map potentially generated
toCheckthe parameter to use
avaluesthe acceptable values (or null if testing only for presence)
mandatoryverify the presence of the parameter if mandatory > 0
void ensureDecodedBase64 ( maps **  in)

Make sure that each value encoded in base64 in a maps is decoded.

Parameters
inthe maps containing the values
See also
readBase64
xmlXPathObjectPtr extractFromDoc ( xmlDocPtr  doc,
const char *  search 
)

Apply XPath Expression on XML document.

Parameters
docthe XML Document
searchthe XPath expression
Returns
xmlXPathObjectPtr containing the resulting nodes set
int kvpParseInputs ( maps **  main_conf,
service s,
map request_inputs,
maps **  request_output,
HINTERNET hInternet 
)

Parse inputs provided as KVP and store them in a maps.

Parameters
main_confthe conf maps containing the main.cfg settings
sthe service
request_inputsthe map storing KVP raw value
request_outputthe maps to store the KVP pairs
hInternetthe HINTERNET queue to add potential requests
Returns
0 on success, -1 on failure
int kvpParseOutputs ( maps **  main_conf,
map request_inputs,
maps **  request_output 
)

Parse outputs provided as KVP and store them in a maps.

Parameters
main_confthe conf maps containing the main.cfg settings
request_inputsthe map storing KVP raw value
request_outputthe maps to store the KVP pairs
Returns
0 on success, -1 on failure

Parsing outputs provided as KVP

Put each Output into the outputs_as_text array

void parseCookie ( maps **  conf,
const char *  cookie 
)

Parse cookie contained in request headers.

Parameters
confthe conf maps containinfg the main.cfg
cookiethe
int parseRequest ( maps **  main_conf,
map **  request_inputs,
service s,
maps **  inputs,
maps **  outputs,
HINTERNET hInternet 
)

Parse request and store information in maps.

Parameters
main_confthe conf maps containing the main.cfg settings
postthe string containing the XML request
request_inputsthe map storing KVP raw value
sthe service
inputsthe maps to store the KVP pairs
outputsthe maps to store the KVP pairs
hInternetthe HINTERNET queue to add potential requests
Returns
0 on success, -1 on failure
See also
kvpParseOutputs,kvpParseInputs,xmlParseRequest
int validateRequest ( maps **  main_conf,
service s,
map original_request,
maps **  request_inputs,
maps **  request_outputs,
HINTERNET hInternet 
)

Ensure that each requested arguments are present in the request DataInputs and ResponseDocument / RawDataOutput.

Potentially run http requests from the queue in parallel. For optional inputs add default values defined in the ZCFG file.

Parameters
main_conf
s
original_request
request_inputs
request_outputs
hInternet
See also
runHttpRequests
int xmlParseBoundingBox ( maps **  ,
map **  ,
xmlDocPtr   
)

Parse a BoundingBoxData node.

http://schemas.opengis.net/ows/1.1.0/owsCommon.xsd: BoundingBoxType

A map to store boundingbox information will contain:

  • LowerCorner : double double (minimum within this bounding box)
  • UpperCorner : double double (maximum within this bounding box)
  • crs : URI (Reference to definition of the CRS)
  • dimensions : int
Parameters
main_confthe conf maps containing the main.cfg settings
request_inputsthe map storing KVP raw value
docthe xmlDocPtr containing the BoudingoxData node
Returns
a map containing all the bounding box keys
int xmlParseInputs ( maps **  main_conf,
service s,
maps **  request_output,
xmlDocPtr  doc,
xmlNodeSet *  nodes,
HINTERNET hInternet 
)

Parse inputs from XML nodes and store them in a maps.

Parameters
main_confthe conf maps containing the main.cfg settings
sthe service
request_outputthe maps to store the KVP pairs
docthe xmlDocPtr containing the original request
nodesthe input nodes array
hInternetthe HINTERNET queue to add potential requests
Returns
0 on success, -1 on failure
int xmlParseOutputs ( maps **  main_conf,
map **  request_inputs,
maps **  request_output,
xmlDocPtr  doc,
xmlNodePtr  cur,
bool  raw 
)

Parse outputs from XML nodes and store them in a maps.

Parameters
main_confthe conf maps containing the main.cfg settings
request_inputsthe map storing KVP raw value
request_outputthe maps to store the KVP pairs
docthe xmlDocPtr containing the original request
curthe xmlNodePtr corresponding to the ResponseDocument or RawDataOutput XML node
rawtrue if the node is RawDataOutput, false in case of ResponseDocument
Returns
0 on success, -1 on failure
int xmlParseRequest ( maps **  main_conf,
const char *  post,
map **  request_inputs,
service s,
maps **  inputs,
maps **  outputs,
HINTERNET hInternet 
)

Parse XML request and store information in maps.

Parameters
main_confthe conf maps containing the main.cfg settings
postthe string containing the XML request
request_inputsthe map storing KVP raw value
sthe service
inputsthe maps to store the KVP pairs
outputsthe maps to store the KVP pairs
hInternetthe HINTERNET queue to add potential requests
Returns
0 on success, -1 on failure

Extract Input nodes from the XML Request.