TI's MQTT Demo with freertos CM4F

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

server_core.h File Reference

server_core.h File Reference

The MQTT server daemon, a task, provisions the high level abstractions for the smart applicaltions. More...

Go to the source code of this file.

Data Structures

struct  mqtt_server_app_cfg
 Configuration for the applications that utilize the MQTT Server Daemon. More...

Functions

int32_t mqtt_server_topic_enroll (const void *app_hnd, const struct utf8_string *topic, enum mqtt_qos qos)
 Enroll with server to receive data for a topic This routine registers with the server, the specified topic for which the application should receive any published data from the network.
int32_t mqtt_server_topic_disenroll (const void *app_hnd, const struct utf8_string *topic)
 Cancel previous enrollment to receive data for a topic This routines terminates the previous registration, if any, made by the application to receive any publishised data for the specified topic.
int32_t mqtt_server_app_pub_send (const struct utf8_string *topic, const uint8_t *data_buf, uint32_t data_len, enum mqtt_qos qos, bool retain)
 Send data to network for a topic This routine offers the binary data along-with associated properties for a specific topic to the server.
void * mqtt_server_app_register (const struct mqtt_server_app_cbs *cbs, const char *name)
 Register an application with the server.
int32_t mqtt_server_init (const struct mqtt_server_lib_cfg *lib_cfg, const struct mqtt_server_app_cfg *app_cfg)
 Initialize the MQTT Server (Task / Daemon).

Detailed Description

The MQTT server daemon, a task, provisions the high level abstractions for the smart applicaltions.

This is an intelligent layer that utilizes the services of the MQTT Server Packet Library and is responsible for the functions of the topic management, the client management and support of multiple server applications.

The light-weight server enables the services of the MQTT protocol for an application to either extend and / or control the existing functions to suit the deployment specific scenario. These applications in practice are the plug-ins / add-ons to the core server functionalities. Specifically, these applications, among others capabilities, can be used for analyzing and approving the credentials of the remote clients, acting as a bridge between a MQTT external client and the server, and a snooper to learn about all the data transactions to / from the server.

The server is targeted to conform to MQTT 3.1.1 specification.

The services of the server are multi-task safe. Platform specific atomicity constructs are used, through abstractions, by the server to maintain data coherency and synchronization.

The server offers the following compile line configurable parameters (-D opt)

  • CFG_SR_MAX_MQP_TX_LEN: the constant buffer length allocated for a TX.

  • CFG_SR_MAX_SUBTOP_LEN: the maximum buffer size to hold a sub-topic. For e.g., in the topic /x/y/z, the phrase /x, /y and z are sub-topics.

  • CFG_SR_MAX_TOPIC_NODE: the maximum number of topic nodes in server. For e.g., in the topic /x/y/z, there are three nodes (/x, /y and z).

  • CFG_SR_MAX_CL_ID_SIZE: the maximum length of the client-id string.

  • CFG_SR_MAX_NUM_CLIENT: the maximum number of clients to be managed. Note this is different from the maximum number of 'contexts'. A large number of clients can be managed using fewer number of 'contexts' (connections).

Note:
Any future extensions & development must follow the following guidelines. A new API or an extension to the existing API a) must be rudimentary b) must not imply a rule or policy (including a state machine) b) must ensure simple design and implementation

Definition in file server_core.h.