/Users/maurits/Documents/studie/afstuderen/biosphere/common/type.h File Reference

#include <biosphere.h>
#include <apr_pools.h>

Include dependency graph for type.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bs_data_typenew_bs_data_type (apr_pool_t *mp, const char *name)
bs_messagenew_bs_message (apr_pool_t *mp, const char *name, bs_uint16 num_parts)
void add_part_to_message (bs_message *msg, bs_message_part *part, apr_pool_t *mp)
bs_message_partnew_bs_message_part (apr_pool_t *mp, const char *name, bs_data_type *type)
bs_operationnew_bs_operation (apr_pool_t *mp, const char *name, bs_message *input, bs_message *output, bs_message *fault)
bs_port_typenew_bs_port_type (apr_pool_t *mp, const char *name, bs_uint16 num_operations)
void add_operation_to_port_type (bs_port_type *pt, bs_operation *op, apr_pool_t *mp)
bs_portnew_bs_port (apr_pool_t *mp, const char *name, bs_port_type *type)
bs_servicenew_bs_service (apr_pool_t *mp, const char *name, bs_uint16 num_ports)
void add_port_to_service (bs_service *svc, bs_port *port, apr_pool_t *mp)
bs_definitionnew_bs_definition (apr_pool_t *mp, const char *name, bs_uint16 num_data_types, bs_uint16 num_messages, bs_uint16 num_port_types, bs_uint16 num_services)
void add_data_type_to_definition (bs_definition *def, bs_data_type *type, apr_pool_t *mp)
void add_message_to_definition (bs_definition *def, bs_message *msg, apr_pool_t *mp)
void add_port_type_to_definition (bs_definition *def, bs_port_type *pt, apr_pool_t *mp)
void add_service_to_definition (bs_definition *def, bs_service *svc, apr_pool_t *mp)
bs_service_requestnew_bs_service_request (apr_pool_t *mp, bs_byte *uuid, char *service, char *port, char *operation, bs_message_instance *input)
bs_service_responsenew_bs_service_response (apr_pool_t *mp, const bs_byte *uuid, const char *service, const char *port, const char *operation, bs_message_instance *output, bs_message_instance *fault)
bs_message_instancenew_bs_message_instance (apr_pool_t *mp, const char *name, bs_uint16 num_parts)
bs_part_instancenew_bs_part_instance (apr_pool_t *mp, const char *name, bs_data_type *type, const char *data, bs_uint64 size)
void add_part_to_request_instance (bs_part_instance *part, bs_message_instance *msg, apr_pool_t *mp)
bs_status merge_def_with_def (apr_pool_t *mp, bs_definition *result, bs_definition *d)
bs_status merge_bs_definitions (apr_pool_t *mp, bs_definition **def,...)
bs_bool is_builtin_type (const char *name)
bs_status check_builtin_type (bs_part_instance *inst)
bs_bool request_corresponds_with_definition (const bs_service_request *request, const bs_definition *def)


Function Documentation

void add_data_type_to_definition ( bs_definition def,
bs_data_type type,
apr_pool_t *  mp 
) [inline]

Add a data type to a given service definition structure. There is some memory trickery involved here so use this convenience function.

Parameters:
def Service definition structure to add the type to
typ Type to add
mp Memory pool to allocate from

Definition at line 220 of file type.c.

References bs_definition::data_types, bs_data_type::name, bs_definition::num_data_types, pool_realloc(), and streq().

Referenced by merge_def_with_def(), and process_definition().

Here is the call graph for this function:

void add_message_to_definition ( bs_definition def,
bs_message msg,
apr_pool_t *  mp 
) [inline]

Definition at line 241 of file type.c.

References bs_definition::messages, bs_message::name, bs_definition::num_messages, pool_realloc(), and streq().

Referenced by merge_def_with_def(), and process_definition().

Here is the call graph for this function:

void add_operation_to_port_type ( bs_port_type pt,
bs_operation op,
apr_pool_t *  mp 
) [inline]

Add a message part to a given message structure. There is some memory trickery involved here so use this convenience function.

Parameters:
pt Port type structure to add the ioeration to
op Operation to add
mp Memory pool to allocate from

Definition at line 132 of file type.c.

References bs_port_type::num_operations, bs_port_type::operations, and pool_realloc().

Referenced by process_porttype().

Here is the call graph for this function:

void add_part_to_message ( bs_message msg,
bs_message_part part,
apr_pool_t *  mp 
) [inline]

Add a message part to a given message structure. There is some memory trickery involved here so use this convenience function.

Parameters:
msg Message structure to add the part to
part Message part to add
mp Memory pool to allocate from

Definition at line 75 of file type.c.

References bs_message::num_parts, bs_message::parts, and pool_realloc().

Referenced by process_message().

Here is the call graph for this function:

void add_part_to_request_instance ( bs_part_instance part,
bs_message_instance msg,
apr_pool_t *  mp 
) [inline]

Add a part to a given service_request instance.

Definition at line 373 of file type.c.

References bs_message_instance::num_parts, bs_message_instance::parts, and pool_realloc().

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

Here is the call graph for this function:

void add_port_to_service ( bs_service svc,
bs_port port,
apr_pool_t *  mp 
) [inline]

Add a port to a given service structure. There is some memory trickery involved here so use this convenience function.

Parameters:
svc Service structure to add the port to
port Port to add
mp Memory pool to allocate from

Definition at line 174 of file type.c.

References bs_service::num_ports, pool_realloc(), and bs_service::ports.

Referenced by process_service().

Here is the call graph for this function:

void add_port_type_to_definition ( bs_definition def,
bs_port_type pt,
apr_pool_t *  mp 
) [inline]

Definition at line 262 of file type.c.

References bs_port_type::name, bs_definition::num_port_types, getversion::p, pool_realloc(), bs_definition::port_types, and streq().

Referenced by merge_def_with_def(), and process_definition().

Here is the call graph for this function:

void add_service_to_definition ( bs_definition def,
bs_service svc,
apr_pool_t *  mp 
) [inline]

Definition at line 283 of file type.c.

References bs_service::name, bs_definition::num_services, pool_realloc(), bs_definition::services, and streq().

Referenced by merge_def_with_def(), and process_definition().

Here is the call graph for this function:

bs_status check_builtin_type ( bs_part_instance inst  ) 

Check if the builtin type of the given message part instance is correct. Ie. if a bs_int32 is really an integer and not a string. Also check if the ranges are correct.

Parameters:
inst The message part instance to be checked
Returns:
BS_OK iff all is correct, BS_ERROR otherwise.

Definition at line 617 of file type.c.

References BS_ERROR, check_builtin_type_bs_bool(), check_builtin_type_bs_byte(), check_builtin_type_bs_double(), check_builtin_type_bs_int16(), check_builtin_type_bs_int32(), check_builtin_type_bs_int64(), check_builtin_type_bs_string(), check_builtin_type_bs_uint16(), check_builtin_type_bs_uint32(), check_builtin_type_bs_uint64(), bs_data_type::name, streq(), and bs_part_instance::type.

Referenced by check_types().

Here is the call graph for this function:

bs_bool is_builtin_type ( const char *  name  ) 

Determine whether the name of the given type is a builtin type or not.

Parameters:
name Name of the type
Returns:
True iff the named type is builtin.

Definition at line 429 of file type.c.

References FALSE, streq(), and TRUE.

Referenced by check_types(), and new_bs_data_type().

Here is the call graph for this function:

bs_status merge_bs_definitions ( apr_pool_t *  mp,
bs_definition **  def,
  ... 
)

Merge several bs_definitions into a single bs_definition.

Parameters:
mp Memory pool to use
def Result pointer to merged bs_definition
Returns:
Status code.

Definition at line 407 of file type.c.

References BS_ERROR, BS_OK, merge_def_with_def(), new_bs_definition(), and runtestsuite::rv.

Here is the call graph for this function:

bs_status merge_def_with_def ( apr_pool_t *  mp,
bs_definition result,
bs_definition d 
)

Add the given definition to the other.

Parameters:
mp Memory pool to allocate from
result Definition to add the other to
d Definition to add the result
Returns:
Status code.

Definition at line 386 of file type.c.

References add_data_type_to_definition(), add_message_to_definition(), add_port_type_to_definition(), add_service_to_definition(), BS_OK, bs_definition::data_types, bs_definition::messages, bs_definition::num_data_types, bs_definition::num_messages, bs_definition::num_port_types, bs_definition::num_services, bs_definition::port_types, and bs_definition::services.

Referenced by get_services(), and merge_bs_definitions().

Here is the call graph for this function:

bs_data_type* new_bs_data_type ( apr_pool_t *  mp,
const char *  name 
)

Construct a new bs_data_type struct.

Parameters:
mp Memory pool to allocate from
name Name of the data type
builtin Boolean indicating whether it is a native/builtin type
Returns:
Datatype structure.

Definition at line 47 of file type.c.

References bs_data_type::builtin, bs_data_type::from_mp, is_builtin_type(), bs_data_type::name, and TRUE.

Referenced by bsmod_stat_handle_avgminmax(), bsmod_stat_handle_gather_times(), core_service_create_status_response(), core_service_module_service_list(), create_error_response(), create_request(), create_status_response(), main(), process_data_type(), and process_request_input_part().

Here is the call graph for this function:

bs_definition* new_bs_definition ( apr_pool_t *  mp,
const char *  name,
bs_uint16  num_data_types,
bs_uint16  num_messages,
bs_uint16  num_port_types,
bs_uint16  num_services 
)

Construct a new bs_definition structure to capture a service definition.

Parameters:
mp Memory pool to allocate from
name Name of the service definition
num_data_types The number of data types in the definition
num_data_messages The number of messages in the definition
num_data_port_types The number of port types in the definition
num_data_services The number of services in the definition
Returns:
Allocated bs_message struct.

Definition at line 187 of file type.c.

References bs_definition::data_types, bs_definition::from_mp, bs_definition::messages, bs_definition::name, bs_definition::num_data_types, bs_definition::num_messages, bs_definition::num_port_types, bs_definition::num_services, bs_definition::port_types, bs_definition::services, and TRUE.

Referenced by get_services(), main(), merge_bs_definitions(), and process_definition().

bs_message* new_bs_message ( apr_pool_t *  mp,
const char *  name,
bs_uint16  num_parts 
)

Construct a new bs_message structure to capture a message definition.

Parameters:
mp Memory pool to allocate from
name Name of the message
num_parts The number of parts in the message
Returns:
Allocated bs_message struct.

Definition at line 59 of file type.c.

References bs_message::from_mp, bs_message::name, bs_message::num_parts, bs_message::parts, and TRUE.

Referenced by main(), and process_message().

bs_message_instance* new_bs_message_instance ( apr_pool_t *  mp,
const char *  name,
bs_uint16  num_parts 
)

Create and allocate a fresh bs_message_instance structure.

Definition at line 343 of file type.c.

References bs_message_instance::from_mp, bs_message_instance::name, bs_message_instance::num_parts, bs_message_instance::parts, and TRUE.

Referenced by bsmod_stat_handle_avgminmax(), bsmod_stat_handle_gather_times(), core_service_create_status_response(), core_service_module_service_list(), create_error_response(), create_request(), create_status_response(), create_void_message(), process_request_input(), process_response_fault(), and process_response_output().

bs_message_part* new_bs_message_part ( apr_pool_t *  mp,
const char *  name,
bs_data_type type 
)

Construct a new bs_message_part structure to capture a message part definition.

Parameters:
mp Memory pool to allocate from
name Name of the message part
type The data_type of the part
Returns:
Allocated bs_message_part struct.

Definition at line 87 of file type.c.

References bs_message_part::from_mp, bs_message_part::name, TRUE, and bs_message_part::type.

Referenced by main(), and process_message().

bs_operation* new_bs_operation ( apr_pool_t *  mp,
const char *  name,
bs_message input,
bs_message output,
bs_message fault 
)

Construct a new bs_operation structure to capture a service operation definition.

Parameters:
mp Memory pool to allocate from
name Name of the message
input Input message of the operation
output Output message of the operation
fault Fault message of the operation
Returns:
Allocated bs_operation struct.

Definition at line 100 of file type.c.

References bs_operation::fault, bs_operation::from_mp, bs_operation::input, bs_operation::name, bs_operation::output, and TRUE.

Referenced by main(), and process_operation().

bs_part_instance* new_bs_part_instance ( apr_pool_t *  mp,
const char *  name,
bs_data_type type,
const char *  data,
bs_uint64  size 
)

Create and allocate a fresh bs_part_instance structure. It will make a copy of the passed data buffer.

Definition at line 359 of file type.c.

References bs_part_instance::data, bs_part_instance::from_mp, bs_part_instance::name, bs_part_instance::size, TRUE, and bs_part_instance::type.

Referenced by bsmod_stat_handle_avgminmax(), bsmod_stat_handle_gather_times(), core_service_create_status_response(), core_service_module_service_list(), create_error_response(), create_request(), create_status_response(), and process_request_input_part().

bs_port* new_bs_port ( apr_pool_t *  mp,
const char *  name,
bs_port_type type 
)

Construct a new bs_port structure to capture a port definition.

Parameters:
mp Memory pool to allocate from
name Name of the port
type The type of the port
Returns:
Allocated bs_port struct.

Definition at line 145 of file type.c.

References bs_port::from_mp, bs_port::name, bs_port::port_type, and TRUE.

Referenced by main(), and process_port().

bs_port_type* new_bs_port_type ( apr_pool_t *  mp,
const char *  name,
bs_uint16  num_operations 
)

Construct a new bs_port_type structure to capture a port type definition.

Parameters:
mp Memory pool to allocate from
name Name of the port type
num_operations The number of operations in the port type
Returns:
Allocated bs_port_type struct.

Definition at line 115 of file type.c.

References bs_port_type::from_mp, bs_port_type::name, bs_port_type::num_operations, bs_port_type::operations, and TRUE.

Referenced by main(), and process_porttype().

bs_service* new_bs_service ( apr_pool_t *  mp,
const char *  name,
bs_uint16  num_ports 
)

Construct a new bs_service structure to capture a service definition.

Parameters:
mp Memory pool to allocate from
name Name of the service
num_ports The number of ports in the service
Returns:
Allocated bs_service struct.

Definition at line 157 of file type.c.

References bs_service::from_mp, bs_service::name, bs_service::num_ports, bs_service::ports, and TRUE.

Referenced by main(), and process_service().

bs_service_request* new_bs_service_request ( apr_pool_t *  mp,
bs_byte uuid,
char *  service,
char *  port,
char *  operation,
bs_message_instance input 
)

Create and allocate a fresh bs_service_request structure.

Definition at line 304 of file type.c.

References bs_service_request::from_mp, bs_service_request::input, bs_service_request::operation, bs_service_request::port, bs_service_request::service, TRUE, and bs_service_request::uuid.

Referenced by create_request(), and process_request().

bs_service_response* new_bs_service_response ( apr_pool_t *  mp,
const bs_byte uuid,
const char *  service,
const char *  port,
const char *  operation,
bs_message_instance output,
bs_message_instance fault 
)

Create and allocate a fresh bs_service_response structure.

Definition at line 323 of file type.c.

References bs_service_response::fault, bs_service_response::from_mp, bs_service_response::operation, bs_service_response::output, bs_service_response::port, bs_service_response::service, TRUE, and bs_service_response::uuid.

Referenced by bsmod_stat_handle_avgminmax(), bsmod_stat_handle_gather_times(), core_service_create_status_response(), core_service_module_service_list(), create_error_response(), create_status_response(), create_void_message(), and process_response().

bs_bool request_corresponds_with_definition ( const bs_service_request request,
const bs_definition def 
)

Check if the given request corresponds with a service in the definition and if the types are correct and matching.

Parameters:
request Request to match
def Definition to match against
Returns:
True iff the request corresponds to the definition

Definition at line 747 of file type.c.

References BS_OK, can_service(), check_types(), FALSE, and TRUE.

Referenced by get_servicing_node(), and handle_service_request().

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