Network Services API  2.80.00.17
mqttserver.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2018, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
53 #ifndef ti_net_mqtt_MQTTServer__include
54 #define ti_net_mqtt_MQTTServer__include
55 
58 
59 //*****************************************************************************
60 // includes
61 //*****************************************************************************
62 #include <string.h>
63 #include <stdbool.h>
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
69 //*****************************************************************************
70 // typedefs
71 //*****************************************************************************
72 typedef enum
73 {
77 
78 typedef void (*MQTTServer_CallBack)(int32_t event, void *metaData, uint32_t metaDateLen, void *data, uint32_t dataLen);
79 typedef void *MQTTServer_Handle;
80 
82 {
83  char *topic;
85  uint8_t persistent;
87 
89 {
90  char *topic;
91  uint8_t persistent;
93 
94 
95 typedef enum
96 {
101 
102 /* Structure that holds parameters on the server for */
103 /* Authentication of Clients by the Server */
105 {
106  char *userName;
107  char *password;
109 
111 {
112  char *clientId;
113  int32_t clientIdLen;
114  char *userName;
115  int32_t usernameLen;
116  char *password;
117  int32_t passwordLen;
118  void **usr;
120 
122 {
123  const char *topic;
124  int32_t topLen;
125  bool dup;
126  uint8_t qos;
127  bool retain;
129 
131 {
132  char *user;
133  bool dueToErr;
135 
138 {
139  uint16_t port;
140  uint8_t method;
141  uint32_t cipher;
142  uint32_t nFiles;
143  char * const *secureFiles;
145 
146 typedef struct
147 {
148  MQTTServer_ConnParams *connParams; // pointer to connection param
150 
151 
152 //*****************************************************************************
153 // function prototypes
154 //*****************************************************************************
155 
167 int16_t MQTTServer_delete(MQTTServer_Handle handle);
168 
182 MQTTServer_Handle MQTTServer_create(MQTTServer_CallBack defaultCallback,
183  MQTTServer_Params *attrib);
184 
197 int16_t MQTTServer_run(MQTTServer_Handle handle);
198 
220 int16_t MQTTServer_subscribe(MQTTServer_Handle handle, MQTTServer_SubscribeParams *value, uint8_t numberOfTopics);
221 
234 int16_t MQTTServer_unsubscribe(MQTTServer_Handle handle, MQTTServer_UnSubscribeParams *value, uint8_t numberOfTopics);
235 
256 int16_t MQTTServer_publish(MQTTServer_Handle handle, char *topic, uint16_t topicLen, char *msg, uint16_t msgLen, uint32_t flags);
257 
272 int16_t MQTTServer_set(MQTTServer_Handle handle, uint16_t option, void *value, uint16_t valueLength);
273 
275 #ifdef __cplusplus
276 }
277 #endif
278 
279 #endif
bool retain
Definition: mqttserver.h:127
char * password
Definition: mqttserver.h:116
Definition: mqttserver.h:98
char * topic
Definition: mqttserver.h:83
int32_t usernameLen
Definition: mqttserver.h:115
MQTTServer_EventCB
Definition: mqttserver.h:95
char * topic
Definition: mqttserver.h:90
char * userName
Definition: mqttserver.h:106
struct _MQTTServer_UnSubscribeParams_ MQTTServer_UnSubscribeParams
void * MQTTServer_Handle
Definition: mqttserver.h:79
bool dueToErr
Definition: mqttserver.h:133
MQTTServer_Handle MQTTServer_create(MQTTServer_CallBack defaultCallback, MQTTServer_Params *attrib)
MQTTServer_CallBack callback
Definition: mqttserver.h:84
struct _MQTTServer_SubscribeParams_ MQTTServer_SubscribeParams
char * userName
Definition: mqttserver.h:114
int16_t MQTTServer_subscribe(MQTTServer_Handle handle, MQTTServer_SubscribeParams *value, uint8_t numberOfTopics)
Definition: mqttserver.h:137
MQTTServer_Option
Definition: mqttserver.h:72
uint8_t persistent
Definition: mqttserver.h:85
Definition: mqttserver.h:99
char * password
Definition: mqttserver.h:107
Definition: mqttserver.h:146
uint8_t qos
Definition: mqttserver.h:126
Definition: mqttserver.h:74
int16_t MQTTServer_set(MQTTServer_Handle handle, uint16_t option, void *value, uint16_t valueLength)
void(* MQTTServer_CallBack)(int32_t event, void *metaData, uint32_t metaDateLen, void *data, uint32_t dataLen)
Definition: mqttserver.h:78
Definition: mqttserver.h:81
struct _MQTTServer_DisconnectMetaDataCB_ MQTTServer_DisconnectMetaDataCB
int32_t clientIdLen
Definition: mqttserver.h:113
struct _MQTTServer_LocalAuthenticationData_ MQTTServer_LocalAuthenticationData
Definition: mqttserver.h:97
char *const * secureFiles
Definition: mqttserver.h:143
Definition: mqttserver.h:110
uint32_t cipher
Definition: mqttserver.h:141
int16_t MQTTServer_unsubscribe(MQTTServer_Handle handle, MQTTServer_UnSubscribeParams *value, uint8_t numberOfTopics)
uint32_t nFiles
Definition: mqttserver.h:142
Definition: mqttserver.h:104
int16_t MQTTServer_delete(MQTTServer_Handle handle)
MQTTServer_ConnParams * connParams
Definition: mqttserver.h:148
Definition: mqttserver.h:75
int16_t MQTTServer_run(MQTTServer_Handle handle)
uint8_t persistent
Definition: mqttserver.h:91
char * user
Definition: mqttserver.h:132
uint16_t port
Definition: mqttserver.h:139
uint8_t method
Definition: mqttserver.h:140
Definition: mqttserver.h:121
int32_t passwordLen
Definition: mqttserver.h:117
int16_t MQTTServer_publish(MQTTServer_Handle handle, char *topic, uint16_t topicLen, char *msg, uint16_t msgLen, uint32_t flags)
bool dup
Definition: mqttserver.h:125
struct _MQTTServer_ConnectMetaDataCB_ MQTTServer_ConnectMetaDataCB
void ** usr
Definition: mqttserver.h:118
int32_t topLen
Definition: mqttserver.h:124
struct _MQTTServer_RecvMetaDataCB_ MQTTServer_RecvMetaDataCB
Definition: mqttserver.h:130
const char * topic
Definition: mqttserver.h:123
Definition: mqttserver.h:88
char * clientId
Definition: mqttserver.h:112
struct _MQTTServer_ConnParams_ MQTTServer_ConnParams
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale