/Users/maurits/Documents/studie/afstuderen/biosphere/common/xml.c File Reference

#include "xml.h"
#include "str.h"
#include "type.h"
#include <alloc.h>
#include <stack.h>
#include <apr_base64.h>
#include <apr_strings.h>
#include <apr_xml.h>
#include <apr_uuid.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>

Include dependency graph for xml.c:

Go to the source code of this file.

Functions

static bs_status add_datatypes_to_xml (char **buf, const bs_definition *def, apr_pool_t *mp)
static bs_status add_message_part_to_xml (char **buf, const bs_message_part *part, apr_pool_t *mp)
static bs_status add_message_to_xml (char **buf, const bs_message *msg, apr_pool_t *mp)
static bs_status add_messages_to_xml (char **buf, const bs_definition *def, apr_pool_t *mp)
static bs_status add_operation_to_xml (char **buf, const bs_operation *op, apr_pool_t *mp)
static bs_status add_port_type_to_xml (char **buf, const bs_port_type *pt, apr_pool_t *mp)
static bs_status add_porttypes_to_xml (char **buf, const bs_definition *def, apr_pool_t *mp)
static bs_status add_port_to_xml (char **buf, const bs_port *port, apr_pool_t *mp)
static bs_status add_service_to_xml (char **buf, const bs_service *sv, apr_pool_t *mp)
static bs_status add_services_to_xml (char **buf, const bs_definition *def, apr_pool_t *mp)
static bs_status add_use_service_to_xml (char **buf, const bs_service_request *def, apr_pool_t *mp)
static bs_status add_part_instance_to_xml (char **buf, const bs_part_instance *def, apr_pool_t *mp)
static bs_status add_message_instance_to_xml (char **buf, const bs_message_instance *def, char *type, apr_pool_t *mp)
static bs_status add_used_service_to_xml (char **buf, const bs_service_response *def, apr_pool_t *mp)
bs_status xlate_definition_to_xml (char **buf, bs_uint64 *size, const bs_definition *def, apr_pool_t *mp)
bs_status xlate_request_to_xml (char **buf, bs_uint64 *size, const bs_service_request *def, apr_pool_t *mp)
bs_status xlate_response_to_xml (char **buf, bs_uint64 *size, const bs_service_response *def, apr_pool_t *mp)
static bs_data_typeprocess_data_type (const apr_xml_elem *type, apr_pool_t *mp)
static bs_data_typelookup_data_type_by_name (const bs_definition *def, const char *name)
static bs_messageprocess_message (const apr_xml_elem *msg, bs_definition *def, apr_pool_t *mp)
static bs_messagelookup_message_by_element (const apr_xml_elem *elem, const bs_definition *def, apr_pool_t *mp)
static bs_operationprocess_operation (const apr_xml_elem *op, bs_definition *def, apr_pool_t *mp)
static bs_port_typeprocess_porttype (const apr_xml_elem *pt, bs_definition *def, apr_pool_t *mp)
static bs_port_typelookup_porttype_by_name (const char *name, bs_definition *def)
static bs_portprocess_port (const apr_xml_elem *port, bs_definition *def, apr_pool_t *mp)
static bs_serviceprocess_service (const apr_xml_elem *svc, bs_definition *def, apr_pool_t *mp)
static bs_status process_definition (const apr_xml_elem *root, bs_definition **def, apr_pool_t *mp)
static bs_status process_request_input_part (bs_part_instance **part, const apr_xml_elem *elem, apr_pool_t *mp)
static bs_status process_request_input (const apr_xml_elem *msg, bs_service_request *request, apr_pool_t *mp)
static bs_status process_request_use (const apr_xml_elem *elem, bs_service_request *request, apr_pool_t *mp)
static bs_status process_request (const apr_xml_elem *root, bs_service_request **request, apr_pool_t *mp)
static bs_status process_response_output (const apr_xml_elem *msg, bs_service_response *response, apr_pool_t *mp)
static bs_status process_response_fault (const apr_xml_elem *msg, bs_service_response *response, apr_pool_t *mp)
static bs_status process_response_used (const apr_xml_elem *elem, bs_service_response *response, apr_pool_t *mp)
static bs_status process_response (const apr_xml_elem *root, bs_service_response **response, apr_pool_t *mp)
static bs_status process_tree (const apr_xml_elem *root, void **object, unsigned *type, apr_pool_t *mp)
bs_status xlate_from_xml (const char *buf, bs_uint64 limit, void **object, unsigned *type, apr_pool_t *mp)


Function Documentation

static bs_status add_datatypes_to_xml ( char **  buf,
const bs_definition def,
apr_pool_t *  mp 
) [static]

Definition at line 56 of file xml.c.

References BS_OK, bs_definition::data_types, bs_data_type::name, and bs_definition::num_data_types.

Referenced by xlate_definition_to_xml().

static bs_status add_message_instance_to_xml ( char **  buf,
const bs_message_instance def,
char *  type,
apr_pool_t *  mp 
) [static]

Definition at line 247 of file xml.c.

References add_part_instance_to_xml(), BS_OK, bs_message_instance::name, bs_message_instance::num_parts, bs_message_instance::parts, and runtestsuite::rv.

Referenced by xlate_request_to_xml(), and xlate_response_to_xml().

Here is the call graph for this function:

static bs_status add_message_part_to_xml ( char **  buf,
const bs_message_part part,
apr_pool_t *  mp 
) [static]

Definition at line 74 of file xml.c.

References BS_OK, bs_data_type::name, bs_message_part::name, and bs_message_part::type.

Referenced by add_message_to_xml().

static bs_status add_message_to_xml ( char **  buf,
const bs_message msg,
apr_pool_t *  mp 
) [static]

Definition at line 84 of file xml.c.

References add_message_part_to_xml(), BS_OK, bs_message::name, bs_message::num_parts, bs_message::parts, and runtestsuite::rv.

Referenced by add_messages_to_xml().

Here is the call graph for this function:

static bs_status add_messages_to_xml ( char **  buf,
const bs_definition def,
apr_pool_t *  mp 
) [static]

Definition at line 101 of file xml.c.

References add_message_to_xml(), BS_OK, bs_definition::messages, bs_definition::num_messages, and runtestsuite::rv.

Referenced by xlate_definition_to_xml().

Here is the call graph for this function:

static bs_status add_operation_to_xml ( char **  buf,
const bs_operation op,
apr_pool_t *  mp 
) [static]

Definition at line 116 of file xml.c.

References BS_OK, bs_operation::fault, bs_operation::input, bs_message::name, bs_operation::name, and bs_operation::output.

Referenced by add_port_type_to_xml().

static bs_status add_part_instance_to_xml ( char **  buf,
const bs_part_instance def,
apr_pool_t *  mp 
) [static]

Definition at line 228 of file xml.c.

References BS_OK, BS_UINT64_FMT, bs_data_type::builtin, bs_part_instance::data, bs_data_type::name, bs_part_instance::name, bs_part_instance::size, and bs_part_instance::type.

Referenced by add_message_instance_to_xml().

static bs_status add_port_to_xml ( char **  buf,
const bs_port port,
apr_pool_t *  mp 
) [static]

Definition at line 168 of file xml.c.

References BS_OK, bs_port_type::name, bs_port::name, and bs_port::port_type.

Referenced by add_service_to_xml().

static bs_status add_port_type_to_xml ( char **  buf,
const bs_port_type pt,
apr_pool_t *  mp 
) [static]

Definition at line 134 of file xml.c.

References add_operation_to_xml(), BS_OK, bs_port_type::name, bs_port_type::num_operations, bs_port_type::operations, and runtestsuite::rv.

Referenced by add_porttypes_to_xml().

Here is the call graph for this function:

static bs_status add_porttypes_to_xml ( char **  buf,
const bs_definition def,
apr_pool_t *  mp 
) [static]

Definition at line 153 of file xml.c.

References add_port_type_to_xml(), BS_OK, bs_definition::num_port_types, bs_definition::port_types, and runtestsuite::rv.

Referenced by xlate_definition_to_xml().

Here is the call graph for this function:

static bs_status add_service_to_xml ( char **  buf,
const bs_service sv,
apr_pool_t *  mp 
) [static]

Definition at line 178 of file xml.c.

References add_port_to_xml(), BS_OK, bs_service::name, bs_service::num_ports, bs_service::ports, and runtestsuite::rv.

Referenced by add_services_to_xml().

Here is the call graph for this function:

static bs_status add_services_to_xml ( char **  buf,
const bs_definition def,
apr_pool_t *  mp 
) [static]

Definition at line 196 of file xml.c.

References add_service_to_xml(), BS_OK, bs_definition::num_services, runtestsuite::rv, and bs_definition::services.

Referenced by xlate_definition_to_xml().

Here is the call graph for this function:

static bs_status add_use_service_to_xml ( char **  buf,
const bs_service_request def,
apr_pool_t *  mp 
) [static]

Definition at line 217 of file xml.c.

References BS_OK, bs_service_request::operation, bs_service_request::port, and bs_service_request::service.

Referenced by xlate_request_to_xml().

static bs_status add_used_service_to_xml ( char **  buf,
const bs_service_response def,
apr_pool_t *  mp 
) [static]

Definition at line 273 of file xml.c.

References BS_OK, bs_service_response::operation, bs_service_response::port, and bs_service_response::service.

Referenced by xlate_response_to_xml().

static bs_data_type* lookup_data_type_by_name ( const bs_definition def,
const char *  name 
) [static]

Lookup the named data type in the definition that is processed. Return a pointer to that data type if it is found, otherwise returns NULL.

Definition at line 375 of file xml.c.

References bs_definition::data_types, bs_definition::num_data_types, and streq().

Referenced by process_message().

Here is the call graph for this function:

static bs_message* lookup_message_by_element ( const apr_xml_elem *  elem,
const bs_definition def,
apr_pool_t *  mp 
) [static]

Search for the message inside the given (half) processed bs_definition based on the message attribute of the given element.

Parameters:
elem The message attribute of this element will be the search key
def bs_definition structure hopefully containing the message
mp Memory pool to use
Returns:
Pointer to message definition if found or NULL

Definition at line 437 of file xml.c.

References bs_definition::messages, bs_definition::num_messages, and streq().

Referenced by process_operation().

Here is the call graph for this function:

static bs_port_type* lookup_porttype_by_name ( const char *  name,
bs_definition def 
) [static]

Lookup the porttype given its name in the bs_definition structure.

Parameters:
name Name of the portType
def The bs_definition structure to scourge
Returns:
Status code

Definition at line 542 of file xml.c.

References bs_definition::num_port_types, bs_definition::port_types, and streq().

Referenced by process_port().

Here is the call graph for this function:

static bs_data_type* process_data_type ( const apr_xml_elem *  type,
apr_pool_t *  mp 
) [static]

Process a data type.

Definition at line 354 of file xml.c.

References new_bs_data_type(), and streq().

Referenced by process_definition().

Here is the call graph for this function:

static bs_status process_definition ( const apr_xml_elem *  root,
bs_definition **  def,
apr_pool_t *  mp 
) [static]

Process the given XML tree of a definition into the bs_definition structure.

Parameters:
root The XML tree
def A pointer to a pointer to a bs_definition structure.
mp Memory pool to use
Returns:
Status code

Definition at line 622 of file xml.c.

References add_data_type_to_definition(), add_message_to_definition(), add_port_type_to_definition(), add_service_to_definition(), BS_ERROR, BS_OK, BS_XML_PARSE_ERROR, new_bs_definition(), process_data_type(), process_message(), process_porttype(), process_service(), and streq().

Referenced by process_tree().

Here is the call graph for this function:

static bs_message* process_message ( const apr_xml_elem *  msg,
bs_definition def,
apr_pool_t *  mp 
) [static]

Process a message element by processing the given XML message element and returning an allocated and processed bs_message structure.

Parameters:
msg XML message element
def bs_definition struct to use for cross-referencing names
mp Memory pool to use
Returns:
Freshly allocated bs_message struct.

Definition at line 395 of file xml.c.

References add_part_to_message(), lookup_data_type_by_name(), new_bs_message(), new_bs_message_part(), and streq().

Referenced by process_definition().

Here is the call graph for this function:

static bs_operation* process_operation ( const apr_xml_elem *  op,
bs_definition def,
apr_pool_t *  mp 
) [static]

Process a operation element by processing the given XML operation element, cross-referencing the already parsed entities using the bs_definition struct and returning an allocated and processed bs_operation structure. If the referenced messages are not encountered in the definition, this function will fail.

Parameters:
pt XML portType element
def bs_definition struct to use for cross-referencing names
mp Memory pool to use
Returns:
Freshly allocated bs_operation struct.

Definition at line 469 of file xml.c.

References lookup_message_by_element(), new_bs_operation(), and streq().

Referenced by process_porttype().

Here is the call graph for this function:

static bs_port* process_port ( const apr_xml_elem *  port,
bs_definition def,
apr_pool_t *  mp 
) [static]

Construct a bs_port from the given XML element port and by cross-referencing the relevant portions in the bs_definition structure.

Parameters:
port The XML port element to convert
def The bs_definition structure to cross-reference
mp Memory pool to allocate from
Returns:
Status code

Definition at line 562 of file xml.c.

References lookup_porttype_by_name(), new_bs_port(), and streq().

Referenced by process_service().

Here is the call graph for this function:

static bs_port_type* process_porttype ( const apr_xml_elem *  pt,
bs_definition def,
apr_pool_t *  mp 
) [static]

Process a portType element by processing the given XML portType element, cross-referencing the already parsed entities using the bs_definition struct and returning an allocated and processed bs_port_type structure.

Parameters:
pt XML portType element
def bs_definition struct to use for cross-referencing names
mp Memory pool to use
Returns:
Freshly allocated bs_port_type struct.

Definition at line 512 of file xml.c.

References add_operation_to_port_type(), new_bs_port_type(), getversion::p, process_operation(), and streq().

Referenced by process_definition().

Here is the call graph for this function:

static bs_status process_request ( const apr_xml_elem *  root,
bs_service_request **  request,
apr_pool_t *  mp 
) [static]

Definition at line 770 of file xml.c.

References BS_OK, BS_XML_PARSE_ERROR, new_bs_service_request(), process_request_input(), process_request_use(), getversion::r, runtestsuite::rv, and streq().

Referenced by process_tree().

Here is the call graph for this function:

static bs_status process_request_input ( const apr_xml_elem *  msg,
bs_service_request request,
apr_pool_t *  mp 
) [static]

Process a given input message instance. Allocate the bs_message_instance and populate it.

Definition at line 719 of file xml.c.

References add_part_to_request_instance(), BS_OK, BS_XML_PARSE_ERROR, bs_service_request::input, new_bs_message_instance(), process_request_input_part(), runtestsuite::rv, and streq().

Referenced by process_request().

Here is the call graph for this function:

static bs_status process_request_input_part ( bs_part_instance **  part,
const apr_xml_elem *  elem,
apr_pool_t *  mp 
) [static]

Given a piece of the XML parse tree regarding a message instance part, convert it into a bs_part_instance structure.

Definition at line 674 of file xml.c.

References BS_ERROR, BS_OK, BS_XML_PARSE_ERROR, bs_data_type::builtin, data, new_bs_data_type(), new_bs_part_instance(), and streq().

Referenced by process_request_input(), process_response_fault(), and process_response_output().

Here is the call graph for this function:

static bs_status process_request_use ( const apr_xml_elem *  elem,
bs_service_request request,
apr_pool_t *  mp 
) [static]

Process a given <use> tag.

Definition at line 753 of file xml.c.

References BS_OK, bs_service_request::operation, bs_service_request::port, bs_service_request::service, and streq().

Referenced by process_request().

Here is the call graph for this function:

static bs_status process_response ( const apr_xml_elem *  root,
bs_service_response **  response,
apr_pool_t *  mp 
) [static]

Definition at line 888 of file xml.c.

References BS_OK, BS_XML_PARSE_ERROR, new_bs_service_response(), process_response_fault(), process_response_output(), process_response_used(), getversion::r, runtestsuite::rv, and streq().

Referenced by process_tree().

Here is the call graph for this function:

static bs_status process_response_fault ( const apr_xml_elem *  msg,
bs_service_response response,
apr_pool_t *  mp 
) [static]

Definition at line 840 of file xml.c.

References add_part_to_request_instance(), BS_OK, BS_XML_PARSE_ERROR, new_bs_message_instance(), bs_service_response::output, process_request_input_part(), runtestsuite::rv, and streq().

Referenced by process_response().

Here is the call graph for this function:

static bs_status process_response_output ( const apr_xml_elem *  msg,
bs_service_response response,
apr_pool_t *  mp 
) [static]

Definition at line 809 of file xml.c.

References add_part_to_request_instance(), BS_OK, BS_XML_PARSE_ERROR, new_bs_message_instance(), bs_service_response::output, process_request_input_part(), runtestsuite::rv, and streq().

Referenced by process_response().

Here is the call graph for this function:

static bs_status process_response_used ( const apr_xml_elem *  elem,
bs_service_response response,
apr_pool_t *  mp 
) [static]

Definition at line 871 of file xml.c.

References BS_OK, bs_service_response::operation, bs_service_response::port, bs_service_response::service, and streq().

Referenced by process_response().

Here is the call graph for this function:

static bs_service* process_service ( const apr_xml_elem *  svc,
bs_definition def,
apr_pool_t *  mp 
) [static]

Process a service element by processing the given XML service element, cross-referencing the already parsed entities using the bs_definition struct and returning an allocated and processed bs_service structure.

Parameters:
svc XML service element
def bs_definition struct to use for cross-referencing names
mp Memory pool to use
Returns:
Freshly allocated bs_service struct.

Definition at line 591 of file xml.c.

References add_port_to_service(), new_bs_service(), process_port(), and streq().

Referenced by process_definition().

Here is the call graph for this function:

static bs_status process_tree ( const apr_xml_elem *  root,
void **  object,
unsigned *  type,
apr_pool_t *  mp 
) [static]

Process the given XML tree by examining the name of its root element.

Parameters:
root The parsed XML tree
object The result argument to put the datastructure in
mp Memory pool to use
Returns:
Status code.

Definition at line 933 of file xml.c.

References BS_XML_PARSE_ERROR, BS_XML_UNKNOWN_ROOT, process_definition(), process_request(), process_response(), SERVICE_DEF_FROM_XML, SERVICE_REQUEST_FROM_XML, SERVICE_RESPONSE_FROM_XML, and streq().

Referenced by xlate_from_xml().

Here is the call graph for this function:


Generated on Tue Jul 17 09:51:01 2007 for Bio-SPHERE by  doxygen 1.5.1