Paho Asynchronous MQTT C Client Library
MQTTProperties.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2017, 2018 IBM Corp.
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * and Eclipse Distribution License v1.0 which accompany this distribution.
7  *
8  * The Eclipse Public License is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  * and the Eclipse Distribution License is available at
11  * http://www.eclipse.org/org/documents/edl-v10.php.
12  *
13  * Contributors:
14  * Ian Craggs - initial API and implementation and/or initial documentation
15  *******************************************************************************/
16 
17 #if !defined(MQTTPROPERTIES_H)
18 #define MQTTPROPERTIES_H
19 
20 #define MQTT_INVALID_PROPERTY_ID -2
21 
51 };
52 
53 #if defined(WIN32) || defined(WIN64)
54  #define DLLImport __declspec(dllimport)
55  #define DLLExport __declspec(dllexport)
56 #else
57  #define DLLImport extern
58  #define DLLExport __attribute__ ((visibility ("default")))
59 #endif
60 
67 DLLExport const char* MQTTPropertyName(enum MQTTPropertyCodes value);
68 
78 };
79 
86 
90 typedef struct
91 {
92  int len;
93  char* data;
95 
96 
100 typedef struct
101 {
102  enum MQTTPropertyCodes identifier;
104  union {
105  char byte;
106  short integer2;
107  int integer4;
108  struct {
111  };
112  } value;
113 } MQTTProperty;
114 
118 typedef struct MQTTProperties
119 {
120  int count;
121  int max_count;
122  int length;
125 
126 #define MQTTProperties_initializer {0, 0, 0, NULL}
127 
134 
142 
149 int MQTTProperties_write(char** pptr, const MQTTProperties* properties);
150 
158 int MQTTProperties_read(MQTTProperties* properties, char** pptr, char* enddata);
159 
165 
172 
180 
189 
197 
207 
215 
224 
225 #endif /* MQTTPROPERTIES_H */
MQTTPROPERTY_CODE_SHARED_SUBSCRIPTION_AVAILABLE
@ MQTTPROPERTY_CODE_SHARED_SUBSCRIPTION_AVAILABLE
Definition: MQTTProperties.h:50
MQTTProperties_getProperty
MQTTProperty * MQTTProperties_getProperty(MQTTProperties *props, enum MQTTPropertyCodes propid)
MQTTPROPERTY_CODE_SUBSCRIPTION_IDENTIFIERS_AVAILABLE
@ MQTTPROPERTY_CODE_SUBSCRIPTION_IDENTIFIERS_AVAILABLE
Definition: MQTTProperties.h:49
MQTTPROPERTY_CODE_SUBSCRIPTION_IDENTIFIER
@ MQTTPROPERTY_CODE_SUBSCRIPTION_IDENTIFIER
Definition: MQTTProperties.h:29
MQTTPROPERTY_TYPE_BINARY_DATA
@ MQTTPROPERTY_TYPE_BINARY_DATA
Definition: MQTTProperties.h:75
MQTTProperties_len
int MQTTProperties_len(MQTTProperties *props)
MQTTProperties
struct MQTTProperties MQTTProperties
MQTTProperties::length
int length
Definition: MQTTProperties.h:122
MQTTPROPERTY_CODE_TOPIC_ALIAS_MAXIMUM
@ MQTTPROPERTY_CODE_TOPIC_ALIAS_MAXIMUM
Definition: MQTTProperties.h:42
MQTTProperty::integer4
int integer4
Definition: MQTTProperties.h:107
MQTTProperties_propertyCount
int MQTTProperties_propertyCount(MQTTProperties *props, enum MQTTPropertyCodes propid)
MQTTPROPERTY_CODE_SERVER_REFERENCE
@ MQTTPROPERTY_CODE_SERVER_REFERENCE
Definition: MQTTProperties.h:39
MQTTProperties
Definition: MQTTProperties.h:118
MQTTPROPERTY_CODE_RESPONSE_TOPIC
@ MQTTPROPERTY_CODE_RESPONSE_TOPIC
Definition: MQTTProperties.h:27
MQTTPROPERTY_CODE_WILL_DELAY_INTERVAL
@ MQTTPROPERTY_CODE_WILL_DELAY_INTERVAL
Definition: MQTTProperties.h:36
MQTTProperties::count
int count
Definition: MQTTProperties.h:120
MQTTProperties_getNumericValue
int MQTTProperties_getNumericValue(MQTTProperties *props, enum MQTTPropertyCodes propid)
MQTTProperty::byte
char byte
Definition: MQTTProperties.h:105
MQTTPROPERTY_CODE_SERVER_KEEP_ALIVE
@ MQTTPROPERTY_CODE_SERVER_KEEP_ALIVE
Definition: MQTTProperties.h:32
MQTTProperties_write
int MQTTProperties_write(char **pptr, const MQTTProperties *properties)
MQTTPROPERTY_TYPE_TWO_BYTE_INTEGER
@ MQTTPROPERTY_TYPE_TWO_BYTE_INTEGER
Definition: MQTTProperties.h:72
MQTTProperties_getPropertyAt
MQTTProperty * MQTTProperties_getPropertyAt(MQTTProperties *props, enum MQTTPropertyCodes propid, int index)
MQTTProperties_copy
MQTTProperties MQTTProperties_copy(const MQTTProperties *props)
MQTTPROPERTY_TYPE_UTF_8_STRING_PAIR
@ MQTTPROPERTY_TYPE_UTF_8_STRING_PAIR
Definition: MQTTProperties.h:77
MQTTPropertyCodes
MQTTPropertyCodes
Definition: MQTTProperties.h:23
MQTTPROPERTY_CODE_RECEIVE_MAXIMUM
@ MQTTPROPERTY_CODE_RECEIVE_MAXIMUM
Definition: MQTTProperties.h:41
MQTTLenString::data
char * data
Definition: MQTTProperties.h:93
MQTTProperty::value
MQTTLenString value
Definition: MQTTProperties.h:110
MQTTProperties::max_count
int max_count
Definition: MQTTProperties.h:121
MQTTPROPERTY_CODE_MAXIMUM_QOS
@ MQTTPROPERTY_CODE_MAXIMUM_QOS
Definition: MQTTProperties.h:44
MQTTProperty::integer2
short integer2
Definition: MQTTProperties.h:106
MQTTProperty::data
MQTTLenString data
Definition: MQTTProperties.h:109
MQTTPROPERTY_CODE_CONTENT_TYPE
@ MQTTPROPERTY_CODE_CONTENT_TYPE
Definition: MQTTProperties.h:26
MQTTPropertyName
const char * MQTTPropertyName(enum MQTTPropertyCodes value)
MQTTProperty_getType
int MQTTProperty_getType(enum MQTTPropertyCodes value)
MQTTPROPERTY_TYPE_FOUR_BYTE_INTEGER
@ MQTTPROPERTY_TYPE_FOUR_BYTE_INTEGER
Definition: MQTTProperties.h:73
MQTTLenString::len
int len
Definition: MQTTProperties.h:92
MQTTPROPERTY_CODE_CORRELATION_DATA
@ MQTTPROPERTY_CODE_CORRELATION_DATA
Definition: MQTTProperties.h:28
MQTTPROPERTY_CODE_REQUEST_PROBLEM_INFORMATION
@ MQTTPROPERTY_CODE_REQUEST_PROBLEM_INFORMATION
Definition: MQTTProperties.h:35
MQTTProperties::array
MQTTProperty * array
Definition: MQTTProperties.h:123
MQTTPROPERTY_CODE_ASSIGNED_CLIENT_IDENTIFER
@ MQTTPROPERTY_CODE_ASSIGNED_CLIENT_IDENTIFER
Definition: MQTTProperties.h:31
MQTTPROPERTY_CODE_WILDCARD_SUBSCRIPTION_AVAILABLE
@ MQTTPROPERTY_CODE_WILDCARD_SUBSCRIPTION_AVAILABLE
Definition: MQTTProperties.h:48
MQTTProperties_hasProperty
int MQTTProperties_hasProperty(MQTTProperties *props, enum MQTTPropertyCodes propid)
MQTTProperty
Definition: MQTTProperties.h:100
MQTTPROPERTY_CODE_RETAIN_AVAILABLE
@ MQTTPROPERTY_CODE_RETAIN_AVAILABLE
Definition: MQTTProperties.h:45
MQTTPROPERTY_CODE_REQUEST_RESPONSE_INFORMATION
@ MQTTPROPERTY_CODE_REQUEST_RESPONSE_INFORMATION
Definition: MQTTProperties.h:37
MQTTPROPERTY_CODE_AUTHENTICATION_METHOD
@ MQTTPROPERTY_CODE_AUTHENTICATION_METHOD
Definition: MQTTProperties.h:33
MQTTPROPERTY_TYPE_UTF_8_ENCODED_STRING
@ MQTTPROPERTY_TYPE_UTF_8_ENCODED_STRING
Definition: MQTTProperties.h:76
MQTTProperties_read
int MQTTProperties_read(MQTTProperties *properties, char **pptr, char *enddata)
DLLExport
#define DLLExport
Definition: MQTTProperties.h:58
MQTTPROPERTY_CODE_TOPIC_ALIAS
@ MQTTPROPERTY_CODE_TOPIC_ALIAS
Definition: MQTTProperties.h:43
MQTTPROPERTY_TYPE_BYTE
@ MQTTPROPERTY_TYPE_BYTE
Definition: MQTTProperties.h:71
MQTTProperties_free
void MQTTProperties_free(MQTTProperties *properties)
MQTTPROPERTY_CODE_MESSAGE_EXPIRY_INTERVAL
@ MQTTPROPERTY_CODE_MESSAGE_EXPIRY_INTERVAL
Definition: MQTTProperties.h:25
MQTTPROPERTY_CODE_AUTHENTICATION_DATA
@ MQTTPROPERTY_CODE_AUTHENTICATION_DATA
Definition: MQTTProperties.h:34
MQTTPROPERTY_TYPE_VARIABLE_BYTE_INTEGER
@ MQTTPROPERTY_TYPE_VARIABLE_BYTE_INTEGER
Definition: MQTTProperties.h:74
MQTTPROPERTY_CODE_USER_PROPERTY
@ MQTTPROPERTY_CODE_USER_PROPERTY
Definition: MQTTProperties.h:46
MQTTPROPERTY_CODE_REASON_STRING
@ MQTTPROPERTY_CODE_REASON_STRING
Definition: MQTTProperties.h:40
MQTTPropertyTypes
MQTTPropertyTypes
Definition: MQTTProperties.h:70
MQTTPROPERTY_CODE_RESPONSE_INFORMATION
@ MQTTPROPERTY_CODE_RESPONSE_INFORMATION
Definition: MQTTProperties.h:38
MQTTPROPERTY_CODE_PAYLOAD_FORMAT_INDICATOR
@ MQTTPROPERTY_CODE_PAYLOAD_FORMAT_INDICATOR
Definition: MQTTProperties.h:24
MQTTLenString
Definition: MQTTProperties.h:90
MQTTPROPERTY_CODE_SESSION_EXPIRY_INTERVAL
@ MQTTPROPERTY_CODE_SESSION_EXPIRY_INTERVAL
Definition: MQTTProperties.h:30
MQTTProperties_getNumericValueAt
int MQTTProperties_getNumericValueAt(MQTTProperties *props, enum MQTTPropertyCodes propid, int index)
MQTTProperties_add
int MQTTProperties_add(MQTTProperties *props, const MQTTProperty *prop)
MQTTPROPERTY_CODE_MAXIMUM_PACKET_SIZE
@ MQTTPROPERTY_CODE_MAXIMUM_PACKET_SIZE
Definition: MQTTProperties.h:47