$darkmode
Technical component implementing moka's core architecture. More...
Data Structures | |
| struct | moka_header |
| Message header used to forward and trace a message from one service to another. More... | |
| struct | moka_message |
| Message used to communicate between services. More... | |
| struct | moka_service |
| Service definition. More... | |
Macros | |
| #define | MESSAGE_BROKER_LOG_ON 1 |
| #define | MESSAGE_BROKER_LOG_OFF 0 |
Typedefs | |
| typedef struct moka_header | moka_header_t |
| Message header used to forward and trace a message from one service to another. | |
| typedef struct moka_message | moka_message_t |
| Message used to communicate between services. | |
| typedef struct moka_service | moka_service_t |
| Service definition. | |
Functions | |
| uint16_t | msg_brk_initialize (moka_message_broker_t *message_broker, moka_service_proxy_t *service_table, uint8_t max_services) |
| initializes internal structures. Mandatory call ahead of any other calls. More... | |
| uint8_t | msg_brk_get_maximum_supported_service (void) |
| returns the maximum service that can be registered to a message broker. More... | |
| uint16_t | msg_brk_register_service (moka_service_t *service) |
| registers a moka service. More... | |
| uint16_t | msg_brk_register_lists_of_services (moka_service_t *list_of_services, uint8_t number_of_services) |
| registers a list of services. More... | |
| uint16_t | msg_brk_unregister_service (moka_service_t *service) |
| removes a service from the routing table. More... | |
| uint16_t | msg_brk_send (moka_message_broker_t *message_broker, moka_message_t *request, moka_message_t *response) |
| routes a message to a destination service. Source shall allocate and provide both request's and response's payload buffers. More... | |
| uint16_t | msg_brk_set_trace (moka_message_broker_t *message_broker, uint8_t on_off) |
| enables message broker traces. More... | |
| moka_bool_t | msg_brk_is_service_registered (const moka_message_broker_t *message_broker, moka_service_type_t type) |
| returns whether or not a service is registered. More... | |
| moka_bool_t | msg_brk_is_service_routed (const moka_message_broker_t *message_broker, moka_service_type_t type) |
| notifies whether a service proxy has been registered or not for a given service. More... | |
| uint16_t | msg_brk_prepare_message (uint8_t source, uint8_t destination, uint16_t function, moka_message_t *request, const uint8_t *payload_in, uint16_t payload_in_length, moka_message_t *response, const uint8_t *payload_out, uint16_t payload_out_length) |
| builds a request/response couple to send through a message broker. More... | |
| uint16_t | msg_brk_setup_service (moka_service_t *service) |
| calls service's setup generic function. More... | |
| uint16_t | msg_brk_initialize_service (moka_service_t *service, const uint8_t *inbound, uint16_t in_length) |
| calls service's initialize generic function. More... | |
| uint16_t | msg_brk_cleanup_service (moka_service_t *service) |
| calls service's cleanup generic function. More... | |
| uint16_t | msg_brk_release_service (moka_service_t *service) |
| calls service's release generic function. More... | |
| moka_message_broker_t * | msg_brk_get_instance (moka_service_type_t type) |
| provides the message broker instance corresponding to the service type. More... | |
Variables | |
| uint64_t | timestamp |
| uint32_t | msg_id |
| uint8_t | src |
| uint32_t | src_auth_token |
| uint8_t | dst |
| uint16_t | dst_fnct |
| uint16_t | dst_srv_err |
| uint16_t | dst_fnct_err |
| moka_header_t | hdr |
| uint16_t | payload_length |
| void * | payload |
| char | name [SERVICE_MAX_NAME_SIZE] |
| moka_service_type_t | type |
| moka_service_proxy_t | proxy |
| moka_message_broker_t * | message_broker |
Technical component implementing moka's core architecture.
| #define MESSAGE_BROKER_LOG_OFF 0 |
Turn log off.
| #define MESSAGE_BROKER_LOG_ON 1 |
Turn log on.
| uint16_t msg_brk_cleanup_service | ( | moka_service_t * | service | ) |
calls service's cleanup generic function.
| service | service with valid message broker |
| moka_message_broker_t* msg_brk_get_instance | ( | moka_service_type_t | type | ) |
provides the message broker instance corresponding to the service type.
| uint8_t msg_brk_get_maximum_supported_service | ( | void | ) |
returns the maximum service that can be registered to a message broker.
| uint16_t msg_brk_initialize | ( | moka_message_broker_t * | message_broker, |
| moka_service_proxy_t * | service_table, | ||
| uint8_t | max_services | ||
| ) |
initializes internal structures. Mandatory call ahead of any other calls.
| [in,out] | message_broker | message broker instance |
| [in,out] | service_table | service table provided by calling level |
| [in] | max_services | number of maximum services to be registered |
| uint16_t msg_brk_initialize_service | ( | moka_service_t * | service, |
| const uint8_t * | inbound, | ||
| uint16_t | in_length | ||
| ) |
calls service's initialize generic function.
| [in] | service | service with valid message broker |
| [in] | inbound | optional data set. Depends on the service |
| [in] | in_length | data set's length |
| moka_bool_t msg_brk_is_service_registered | ( | const moka_message_broker_t * | message_broker, |
| moka_service_type_t | type | ||
| ) |
returns whether or not a service is registered.
| [in] | message_broker | message broker instance |
| [in] | type | service type |
| moka_bool_t msg_brk_is_service_routed | ( | const moka_message_broker_t * | message_broker, |
| moka_service_type_t | type | ||
| ) |
notifies whether a service proxy has been registered or not for a given service.
| [in] | message_broker | message broker instance |
| [in] | type | service type |
| uint16_t msg_brk_prepare_message | ( | uint8_t | source, |
| uint8_t | destination, | ||
| uint16_t | function, | ||
| moka_message_t * | request, | ||
| const uint8_t * | payload_in, | ||
| uint16_t | payload_in_length, | ||
| moka_message_t * | response, | ||
| const uint8_t * | payload_out, | ||
| uint16_t | payload_out_length | ||
| ) |
builds a request/response couple to send through a message broker.
| [in] | source | emitting service |
| [in] | destination | receiving service |
| [in] | function | service's function to request |
| [in,out] | request | allocated by calling level |
| [in] | payload_in | allocated by calling level. May be null |
| [in] | payload_in_length | payload's length |
| [in,out] | response | allocated by calling level |
| [in] | payload_out | allocated by calling level. May be null |
| [in] | payload_out_length | payload length |
| uint16_t msg_brk_register_lists_of_services | ( | moka_service_t * | list_of_services, |
| uint8_t | number_of_services | ||
| ) |
registers a list of services.
| [in] | list_of_services | |
| [in] | number_of_services |
| uint16_t msg_brk_register_service | ( | moka_service_t * | service | ) |
registers a moka service.
| [in,out] | service | a service with a valid message broker |
| uint16_t msg_brk_release_service | ( | moka_service_t * | service | ) |
calls service's release generic function.
| service | service with valid message broker |
| uint16_t msg_brk_send | ( | moka_message_broker_t * | message_broker, |
| moka_message_t * | request, | ||
| moka_message_t * | response | ||
| ) |
routes a message to a destination service. Source shall allocate and provide both request's and response's payload buffers.
| [in,out] | message_broker | message broker instance |
| [in,out] | request | message instance |
| [in,out] | response | message instance |
| uint16_t msg_brk_set_trace | ( | moka_message_broker_t * | message_broker, |
| uint8_t | on_off | ||
| ) |
enables message broker traces.
| [in,out] | message_broker | message broker instance |
| [in] | on_off |
| uint16_t msg_brk_setup_service | ( | moka_service_t * | service | ) |
calls service's setup generic function.
| [in] | service | a service with valid message broker |
| uint16_t msg_brk_unregister_service | ( | moka_service_t * | service | ) |
removes a service from the routing table.
| [in,out] | service | a service with a valid message broker |
| uint8_t dst |
receiver - service id
| uint16_t dst_fnct |
receiver - service's function id
| uint16_t dst_fnct_err |
receiver - service's function error
| uint16_t dst_srv_err |
receiver - service error
| moka_header_t hdr |
Message header.
| moka_message_broker_t* message_broker |
Service message broker.
| uint32_t msg_id |
unique exchange identifier for a pair of request/response message
| char name[SERVICE_MAX_NAME_SIZE] |
service name.
| void* payload |
Message data.
| uint16_t payload_length |
Message length.
| moka_service_proxy_t proxy |
Service proxy.
| uint8_t src |
sender - service id
| uint32_t src_auth_token |
sender's authentication token
| uint64_t timestamp |
optional message timestamp
| moka_service_type_t type |
Service type.