Microsoft Azure IoT Gateway SDK
1.0.8
The Microsoft Azure IoT Gateway SDK contains the infrastructure and modules to create IoT gateway solutions.
|
Definition of the functions and structures that must be implemented by a gateway module loader. More...
#include "azure_c_shared_utility/macro_utils.h"
#include "azure_c_shared_utility/umock_c_prod.h"
#include "module.h"
#include "parson.h"
Go to the source code of this file.
Data Structures | |
struct | MODULE_LOADER_BASE_CONFIGURATION_TAG |
struct | MODULE_LOADER_API_TAG |
Function table for loading modules into a gateway. More... | |
struct | MODULE_LOADER_TAG |
Typedefs | |
typedef void * | MODULE_LIBRARY_HANDLE |
handle for a module library | |
typedef struct MODULE_LOADER_BASE_CONFIGURATION_TAG | MODULE_LOADER_BASE_CONFIGURATION |
typedef struct MODULE_LOADER_API_TAG | MODULE_LOADER_API |
Function table for loading modules into a gateway. | |
typedef enum MODULE_LOADER_TYPE_TAG | MODULE_LOADER_TYPE |
Enumeration listing all supported module loaders. | |
typedef struct MODULE_LOADER_TAG | MODULE_LOADER |
typedef enum MODULE_LOADER_RESULT_TAG | MODULE_LOADER_RESULT |
Enumeration describing the result of module loader APIs. | |
Enumerations | |
enum | MODULE_LOADER_TYPE_TAG { UNKNOWN, NATIVE, JAVA, DOTNET, DOTNETCORE, NODEJS, OUTPROCESS } |
Enumeration listing all supported module loaders. | |
enum | MODULE_LOADER_RESULT_TAG { MODULE_LOADER_SUCCESS, MODULE_LOADER_ERROR } |
Enumeration describing the result of module loader APIs. | |
Functions | |
MOCKABLE_FUNCTION (, MODULE_LOADER_RESULT, ModuleLoader_ParseBaseConfigurationFromJson, MODULE_LOADER_BASE_CONFIGURATION *, configuration, const JSON_Value *, json) | |
Utility function for parsing a JSON object that has a property called "binding.path" into a MODULE_LOADER_BASE_CONFIGURATION instance. | |
MOCKABLE_FUNCTION (, void, ModuleLoader_FreeBaseConfiguration, MODULE_LOADER_BASE_CONFIGURATION *, configuration) | |
Utility function for freeing a MODULE_LOADER_BASE_CONFIGURATION* instance from a previous call to ModuleLoader_ParseBaseConfigurationFromJson. | |
MOCKABLE_FUNCTION (, MODULE_LOADER_RESULT, ModuleLoader_Initialize) | |
This function creates the default set of module loaders that the gateway supports. | |
MOCKABLE_FUNCTION (, void, ModuleLoader_Destroy) | |
This function frees resources allocated for tracking module loaders. | |
MOCKABLE_FUNCTION (, MODULE_LOADER_RESULT, ModuleLoader_Add, const MODULE_LOADER *, loader) | |
Adds a new module loader to the gateway's collection of module loaders. | |
MOCKABLE_FUNCTION (, MODULE_LOADER_RESULT, ModuleLoader_UpdateConfiguration, MODULE_LOADER *, loader, MODULE_LOADER_BASE_CONFIGURATION *, configuration) | |
Replaces the module loader configuration for the given loader in a thread-safe manner. | |
MOCKABLE_FUNCTION (, MODULE_LOADER *, ModuleLoader_FindByName, const char *, name) | |
Searches the module loader collection given the loader's name. | |
MOCKABLE_FUNCTION (, MODULE_LOADER *, ModuleLoader_GetDefaultLoaderForType, MODULE_LOADER_TYPE, type) | |
Given a module loader type, returns the default loader. | |
MOCKABLE_FUNCTION (, MODULE_LOADER_TYPE, ModuleLoader_ParseType, const char *, type) | |
Given a string representation of a module loader type, returns the corresponding enum value. | |
MOCKABLE_FUNCTION (, bool, ModuleLoader_IsDefaultLoader, const char *, name) | |
Given a module name, determines if it is a default module loader or a custom one. | |
MOCKABLE_FUNCTION (, MODULE_LOADER_RESULT, ModuleLoader_InitializeFromJson, const JSON_Value *, loaders) | |
Updates the global loaders array from a JSON that looks like this: More... | |
Definition of the functions and structures that must be implemented by a gateway module loader.
A gateway module loader library must make available to the gateway application (e.g. via a function) an instance of the MODULE_LOADER_API structure. This structure must contain valid pointers to functions that can be invoked by the gateway to load and unload a gateway module, and get its interface.
typedef struct MODULE_LOADER_TAG MODULE_LOADER |
The Module Loader.
Configuration that is common to all module loaders goes here. The expectation is that a given module loader will define its own configuration struct but always have an instance of this struct as the first field.
MOCKABLE_FUNCTION | ( | MODULE_LOADER_RESULT | , |
ModuleLoader_InitializeFromJson | , | ||
const JSON_Value * | , | ||
loaders | |||
) |
Updates the global loaders array from a JSON that looks like this:
"loaders": [ { "type": "node", "name": "node", "configuration": { "binding.path": "./bin/libnode_binding.so" } }, { "type": "java", "name": "java", "configuration": { "jvm.options": { "memory": 1073741824 }, "gateway.class.path": "./bin/gateway.jar", "binding.path": "./bin/libjava_binding.so" } }, { "type": "dotnet", "name": "dotnet", "configuration": { "binding.path": "./bin/libdotnet_binding.so" } } ]