9 #ifndef MOKA_MESSAGE_BROKER_H
10 #define MOKA_MESSAGE_BROKER_H
64 #define MESSAGE_BROKER_LOG_ON 1
66 #define MESSAGE_BROKER_LOG_OFF 0
137 uint8_t max_services);
234 const uint8_t* payload_in,
235 uint16_t payload_in_length,
237 const uint8_t* payload_out,
238 uint16_t payload_out_length);
Common definitions, structures, routines, and errors.
enum moka_bool moka_bool_t
moka's boolean type.
uint16_t(* moka_service_proxy_t)(uint16_t function_identifier, const void *inbound, uint16_t in_length, void *outbound, uint16_t *out_length, uint16_t *error)
Proxy that shall be implemented by each service registered onto a essage broker so it will be contact...
Definition: common.h:351
#define SERVICE_MAX_NAME_SIZE
Definition: memory_footprint.h:29
enum moka_service_type moka_service_type_t
A service is a moka end-point that fulfills a functional responsbility.
uint16_t dst_fnct
Definition: message_broker.h:88
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.
uint16_t payload_length
Definition: message_broker.h:102
moka_message_broker_t * msg_brk_get_instance(moka_service_type_t type)
provides the message broker instance corresponding to the service type.
uint32_t src_auth_token
Definition: message_broker.h:84
uint16_t msg_brk_cleanup_service(moka_service_t *service)
calls service's cleanup generic function.
uint8_t dst
Definition: message_broker.h:86
uint64_t timestamp
Definition: message_broker.h:78
moka_service_type_t type
Definition: message_broker.h:114
uint16_t msg_brk_unregister_service(moka_service_t *service)
removes a service from the routing table.
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.
uint16_t msg_brk_register_service(moka_service_t *service)
registers a moka service.
uint16_t msg_brk_register_lists_of_services(moka_service_t *list_of_services, uint8_t number_of_services)
registers a list of services.
moka_service_proxy_t proxy
Definition: message_broker.h:116
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.
uint16_t msg_brk_release_service(moka_service_t *service)
calls service's release generic function.
struct moka_service moka_service_t
Service definition.
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.
moka_header_t hdr
Definition: message_broker.h:100
uint32_t msg_id
Definition: message_broker.h:80
uint16_t msg_brk_setup_service(moka_service_t *service)
calls service's setup generic function.
uint16_t msg_brk_initialize_service(moka_service_t *service, const uint8_t *inbound, uint16_t in_length)
calls service's initialize generic function.
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 respo...
struct moka_message moka_message_t
Message used to communicate between services.
void * payload
Definition: message_broker.h:104
struct moka_header moka_header_t
Message header used to forward and trace a message from one service to another.
char name[SERVICE_MAX_NAME_SIZE]
Definition: message_broker.h:112
uint16_t dst_srv_err
Definition: message_broker.h:90
uint16_t dst_fnct_err
Definition: message_broker.h:92
moka_message_broker_t * message_broker
Definition: message_broker.h:118
uint8_t msg_brk_get_maximum_supported_service(void)
returns the maximum service that can be registered to a message broker.
uint8_t src
Definition: message_broker.h:82
uint16_t msg_brk_set_trace(moka_message_broker_t *message_broker, uint8_t on_off)
enables message broker traces.
Message broker structure gathering all its states.
Definition: common.h:607
Message used to communicate between services.
Definition: message_broker.h:98
Service definition.
Definition: message_broker.h:110