Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
mqtt_priv.h
00001 /** 00002 * @file 00003 * MQTT client (private interface) 00004 */ 00005 00006 /* 00007 * Copyright (c) 2016 Erik Andersson 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without modification, 00011 * are permitted provided that the following conditions are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. The name of the author may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00024 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00026 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00029 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00030 * OF SUCH DAMAGE. 00031 * 00032 * This file is part of the lwIP TCP/IP stack. 00033 * 00034 * Author: Erik Andersson 00035 * 00036 */ 00037 #ifndef LWIP_HDR_APPS_MQTT_PRIV_H 00038 #define LWIP_HDR_APPS_MQTT_PRIV_H 00039 00040 #include "lwip/apps/mqtt.h" 00041 #include "lwip/altcp.h" 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00047 /** Pending request item, binds application callback to pending server requests */ 00048 struct mqtt_request_t 00049 { 00050 /** Next item in list, NULL means this is the last in chain, 00051 next pointing at itself means request is unallocated */ 00052 struct mqtt_request_t *next; 00053 /** Callback to upper layer */ 00054 mqtt_request_cb_t cb; 00055 void *arg; 00056 /** MQTT packet identifier */ 00057 u16_t pkt_id; 00058 /** Expire time relative to element before this */ 00059 u16_t timeout_diff; 00060 }; 00061 00062 /** Ring buffer */ 00063 struct mqtt_ringbuf_t { 00064 u16_t put; 00065 u16_t get; 00066 u8_t buf[MQTT_OUTPUT_RINGBUF_SIZE]; 00067 }; 00068 00069 /** MQTT client */ 00070 struct mqtt_client_s 00071 { 00072 /** Timers and timeouts */ 00073 u16_t cyclic_tick; 00074 u16_t keep_alive; 00075 u16_t server_watchdog; 00076 /** Packet identifier generator*/ 00077 u16_t pkt_id_seq; 00078 /** Packet identifier of pending incoming publish */ 00079 u16_t inpub_pkt_id; 00080 /** Connection state */ 00081 u8_t conn_state; 00082 struct altcp_pcb *conn; 00083 /** Connection callback */ 00084 void *connect_arg; 00085 mqtt_connection_cb_t connect_cb; 00086 /** Pending requests to server */ 00087 struct mqtt_request_t *pend_req_queue; 00088 struct mqtt_request_t req_list[MQTT_REQ_MAX_IN_FLIGHT]; 00089 void *inpub_arg; 00090 /** Incoming data callback */ 00091 mqtt_incoming_data_cb_t data_cb; 00092 mqtt_incoming_publish_cb_t pub_cb; 00093 /** Input */ 00094 u32_t msg_idx; 00095 u8_t rx_buffer[MQTT_VAR_HEADER_BUFFER_LEN]; 00096 /** Output ring-buffer */ 00097 struct mqtt_ringbuf_t output; 00098 }; 00099 00100 #ifdef __cplusplus 00101 } 00102 #endif 00103 00104 #endif /* LWIP_HDR_APPS_MQTT_PRIV_H */
Generated on Tue Jul 12 2022 13:54:35 by
