Mistake on this page?
Report an issue in GitHub or email us
mqtt_priv.h
Go to the documentation of this file.
1 /**
2  * @file
3  * MQTT client (private interface)
4  */
5 
6 /*
7  * Copyright (c) 2016 Erik Andersson
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without modification,
11  * are permitted provided that the following conditions are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  * 3. The name of the author may not be used to endorse or promote products
19  * derived from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
30  * OF SUCH DAMAGE.
31  *
32  * This file is part of the lwIP TCP/IP stack.
33  *
34  * Author: Erik Andersson
35  *
36  */
37 #ifndef LWIP_HDR_APPS_MQTT_PRIV_H
38 #define LWIP_HDR_APPS_MQTT_PRIV_H
39 
40 #include "lwip/apps/mqtt.h"
41 #include "lwip/altcp.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /** Pending request item, binds application callback to pending server requests */
49 {
50  /** Next item in list, NULL means this is the last in chain,
51  next pointing at itself means request is unallocated */
53  /** Callback to upper layer */
55  void *arg;
56  /** MQTT packet identifier */
57  u16_t pkt_id;
58  /** Expire time relative to element before this */
59  u16_t timeout_diff;
60 };
61 
62 /** Ring buffer */
64  u16_t put;
65  u16_t get;
66  u8_t buf[MQTT_OUTPUT_RINGBUF_SIZE];
67 };
68 
69 /** MQTT client */
71 {
72  /** Timers and timeouts */
73  u16_t cyclic_tick;
74  u16_t keep_alive;
75  u16_t server_watchdog;
76  /** Packet identifier generator*/
77  u16_t pkt_id_seq;
78  /** Packet identifier of pending incoming publish */
79  u16_t inpub_pkt_id;
80  /** Connection state */
81  u8_t conn_state;
82  struct altcp_pcb *conn;
83  /** Connection callback */
84  void *connect_arg;
85  mqtt_connection_cb_t connect_cb;
86  /** Pending requests to server */
88  struct mqtt_request_t req_list[MQTT_REQ_MAX_IN_FLIGHT];
89  void *inpub_arg;
90  /** Incoming data callback */
93  /** Input */
94  u32_t msg_idx;
95  u8_t rx_buffer[MQTT_VAR_HEADER_BUFFER_LEN];
96  /** Output ring-buffer */
97  struct mqtt_ringbuf_t output;
98 };
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* LWIP_HDR_APPS_MQTT_PRIV_H */
struct mqtt_request_t * pend_req_queue
Pending requests to server.
Definition: mqtt_priv.h:87
void * connect_arg
Connection callback.
Definition: mqtt_priv.h:84
#define MQTT_REQ_MAX_IN_FLIGHT
Maximum number of pending subscribe, unsubscribe and publish requests to server . ...
Definition: mqtt_opts.h:71
void(* mqtt_request_cb_t)(void *arg, err_t err)
Function prototype for mqtt request callback.
Definition: mqtt.h:173
u16_t cyclic_tick
Timers and timeouts.
Definition: mqtt_priv.h:73
mqtt_request_cb_t cb
Callback to upper layer.
Definition: mqtt_priv.h:54
u8_t conn_state
Connection state.
Definition: mqtt_priv.h:81
MQTT client.
Definition: mqtt_priv.h:70
u16_t pkt_id_seq
Packet identifier generator.
Definition: mqtt_priv.h:77
MQTT client.
u16_t pkt_id
MQTT packet identifier.
Definition: mqtt_priv.h:57
struct mqtt_request_t * next
Next item in list, NULL means this is the last in chain, next pointing at itself means request is una...
Definition: mqtt_priv.h:52
#define MQTT_VAR_HEADER_BUFFER_LEN
Number of bytes in receive buffer, must be at least the size of the longest incoming topic + 8 If one...
Definition: mqtt_opts.h:64
u16_t inpub_pkt_id
Packet identifier of pending incoming publish.
Definition: mqtt_priv.h:79
Pending request item, binds application callback to pending server requests.
Definition: mqtt_priv.h:48
Application layered TCP connection API (to be used from TCPIP thread) .
mqtt_incoming_data_cb_t data_cb
Incoming data callback.
Definition: mqtt_priv.h:91
void(* mqtt_connection_cb_t)(mqtt_client_t *client, void *arg, mqtt_connection_status_t status)
Function prototype for mqtt connection status callback.
Definition: mqtt.h:126
void(* mqtt_incoming_publish_cb_t)(void *arg, const char *topic, u32_t tot_len)
Function prototype for MQTT incoming publish function.
Definition: mqtt.h:161
void(* mqtt_incoming_data_cb_t)(void *arg, const u8_t *data, u16_t len, u8_t flags)
Function prototype for MQTT incoming publish data callback function.
Definition: mqtt.h:149
u16_t timeout_diff
Expire time relative to element before this.
Definition: mqtt_priv.h:59
u32_t msg_idx
Input.
Definition: mqtt_priv.h:94
#define MQTT_OUTPUT_RINGBUF_SIZE
Output ring-buffer size, must be able to fit largest outgoing publish message topic+payloads.
Definition: mqtt_opts.h:56
Ring buffer.
Definition: mqtt_priv.h:63
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.