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
6496a110
Commit
6496a110
authored
Apr 18, 2013
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MQTTAsync.c still used some MQTTCLIENT_ constants instead of MQTTASYNC_
parent
9eefdfc0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
36 deletions
+36
-36
MQTTAsync.c
src/MQTTAsync.c
+36
-36
No files found.
src/MQTTAsync.c
View file @
6496a110
...
...
@@ -1269,14 +1269,14 @@ void MQTTAsync_free(void* memory)
int
MQTTAsync_completeConnection
(
MQTTAsyncs
*
m
,
MQTTPacket
*
pack
)
{
int
rc
=
MQTT
CLIENT
_FAILURE
;
int
rc
=
MQTT
ASYNC
_FAILURE
;
FUNC_ENTRY
;
if
(
m
->
c
->
connect_state
==
3
)
/* MQTT connect sent - wait for CONNACK */
{
Connack
*
connack
=
(
Connack
*
)
pack
;
Log
(
LOG_PROTOCOL
,
1
,
NULL
,
m
->
c
->
net
.
socket
,
m
->
c
->
clientID
,
connack
->
rc
);
if
((
rc
=
connack
->
rc
)
==
MQTT
CLIENT
_SUCCESS
)
if
((
rc
=
connack
->
rc
)
==
MQTT
ASYNC
_SUCCESS
)
{
m
->
c
->
connected
=
1
;
m
->
c
->
good
=
1
;
...
...
@@ -1293,7 +1293,7 @@ int MQTTAsync_completeConnection(MQTTAsyncs* m, MQTTPacket* pack)
}
MQTTProtocol_retry
(
m
->
c
->
net
.
lastContact
,
1
);
if
(
m
->
c
->
connected
!=
1
)
rc
=
MQTT
CLIENT
_DISCONNECTED
;
rc
=
MQTT
ASYNC
_DISCONNECTED
;
}
}
else
...
...
@@ -1378,14 +1378,14 @@ thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
{
int
rc
=
MQTTAsync_completeConnection
(
m
,
pack
);
if
(
rc
==
MQTT
CLIENT
_SUCCESS
&&
m
->
connect
.
onSuccess
)
if
(
rc
==
MQTT
ASYNC
_SUCCESS
&&
m
->
connect
.
onSuccess
)
{
Log
(
TRACE_MIN
,
-
1
,
"Calling connect success for client %s"
,
m
->
c
->
clientID
);
Thread_unlock_mutex
(
mqttasync_mutex
);
(
*
(
m
->
connect
.
onSuccess
))(
m
->
connect
.
context
,
NULL
);
Thread_lock_mutex
(
mqttasync_mutex
);
}
else
if
(
rc
!=
MQTT
CLIENT
_SUCCESS
&&
m
->
connect
.
onFailure
)
else
if
(
rc
!=
MQTT
ASYNC
_SUCCESS
&&
m
->
connect
.
onFailure
)
{
MQTTAsync_failureData
data
;
...
...
@@ -1536,14 +1536,14 @@ int MQTTAsync_setCallbacks(MQTTAsync handle, void* context,
MQTTAsync_messageArrived
*
ma
,
MQTTAsync_deliveryComplete
*
dc
)
{
int
rc
=
MQTT
CLIENT
_SUCCESS
;
int
rc
=
MQTT
ASYNC
_SUCCESS
;
MQTTAsyncs
*
m
=
handle
;
FUNC_ENTRY
;
Thread_lock_mutex
(
mqttasync_mutex
);
if
(
m
==
NULL
||
ma
==
NULL
||
m
->
c
->
connect_state
!=
0
)
rc
=
MQTT
CLIENT
_FAILURE
;
rc
=
MQTT
ASYNC
_FAILURE
;
else
{
m
->
context
=
context
;
...
...
@@ -1862,30 +1862,30 @@ void Protocol_processPublication(Publish* publish, Clients* client)
int
MQTTAsync_connect
(
MQTTAsync
handle
,
MQTTAsync_connectOptions
*
options
)
{
MQTTAsyncs
*
m
=
handle
;
int
rc
=
MQTT
CLIENT
_SUCCESS
;
int
rc
=
MQTT
ASYNC
_SUCCESS
;
MQTTAsync_queuedCommand
*
conn
;
FUNC_ENTRY
;
if
(
options
==
NULL
)
{
rc
=
MQTT
CLIENT
_NULL_PARAMETER
;
rc
=
MQTT
ASYNC
_NULL_PARAMETER
;
goto
exit
;
}
if
(
strncmp
(
options
->
struct_id
,
"MQTC"
,
4
)
!=
0
||
(
options
->
struct_version
!=
0
&&
options
->
struct_version
!=
1
))
{
rc
=
MQTT
CLIENT
_BAD_STRUCTURE
;
rc
=
MQTT
ASYNC
_BAD_STRUCTURE
;
goto
exit
;
}
if
(
options
->
will
)
/* check validity of will options structure */
{
if
(
strncmp
(
options
->
will
->
struct_id
,
"MQTW"
,
4
)
!=
0
||
options
->
will
->
struct_version
!=
0
)
{
rc
=
MQTT
CLIENT
_BAD_STRUCTURE
;
rc
=
MQTT
ASYNC
_BAD_STRUCTURE
;
goto
exit
;
}
if
(
options
->
will
->
qos
<
0
||
options
->
will
->
qos
>
2
)
{
rc
=
MQTT
CLIENT
_BAD_QOS
;
rc
=
MQTT
ASYNC
_BAD_QOS
;
goto
exit
;
}
}
...
...
@@ -1893,14 +1893,14 @@ int MQTTAsync_connect(MQTTAsync handle, MQTTAsync_connectOptions* options)
{
if
(
strncmp
(
options
->
ssl
->
struct_id
,
"MQTS"
,
4
)
!=
0
||
options
->
ssl
->
struct_version
!=
0
)
{
rc
=
MQTT
CLIENT
_BAD_STRUCTURE
;
rc
=
MQTT
ASYNC
_BAD_STRUCTURE
;
goto
exit
;
}
}
if
((
options
->
username
&&
!
UTF8_validateString
(
options
->
username
))
||
(
options
->
password
&&
!
UTF8_validateString
(
options
->
password
)))
{
rc
=
MQTT
CLIENT
_BAD_UTF8_STRING
;
rc
=
MQTT
ASYNC
_BAD_UTF8_STRING
;
goto
exit
;
}
...
...
@@ -1983,18 +1983,18 @@ exit:
int
MQTTAsync_disconnect1
(
MQTTAsync
handle
,
MQTTAsync_disconnectOptions
*
options
,
int
internal
)
{
MQTTAsyncs
*
m
=
handle
;
int
rc
=
MQTT
CLIENT
_SUCCESS
;
int
rc
=
MQTT
ASYNC
_SUCCESS
;
MQTTAsync_queuedCommand
*
dis
;
FUNC_ENTRY
;
if
(
m
==
NULL
||
m
->
c
==
NULL
)
{
rc
=
MQTT
CLIENT
_FAILURE
;
rc
=
MQTT
ASYNC
_FAILURE
;
goto
exit
;
}
if
(
m
->
c
->
connected
==
0
)
{
rc
=
MQTT
CLIENT
_DISCONNECTED
;
rc
=
MQTT
ASYNC
_DISCONNECTED
;
goto
exit
;
}
...
...
@@ -2053,30 +2053,30 @@ int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char** topic, int* qos,
{
MQTTAsyncs
*
m
=
handle
;
int
i
=
0
;
int
rc
=
MQTT
CLIENT
_FAILURE
;
int
rc
=
MQTT
ASYNC
_FAILURE
;
MQTTAsync_queuedCommand
*
sub
;
FUNC_ENTRY
;
if
(
m
==
NULL
||
m
->
c
==
NULL
)
{
rc
=
MQTT
CLIENT
_FAILURE
;
rc
=
MQTT
ASYNC
_FAILURE
;
goto
exit
;
}
if
(
m
->
c
->
connected
==
0
)
{
rc
=
MQTT
CLIENT
_DISCONNECTED
;
rc
=
MQTT
ASYNC
_DISCONNECTED
;
goto
exit
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
!
UTF8_validateString
(
topic
[
i
]))
{
rc
=
MQTT
CLIENT
_BAD_UTF8_STRING
;
rc
=
MQTT
ASYNC
_BAD_UTF8_STRING
;
goto
exit
;
}
if
(
qos
[
i
]
<
0
||
qos
[
i
]
>
2
)
{
rc
=
MQTT
CLIENT
_BAD_QOS
;
rc
=
MQTT
ASYNC
_BAD_QOS
;
goto
exit
;
}
}
...
...
@@ -2130,12 +2130,12 @@ int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char** topic, MQTTAsy
FUNC_ENTRY
;
if
(
m
==
NULL
||
m
->
c
==
NULL
)
{
rc
=
MQTT
CLIENT
_FAILURE
;
rc
=
MQTT
ASYNC
_FAILURE
;
goto
exit
;
}
if
(
m
->
c
->
connected
==
0
)
{
rc
=
MQTT
CLIENT
_DISCONNECTED
;
rc
=
MQTT
ASYNC
_DISCONNECTED
;
goto
exit
;
}
...
...
@@ -2143,7 +2143,7 @@ int MQTTAsync_unsubscribeMany(MQTTAsync handle, int count, char** topic, MQTTAsy
{
if
(
!
UTF8_validateString
(
topic
[
i
]))
{
rc
=
MQTT
CLIENT
_BAD_UTF8_STRING
;
rc
=
MQTT
ASYNC
_BAD_UTF8_STRING
;
goto
exit
;
}
}
...
...
@@ -2188,20 +2188,20 @@ int MQTTAsync_unsubscribe(MQTTAsync handle, char* topic, MQTTAsync_responseOptio
int
MQTTAsync_send
(
MQTTAsync
handle
,
char
*
destinationName
,
int
payloadlen
,
void
*
payload
,
int
qos
,
int
retained
,
MQTTAsync_responseOptions
*
response
)
{
int
rc
=
MQTT
CLIENT
_SUCCESS
;
int
rc
=
MQTT
ASYNC
_SUCCESS
;
MQTTAsyncs
*
m
=
handle
;
MQTTAsync_queuedCommand
*
pub
;
FUNC_ENTRY
;
if
(
m
==
NULL
||
m
->
c
==
NULL
)
rc
=
MQTT
CLIENT
_FAILURE
;
rc
=
MQTT
ASYNC
_FAILURE
;
else
if
(
m
->
c
->
connected
==
0
)
rc
=
MQTT
CLIENT
_DISCONNECTED
;
rc
=
MQTT
ASYNC
_DISCONNECTED
;
else
if
(
!
UTF8_validateString
(
destinationName
))
rc
=
MQTT
CLIENT
_BAD_UTF8_STRING
;
rc
=
MQTT
ASYNC
_BAD_UTF8_STRING
;
else
if
(
qos
<
0
||
qos
>
2
)
rc
=
MQTT
CLIENT
_BAD_QOS
;
if
(
rc
!=
MQTT
CLIENT
_SUCCESS
)
rc
=
MQTT
ASYNC
_BAD_QOS
;
if
(
rc
!=
MQTT
ASYNC
_SUCCESS
)
goto
exit
;
/* Add publish request to operation queue */
...
...
@@ -2234,17 +2234,17 @@ exit:
int
MQTTAsync_sendMessage
(
MQTTAsync
handle
,
char
*
destinationName
,
MQTTAsync_message
*
message
,
MQTTAsync_responseOptions
*
response
)
{
int
rc
=
MQTT
CLIENT
_SUCCESS
;
int
rc
=
MQTT
ASYNC
_SUCCESS
;
FUNC_ENTRY
;
if
(
message
==
NULL
)
{
rc
=
MQTT
CLIENT
_NULL_PARAMETER
;
rc
=
MQTT
ASYNC
_NULL_PARAMETER
;
goto
exit
;
}
if
(
strncmp
(
message
->
struct_id
,
"MQTM"
,
4
)
!=
0
||
message
->
struct_version
!=
0
)
{
rc
=
MQTT
CLIENT
_BAD_STRUCTURE
;
rc
=
MQTT
ASYNC
_BAD_STRUCTURE
;
goto
exit
;
}
...
...
@@ -2480,7 +2480,7 @@ int pubCompare(void* a, void* b)
int
MQTTAsync_getPendingTokens
(
MQTTAsync
handle
,
MQTTAsync_token
**
tokens
)
{
int
rc
=
MQTT
CLIENT
_SUCCESS
;
int
rc
=
MQTT
ASYNC
_SUCCESS
;
MQTTAsyncs
*
m
=
handle
;
*
tokens
=
NULL
;
...
...
@@ -2489,7 +2489,7 @@ int MQTTAsync_getPendingTokens(MQTTAsync handle, MQTTAsync_token **tokens)
if
(
m
==
NULL
)
{
rc
=
MQTT
CLIENT
_FAILURE
;
rc
=
MQTT
ASYNC
_FAILURE
;
goto
exit
;
}
...
...
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