My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Attributes | List of all members
msu_type Struct Reference

Defines a type of MSU. More...

#include <msu_type.h>

Public Attributes

char * name
 Name for the msu type. More...
 
unsigned int id
 Numerical identifier for the MSU. More...
 
int(* init_type )(struct msu_type *type)
 Constructor for an MSU_type itself, should initialize whatever context all MSUs of this type might need to rely upon. More...
 
void(* destroy_type )(struct msu_type *type)
 Destructor for an MSU type, should destroy context initialized in init_type. More...
 
int(* init )(struct local_msu *self, struct msu_init_data *initial_data)
 Type-specific construction function. More...
 
void(* destroy )(struct local_msu *self)
 Type-specific destructor that frees any internal data or state. More...
 
int(* receive )(struct local_msu *self, struct msu_msg *msg)
 Handles the receiving of data sent from other MSUs. More...
 
int(* receive_error )(struct local_msu *self, struct msu_msg *msg)
 
int(* route )(struct msu_type *type, struct local_msu *sender, struct msu_msg *msg, struct msu_endpoint *output)
 Choose which MSU of this type the previous MSU will route to. More...
 
serialization_fn serialize
 Defines serialization protocol for data sent to this MSU type If NULL, assumes no pointers in the msu message, and simply serializes the input for the length defined in the msu message header. More...
 
serialization_fn serialize_error
 Defines serialization protocol for errors returned to this MSU type If NULL, assumes no pointers in the msu message and simply serializes the input for the provided length. More...
 
deserialization_fn deserialize
 Defines deserialization protocl for data received by this MSU type If NULL, assumes no pointers in the msu message, and simply assigns input as the message. More...
 
deserialization_fn deserialize_error
 

Detailed Description

Defines a type of MSU.

This information (mostly callbacks) is shared across all MSUs of the same type.

Definition at line 46 of file msu_type.h.

Member Data Documentation

deserialization_fn msu_type::deserialize

Defines deserialization protocl for data received by this MSU type If NULL, assumes no pointers in the msu message, and simply assigns input as the message.

Parameters
selfThe MSU to receive the deserialized buffer
input_sizeSize of the received buffer
inputMessage to be deserialized
out_sizeTo be filled with the size of the struct deserialized off of the buffer
Returns
The deserialized buffer

Definition at line 128 of file msu_type.h.

deserialization_fn msu_type::deserialize_error

Definition at line 130 of file msu_type.h.

void(* msu_type::destroy)(struct local_msu *self)

Type-specific destructor that frees any internal data or state.

Can be NULL if no additional freeing must occur

Parameters
selfMSU to be destroyed

Definition at line 81 of file msu_type.h.

void(* msu_type::destroy_type)(struct msu_type *type)

Destructor for an MSU type, should destroy context initialized in init_type.

Parameters
typeThe type to be destroyed

Definition at line 64 of file msu_type.h.

unsigned int msu_type::id

Numerical identifier for the MSU.

Definition at line 51 of file msu_type.h.

int(* msu_type::init)(struct local_msu *self, struct msu_init_data *initial_data)

Type-specific construction function.

Generic construction for an MSU is always handled by local_msu. Can be set to NULL if no additional initialization must occur. If this is non-NULL it provides additional initialization, such as construction of msu state.

Parameters
selfMSU to be initialized (structure is already allocated)
initial_datainitial information passed to the runtime by the global controller
Returns
0 on success, -1 on error

Definition at line 75 of file msu_type.h.

int(* msu_type::init_type)(struct msu_type *type)

Constructor for an MSU_type itself, should initialize whatever context all MSUs of this type might need to rely upon.

Can be set to NULL if no additional init must occur.

Parameters
typeMSU type under construction
Returns
0 on success, -1 on error

Definition at line 59 of file msu_type.h.

char* msu_type::name

Name for the msu type.

Definition at line 48 of file msu_type.h.

int(* msu_type::receive)(struct local_msu *self, struct msu_msg *msg)

Handles the receiving of data sent from other MSUs.

This field can not be set to NULL, and must be defined for each msu_type.

Parameters
selfMSU receieving data
msgdata to receive from previous MSU
Returns
0 on success, -1 on error

Definition at line 89 of file msu_type.h.

int(* msu_type::receive_error)(struct local_msu *self, struct msu_msg *msg)

Definition at line 91 of file msu_type.h.

int(* msu_type::route)(struct msu_type *type, struct local_msu *sender, struct msu_msg *msg, struct msu_endpoint *output)

Choose which MSU of this type the previous MSU will route to.

If NULL, defaults to default_routing() in runtime/routing_strategies.c

Parameters
typeMSU type of endpoint
senderMSU sending the message
msgdata to be sent, in case destination depends on specifics of data
outputOutput argument to be filled with the appropriate destination
Returns
0 on succes, -1 on error

Definition at line 101 of file msu_type.h.

serialization_fn msu_type::serialize

Defines serialization protocol for data sent to this MSU type If NULL, assumes no pointers in the msu message, and simply serializes the input for the length defined in the msu message header.

Parameters
typeThe type of MSU to which the serialized message is to be delivered
inputThe MSU message to be serialized
outputTo be allocated and filled with the serialized MSU message
Returns
Size of the serialized message

Definition at line 112 of file msu_type.h.

serialization_fn msu_type::serialize_error

Defines serialization protocol for errors returned to this MSU type If NULL, assumes no pointers in the msu message and simply serializes the input for the provided length.

Definition at line 118 of file msu_type.h.


The documentation for this struct was generated from the following file: