14 #include "azure_c_shared_utility/macro_utils.h" 15 #include "azure_c_shared_utility/vector.h" 17 #include "nanomsg/nn.h" 21 #include "gateway_export.h" 28 #define GATEWAY_CONNECTION_ID_MAX NN_SOCKADDR_MAX 29 #define GATEWAY_MESSAGE_VERSION_1 0x01 30 #define GATEWAY_MESSAGE_VERSION_CURRENT GATEWAY_MESSAGE_VERSION_1 32 #define GATEWAY_ADD_LINK_RESULT_VALUES \ 33 GATEWAY_ADD_LINK_SUCCESS, \ 34 GATEWAY_ADD_LINK_ERROR, \ 35 GATEWAY_ADD_LINK_INVALID_ARG 41 #define GATEWAY_START_RESULT_VALUES \ 42 GATEWAY_START_SUCCESS, \ 43 GATEWAY_START_INVALID_ARGS 49 #define GATEWAY_UPDATE_FROM_JSON_RESULT_VALUES \ 50 GATEWAY_UPDATE_FROM_JSON_SUCCESS, \ 51 GATEWAY_UPDATE_FROM_JSON_ERROR, \ 52 GATEWAY_UPDATE_FROM_JSON_INVALID_ARG, \ 53 GATEWAY_UPDATE_FROM_JSON_MEMORY const MODULE_LOADER * loader
Pointer to the module loader to be used for loading this module.
Definition: gateway.h:81
Struct representing the loader and entrypoint to be used for a specific module.
Definition: gateway.h:76
GATEWAY_EXPORT void Gateway_StartModule(GATEWAY_HANDLE gw, MODULE_HANDLE module)
Tells a module that the gateway is ready for it to start.
GATEWAY_EXPORT GATEWAY_UPDATE_FROM_JSON_RESULT Gateway_UpdateFromJson(GATEWAY_HANDLE gw, const char *json_content)
Updates a gateway using a JSON configuration string as input which describes each module...
enum GATEWAY_ADD_LINK_RESULT_TAG GATEWAY_ADD_LINK_RESULT
Enumeration describing the result of Gateway_AddLink.
void * MODULE_HANDLE
Represents a module instance.
Definition: module.h:25
const char * module_source
The name of the module which is going to send messages.
Definition: gateway.h:64
GATEWAY_EXPORT GATEWAY_ADD_LINK_RESULT Gateway_AddLink(GATEWAY_HANDLE gw, const GATEWAY_LINK_ENTRY *entryLink)
Adds a link to a gateway message broker.
GATEWAY_EXPORT void Gateway_RemoveLink(GATEWAY_HANDLE gw, const GATEWAY_LINK_ENTRY *entryLink)
Remove a link from a gateway message broker.
GATEWAY_EXPORT int Gateway_RemoveModuleByName(GATEWAY_HANDLE gw, const char *module_name)
Removes module by its unique name.
GATEWAY_MODULE_LOADER_INFO module_loader_info
The module loader information for this module.
Definition: gateway.h:96
GATEWAY_EXPORT MODULE_HANDLE Gateway_AddModule(GATEWAY_HANDLE gw, const GATEWAY_MODULES_ENTRY *entry)
Creates a new module based on the GATEWAY_MODULES_ENTRY*.
struct GATEWAY_MODULE_LOADER_INFO_TAG GATEWAY_MODULE_LOADER_INFO
Struct representing the loader and entrypoint to be used for a specific module.
struct GATEWAY_HANDLE_DATA_TAG * GATEWAY_HANDLE
Struct representing a particular gateway.
Definition: gateway.h:71
struct GATEWAY_LINK_ENTRY_TAG GATEWAY_LINK_ENTRY
Struct representing a single link for a gateway.
void * entrypoint
Pointer to the entrypoint for this module.
Definition: gateway.h:85
Struct representing the properties that should be used when creating a module; each entry of the VECT...
Definition: gateway.h:106
struct GATEWAY_MODULES_ENTRY_TAG GATEWAY_MODULES_ENTRY
Struct representing a single entry of the GATEWAY_PROPERTIES.
GATEWAY_EXPORT void Gateway_RemoveModule(GATEWAY_HANDLE gw, MODULE_HANDLE module)
Removes the provided module from the gateway and all links that involves this module.
VECTOR_HANDLE gateway_modules
Vector of GATEWAY_MODULES_ENTRY objects.
Definition: gateway.h:109
Struct representing a single link for a gateway.
Definition: gateway.h:61
GATEWAY_EXPORT GATEWAY_HANDLE Gateway_CreateFromJson(const char *file_path)
Creates a gateway using a JSON configuration file as input which describes each module. Each module described in the configuration must support Module_CreateFromJson.
struct GATEWAY_PROPERTIES_DATA_TAG GATEWAY_PROPERTIES
Struct representing the properties that should be used when creating a module; each entry of the VECT...
Definition of the functions and structures that must be implemented by a gateway module loader...
Definition: module_loader.h:119
const char * module_name
The (possibly NULL) name of the module.
Definition: gateway.h:93
GATEWAY_EXPORT void Gateway_Destroy(GATEWAY_HANDLE gw)
Destroys the gateway and disposes of all associated data.
GATEWAY_EXPORT GATEWAY_START_RESULT Gateway_Start(GATEWAY_HANDLE gw)
Tell the Gateway it's ready to start.
const void * module_configuration
The user-defined configuration object for the module.
Definition: gateway.h:99
Struct representing a single entry of the GATEWAY_PROPERTIES.
Definition: gateway.h:90
enum GATEWAY_START_RESULT_TAG GATEWAY_START_RESULT
Enumeration describing the result of Gateway_Start.
const char * module_sink
The name of the module which is going to receive messages.
Definition: gateway.h:67
VECTOR_HANDLE gateway_links
Vector of GATEWAY_LINK_ENTRY objects.
Definition: gateway.h:112
Interface for modules which communicate with other modules via a message broker.
enum GATEWAY_UPDATE_FROM_JSON_RESULT_TAG GATEWAY_UPDATE_FROM_JSON_RESULT
Enumeration describing the result of Gateway_UpdateFromJson.
GATEWAY_EXPORT GATEWAY_HANDLE Gateway_Create(const GATEWAY_PROPERTIES *properties)
Creates a new gateway using the provided GATEWAY_PROPERTIES.