Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
paho.mqtt.c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eclipse
paho.mqtt.c
Commits
149a9ea2
Commit
149a9ea2
authored
Jun 28, 2017
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change global init parameter to structure, issue #136
parent
dd6f1b7c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
670 additions
and
640 deletions
+670
-640
MQTTAsync.c
src/MQTTAsync.c
+4
-4
MQTTAsync.h
src/MQTTAsync.h
+324
-309
MQTTClient.c
src/MQTTClient.c
+30
-30
MQTTClient.h
src/MQTTClient.h
+312
-297
No files found.
src/MQTTAsync.c
View file @
149a9ea2
...
@@ -66,10 +66,10 @@
...
@@ -66,10 +66,10 @@
const
char
*
client_timestamp_eye
=
"MQTTAsyncV3_Timestamp "
BUILD_TIMESTAMP
;
const
char
*
client_timestamp_eye
=
"MQTTAsyncV3_Timestamp "
BUILD_TIMESTAMP
;
const
char
*
client_version_eye
=
"MQTTAsyncV3_Version "
CLIENT_VERSION
;
const
char
*
client_version_eye
=
"MQTTAsyncV3_Version "
CLIENT_VERSION
;
void
MQTTAsync_global_init
(
int
handle_openssl_init
)
void
MQTTAsync_global_init
(
MQTTAsync_init_options
*
inits
)
{
{
#if defined(OPENSSL)
#if defined(OPENSSL)
SSLSocket_handleOpensslInit
(
handle
_openssl_init
);
SSLSocket_handleOpensslInit
(
inits
->
do
_openssl_init
);
#endif
#endif
}
}
...
...
src/MQTTAsync.h
View file @
149a9ea2
...
@@ -184,12 +184,27 @@
...
@@ -184,12 +184,27 @@
*/
*/
#define MQTT_BAD_SUBSCRIBE 0x80
#define MQTT_BAD_SUBSCRIBE 0x80
/**
* Initialization options
*/
typedef
struct
{
/** The eyecatcher for this structure. Must be MQTG. */
char
struct_id
[
4
];
/** The version number of this structure. Must be 0 */
int
struct_version
;
/** 1 = we do openssl init, 0 = leave it to the application */
int
do_openssl_init
;
}
MQTTAsync_init_options
;
#define MQTTAsync_init_options_initializer { {'M', 'Q', 'T', 'G'}, 0, 0 }
/**
/**
* Global init of mqtt library. Call once on program start to set global behaviour.
* Global init of mqtt library. Call once on program start to set global behaviour.
* handle_openssl_init - if mqtt library should handle openssl init (1) or rely on the caller to init it before using mqtt (0)
* handle_openssl_init - if mqtt library should handle openssl init (1) or rely on the caller to init it before using mqtt (0)
*/
*/
void
MQTTAsync_global_init
(
int
handle_openssl_init
);
void
MQTTAsync_global_init
(
MQTTAsync_init_options
*
inits
);
/**
/**
* A handle representing an MQTT client. A valid client handle is available
* A handle representing an MQTT client. A valid client handle is available
...
...
src/MQTTClient.c
View file @
149a9ea2
...
@@ -73,10 +73,10 @@
...
@@ -73,10 +73,10 @@
const
char
*
client_timestamp_eye
=
"MQTTClientV3_Timestamp "
BUILD_TIMESTAMP
;
const
char
*
client_timestamp_eye
=
"MQTTClientV3_Timestamp "
BUILD_TIMESTAMP
;
const
char
*
client_version_eye
=
"MQTTClientV3_Version "
CLIENT_VERSION
;
const
char
*
client_version_eye
=
"MQTTClientV3_Version "
CLIENT_VERSION
;
void
MQTTClient_global_init
(
int
handle_openssl_init
)
void
MQTTClient_global_init
(
MQTTClient_init_options
*
inits
)
{
{
#if defined(OPENSSL)
#if defined(OPENSSL)
SSLSocket_handleOpensslInit
(
handle
_openssl_init
);
SSLSocket_handleOpensslInit
(
inits
->
do
_openssl_init
);
#endif
#endif
}
}
...
...
src/MQTTClient.h
View file @
149a9ea2
...
@@ -189,11 +189,26 @@
...
@@ -189,11 +189,26 @@
*/
*/
#define MQTT_BAD_SUBSCRIBE 0x80
#define MQTT_BAD_SUBSCRIBE 0x80
/**
* Initialization options
*/
typedef
struct
{
/** The eyecatcher for this structure. Must be MQTG. */
char
struct_id
[
4
];
/** The version number of this structure. Must be 0 */
int
struct_version
;
/** 1 = we do openssl init, 0 = leave it to the application */
int
do_openssl_init
;
}
MQTTClient_init_options
;
#define MQTTClient_init_options_initializer { {'M', 'Q', 'T', 'G'}, 0, 0 }
/**
/**
* Global init of mqtt library. Call once on program start to set global behaviour.
* Global init of mqtt library. Call once on program start to set global behaviour.
*
handle_openssl_init - if mqtt library should handle openssl init (1) or rely on the caller to init it before using mqtt
(0)
*
do_openssl_init - if mqtt library should initialize OpenSSL (1) or rely on the caller to do it before using the library
(0)
*/
*/
void
MQTTClient_global_init
(
int
handle_openssl_init
);
void
MQTTClient_global_init
(
MQTTClient_init_options
*
inits
);
/**
/**
* A handle representing an MQTT client. A valid client handle is available
* A handle representing an MQTT client. A valid client handle is available
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment