asymcute.h File Reference

Asymcute MQTT-SN interface definition. More...

Detailed Description

Asymcute MQTT-SN interface definition.

Hauke Petersen

Definition in file asymcute.h.

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "assert.h"
#include "event/timeout.h"
#include "event/callback.h"
#include "net/mqttsn.h"
#include "net/sock/udp.h"
#include "net/sock/util.h"
+ Include dependency graph for asymcute.h:

Go to the source code of this file.

Data Structures

struct  asymcute_req
 Asymcute request context. More...
struct  asymcute_con
 Asymcute connection context. More...
struct  asymcute_topic
 Data-structure for holding topics and their registration status. More...
struct  asymcute_sub
 Data-structure holding the state of subscriptions. More...
struct  asymcute_will
 Data structure for defining a last will. More...


 Default buffer size for Asymcute client (as exponent of 2^n) More...
 Maximum topic length. More...
 Keep alive interval [in s] communicated to the gateway. More...
 Interval to use for sending periodic ping messages. More...
 Resend interval [in seconds]. More...
 Number of retransmissions until requests time out. More...
 Default buffer size used for receive and request buffers.
 Default priority for Asymcute's handler thread.
 Default stack size for Asymcute's handler thread.
 Default priority for an Asymcute listener thread. More...
 Default stack size for an Asymcute listener thread.


typedef struct asymcute_con asymcute_con_t
 Forward type declaration for connections contexts.
typedef struct asymcute_req asymcute_req_t
 Forward type declaration for request contexts.
typedef struct asymcute_sub asymcute_sub_t
 Forward type declaration for subscription contexts.
typedef struct asymcute_topic asymcute_topic_t
 Forward type declaration for topic definitions.
typedef struct asymcute_will asymcute_will_t
 Forward type declaration for last will definitions.
typedef void(* asymcute_evt_cb_t) (asymcute_req_t *req, unsigned evt_type)
 Event callback used for communicating connection and request related events to the user. More...
typedef void(* asymcute_sub_cb_t) (const asymcute_sub_t *sub, unsigned evt_type, const void *data, size_t len, void *arg)
 Callback triggered on events for active subscriptions. More...
typedef unsigned(* asymcute_to_cb_t) (asymcute_con_t *con, asymcute_req_t *req)
 Context specific timeout callback, only used internally.


enum  {
 Return values used by public Asymcute functions. More...
enum  {
 Possible event types passed to the event callback. More...


static bool asymcute_req_in_use (const asymcute_req_t *req)
 Check if a given request context is currently used. More...
static bool asymcute_sub_active (const asymcute_sub_t *sub)
 Check if a given subscription is currently active. More...
static void asymcute_topic_reset (asymcute_topic_t *topic)
 Reset the given topic. More...
static bool asymcute_topic_is_reg (const asymcute_topic_t *topic)
 Check if a given topic is currently registered with a gateway. More...
static bool asymcute_topic_is_init (const asymcute_topic_t *topic)
 Check if a given topic is initialized. More...
static bool asymcute_topic_equal (const asymcute_topic_t *a, const asymcute_topic_t *b)
 Compare two given topics and check if they are equal. More...
int asymcute_topic_init (asymcute_topic_t *topic, const char *topic_name, uint16_t topic_id)
 Initialize the given topic. More...
int asymcute_listener_run (asymcute_con_t *con, char *stack, size_t stacksize, char priority, asymcute_evt_cb_t callback)
 Start a listener thread. More...
void asymcute_handler_run (void)
 Start the global Asymcute handler thread for processing timeouts and keep alive events. More...
bool asymcute_is_connected (const asymcute_con_t *con)
 Check if the given connection context is connected to a gateway. More...
int asymcute_connect (asymcute_con_t *con, asymcute_req_t *req, sock_udp_ep_t *server, const char *cli_id, bool clean, asymcute_will_t *will)
 Connect to the given MQTT-SN gateway. More...
int asymcute_disconnect (asymcute_con_t *con, asymcute_req_t *req)
 Close the given connection. More...
int asymcute_register (asymcute_con_t *con, asymcute_req_t *req, asymcute_topic_t *topic)
 Register a given topic with the connected gateway. More...
int asymcute_publish (asymcute_con_t *con, asymcute_req_t *req, const asymcute_topic_t *topic, const void *data, size_t data_len, uint8_t flags)
 Publish the given data to the given topic. More...
int asymcute_subscribe (asymcute_con_t *con, asymcute_req_t *req, asymcute_sub_t *sub, asymcute_topic_t *topic, asymcute_sub_cb_t callback, void *arg, uint8_t flags)
 Subscribe to a given topic. More...
int asymcute_unsubscribe (asymcute_con_t *con, asymcute_req_t *req, asymcute_sub_t *sub)
 Cancel an active subscription. More...