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
7c30485c
Commit
7c30485c
authored
Mar 03, 2014
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update header commments for 3.1.1 updates
parent
28e3c018
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
125 additions
and
96 deletions
+125
-96
MQTTAsync.c
src/MQTTAsync.c
+13
-13
MQTTClient.c
src/MQTTClient.c
+10
-9
MQTTPacket.c
src/MQTTPacket.c
+2
-1
MQTTPacketOut.c
src/MQTTPacketOut.c
+14
-13
MQTTPacketOut.h
src/MQTTPacketOut.h
+2
-1
MQTTProtocolOut.c
src/MQTTProtocolOut.c
+3
-2
MQTTProtocolOut.h
src/MQTTProtocolOut.h
+2
-1
test1.c
test/test1.c
+17
-12
test3.c
test/test3.c
+15
-11
test4.c
test/test4.c
+16
-11
test5.c
test/test5.c
+16
-11
test6.c
test/test6.c
+15
-11
No files found.
src/MQTTAsync.c
View file @
7c30485c
/*******************************************************************************
* Copyright (c) 2009, 201
3
IBM Corp.
* Copyright (c) 2009, 201
4
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -18,6 +18,7 @@
* Ian Craggs - fix for bug# 415042 - using already freed structure
* Ian Craggs - fix for bug 419233 - mutexes not reporting errors
* Ian Craggs - fix for bug #420851
* Ian Craggs - MQTT 3.1.1 support
*******************************************************************************/
/**
...
...
@@ -976,12 +977,11 @@ void MQTTAsync_processCommand()
if
(
command
->
command
.
details
.
conn
.
serverURIcount
>
0
)
{
if
(
command
->
command
.
details
.
conn
.
MQTTVersion
==
3
)
{
command
->
command
.
details
.
conn
.
currentURI
++
;
command
->
command
.
details
.
conn
.
MQTTVersion
=
4
;
}
if
(
command
->
command
.
details
.
conn
.
MQTTVersion
==
3
)
{
command
->
command
.
details
.
conn
.
currentURI
++
;
command
->
command
.
details
.
conn
.
MQTTVersion
=
4
;
}
serverURI
=
command
->
command
.
details
.
conn
.
serverURIs
[
command
->
command
.
details
.
conn
.
currentURI
];
if
(
strncmp
(
URI_TCP
,
serverURI
,
strlen
(
URI_TCP
))
==
0
)
...
...
@@ -1175,7 +1175,7 @@ void MQTTAsync_checkTimeouts()
/* check connect timeout */
if
(
m
->
c
->
connect_state
!=
0
&&
MQTTAsync_elapsed
(
m
->
connect
.
start_time
)
>
(
m
->
connect
.
details
.
conn
.
timeout
*
1000
))
{
if
(
MQTTAsync_checkConn
(
&
m
->
connect
))
if
(
MQTTAsync_checkConn
(
&
m
->
connect
))
{
MQTTAsync_queuedCommand
*
conn
;
...
...
@@ -1185,7 +1185,7 @@ void MQTTAsync_checkTimeouts()
memset
(
conn
,
'\0'
,
sizeof
(
MQTTAsync_queuedCommand
));
conn
->
client
=
m
;
conn
->
command
=
m
->
connect
;
Log
(
TRACE_MIN
,
-
1
,
"Connect failed, more to try"
);
Log
(
TRACE_MIN
,
-
1
,
"Connect failed, more to try"
);
MQTTAsync_addCommand
(
conn
,
sizeof
(
m
->
connect
));
}
else
...
...
@@ -1508,7 +1508,7 @@ thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
}
else
{
if
(
MQTTAsync_checkConn
(
&
m
->
connect
))
if
(
MQTTAsync_checkConn
(
&
m
->
connect
))
{
MQTTAsync_queuedCommand
*
conn
;
...
...
@@ -2572,7 +2572,7 @@ int MQTTAsync_connecting(MQTTAsyncs* m)
exit:
if
((
rc
!=
0
&&
m
->
c
->
connect_state
!=
2
)
||
(
rc
==
SSL_FATAL
))
{
if
(
MQTTAsync_checkConn
(
&
m
->
connect
))
if
(
MQTTAsync_checkConn
(
&
m
->
connect
))
{
MQTTAsync_queuedCommand
*
conn
;
...
...
@@ -2650,7 +2650,7 @@ MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc)
if
((
m
->
c
->
connect_state
==
3
)
&&
(
*
rc
==
SOCKET_ERROR
))
{
Log
(
TRACE_MINIMUM
,
-
1
,
"CONNECT sent but MQTTPacket_Factory has returned SOCKET_ERROR"
);
if
(
MQTTAsync_checkConn
(
&
m
->
connect
))
if
(
MQTTAsync_checkConn
(
&
m
->
connect
))
{
MQTTAsync_queuedCommand
*
conn
;
...
...
@@ -2660,7 +2660,7 @@ MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc)
memset
(
conn
,
'\0'
,
sizeof
(
MQTTAsync_queuedCommand
));
conn
->
client
=
m
;
conn
->
command
=
m
->
connect
;
Log
(
TRACE_MIN
,
-
1
,
"Connect failed, more to try"
);
Log
(
TRACE_MIN
,
-
1
,
"Connect failed, more to try"
);
MQTTAsync_addCommand
(
conn
,
sizeof
(
m
->
connect
));
}
else
...
...
src/MQTTClient.c
View file @
7c30485c
/*******************************************************************************
* Copyright (c) 2009, 201
3
IBM Corp.
* Copyright (c) 2009, 201
4
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -20,6 +20,7 @@
* Ian Craggs - fix for bug 421103 - trying to write to same socket, in publish/retries
* Ian Craggs - fix for bug 419233 - mutexes not reporting errors
* Ian Craggs - fix for bug #420851
* Ian Craggs - MQTT 3.1.1 support
*******************************************************************************/
/**
...
...
@@ -788,7 +789,7 @@ int MQTTClient_connectURIVersion(MQTTClient handle, MQTTClient_connectOptions* o
goto
exit
;
}
else
if
(
rc
==
1
)
{
{
rc
=
MQTTCLIENT_SUCCESS
;
m
->
c
->
connect_state
=
3
;
if
(
MQTTPacket_send_connect
(
m
->
c
,
MQTTVersion
)
==
SOCKET_ERROR
)
...
...
@@ -796,7 +797,7 @@ int MQTTClient_connectURIVersion(MQTTClient handle, MQTTClient_connectOptions* o
rc
=
SOCKET_ERROR
;
goto
exit
;
}
if
(
!
m
->
c
->
cleansession
&&
m
->
c
->
session
==
NULL
)
if
(
!
m
->
c
->
cleansession
&&
m
->
c
->
session
==
NULL
)
m
->
c
->
session
=
SSL_get1_session
(
m
->
c
->
net
.
ssl
);
}
}
...
...
@@ -885,7 +886,7 @@ exit:
if
(
rc
!=
MQTTCLIENT_SUCCESS
)
{
Thread_unlock_mutex
(
mqttclient_mutex
);
MQTTClient_disconnect1
(
handle
,
0
,
0
,
(
MQTTVersion
==
3
));
/* not "internal" because we don't want to call connection lost */
MQTTClient_disconnect1
(
handle
,
0
,
0
,
(
MQTTVersion
==
3
));
/* not "internal" because we don't want to call connection lost */
Thread_lock_mutex
(
mqttclient_mutex
);
}
FUNC_EXIT_RC
(
rc
);
...
...
@@ -981,8 +982,8 @@ int MQTTClient_connectURI(MQTTClient handle, MQTTClient_connectOptions* options,
m
->
c
->
password
=
options
->
password
;
m
->
c
->
retryInterval
=
options
->
retryInterval
;
if
((
rc
=
MQTTClient_connectURIVersion
(
handle
,
options
,
serverURI
,
4
,
start
,
millisecsTimeout
))
!=
MQTTCLIENT_SUCCESS
)
rc
=
MQTTClient_connectURIVersion
(
handle
,
options
,
serverURI
,
3
,
start
,
millisecsTimeout
);
if
((
rc
=
MQTTClient_connectURIVersion
(
handle
,
options
,
serverURI
,
4
,
start
,
millisecsTimeout
))
!=
MQTTCLIENT_SUCCESS
)
rc
=
MQTTClient_connectURIVersion
(
handle
,
options
,
serverURI
,
3
,
start
,
millisecsTimeout
);
FUNC_EXIT_RC
(
rc
);
return
rc
;
...
...
@@ -1113,15 +1114,15 @@ int MQTTClient_disconnect1(MQTTClient handle, int timeout, int internal, int sto
if
(
Thread_check_sem
(
m
->
connect_sem
))
Thread_post_sem
(
m
->
connect_sem
);
if
(
Thread_check_sem
(
m
->
connack_sem
))
Thread_post_sem
(
m
->
connect_sem
);
Thread_post_sem
(
m
->
connect_sem
);
if
(
Thread_check_sem
(
m
->
suback_sem
))
Thread_post_sem
(
m
->
suback_sem
);
if
(
Thread_check_sem
(
m
->
unsuback_sem
))
Thread_post_sem
(
m
->
unsuback_sem
);
exit:
if
(
stop
)
MQTTClient_stop
();
if
(
stop
)
MQTTClient_stop
();
if
(
internal
&&
m
->
cl
&&
was_connected
)
{
Log
(
TRACE_MIN
,
-
1
,
"Calling connectionLost for client %s"
,
m
->
c
->
clientID
);
...
...
src/MQTTPacket.c
View file @
7c30485c
/*******************************************************************************
* Copyright (c) 2009, 201
3
IBM Corp.
* Copyright (c) 2009, 201
4
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -13,6 +13,7 @@
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs, Allan Stockdill-Mander - SSL updates
* Ian Craggs - MQTT 3.1.1 support
*******************************************************************************/
/**
...
...
src/MQTTPacketOut.c
View file @
7c30485c
/*******************************************************************************
* Copyright (c) 2009, 201
3
IBM Corp.
* Copyright (c) 2009, 201
4
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -13,6 +13,7 @@
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs, Allan Stockdill-Mander - SSL updates
* Ian Craggs - MQTT 3.1.1 support
*******************************************************************************/
/**
...
...
@@ -58,18 +59,18 @@ int MQTTPacket_send_connect(Clients* client, int MQTTVersion)
len
+=
strlen
(
client
->
password
)
+
2
;
ptr
=
buf
=
malloc
(
len
);
if
(
MQTTVersion
==
3
)
{
writeUTF
(
&
ptr
,
"MQIsdp"
);
writeChar
(
&
ptr
,
(
char
)
3
);
}
else
if
(
MQTTVersion
==
4
)
{
writeUTF
(
&
ptr
,
"MQTT"
);
writeChar
(
&
ptr
,
(
char
)
4
);
}
else
goto
exit
;
if
(
MQTTVersion
==
3
)
{
writeUTF
(
&
ptr
,
"MQIsdp"
);
writeChar
(
&
ptr
,
(
char
)
3
);
}
else
if
(
MQTTVersion
==
4
)
{
writeUTF
(
&
ptr
,
"MQTT"
);
writeChar
(
&
ptr
,
(
char
)
4
);
}
else
goto
exit
;
packet
.
flags
.
all
=
0
;
packet
.
flags
.
bits
.
cleanstart
=
client
->
cleansession
;
...
...
src/MQTTPacketOut.h
View file @
7c30485c
/*******************************************************************************
* Copyright (c) 2009, 201
3
IBM Corp.
* Copyright (c) 2009, 201
4
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -13,6 +13,7 @@
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs, Allan Stockdill-Mander - SSL updates
* Ian Craggs - MQTT 3.1.1 support
*******************************************************************************/
#if !defined(MQTTPACKETOUT_H)
...
...
src/MQTTProtocolOut.c
View file @
7c30485c
/*******************************************************************************
* Copyright (c) 2009, 201 IBM Corp.
* Copyright (c) 2009, 201
4
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -13,6 +13,7 @@
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs, Allan Stockdill-Mander - SSL updates
* Ian Craggs - MQTT 3.1.1 support
*******************************************************************************/
/**
...
...
@@ -117,7 +118,7 @@ int MQTTProtocol_connect(char* ip_address, Clients* aClient, int ssl, int MQTTVe
if
(
rc
==
0
)
{
/* Now send the MQTT connect packet */
if
((
rc
=
MQTTPacket_send_connect
(
aClient
,
MQTTVersion
))
==
0
)
if
((
rc
=
MQTTPacket_send_connect
(
aClient
,
MQTTVersion
))
==
0
)
aClient
->
connect_state
=
3
;
/* MQTT Connect sent - wait for CONNACK */
else
aClient
->
connect_state
=
0
;
...
...
src/MQTTProtocolOut.h
View file @
7c30485c
/*******************************************************************************
* Copyright (c) 2009, 201
3
IBM Corp.
* Copyright (c) 2009, 201
4
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
...
...
@@ -13,6 +13,7 @@
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs, Allan Stockdill-Mander - SSL updates
* Ian Craggs - MQTT 3.1.1 support
*******************************************************************************/
#if !defined(MQTTPROTOCOLOUT_H)
...
...
test/test1.c
View file @
7c30485c
#define MY_ID "@(#) stmqcom/pub1.c, stmqcom, cs 1.85 10/08/24 07:36:24"
/*--------------------------------------------------------------------*/
/* [Platforms]UNIX NT[/Platforms] */
/* [Title]MQ Telemetry MQTT C client tests */
/* [/Title] */
/* [Testclasses]stcom1 stmqcom1[/Category] */
/* [Category]MQ Telemetry[/Category] */
/* */
/* Copyright IBM 2012 */
/* All rights reserved. */
/*--------------------------------------------------------------------*/
/*******************************************************************************
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs - MQTT 3.1.1 support
*******************************************************************************/
/**
...
...
@@ -1057,7 +1062,7 @@ int test6(struct Options options)
/* now send the command which will break the connection and cause the will message to be sent */
/*rc = MQTTClient_publish(test6_c1, mqttsas_topic, strlen("TERMINATE"), "TERMINATE", 0, 0, NULL);
assert("Good rc from publish", rc == MQTTCLIENT_SUCCESS, "rc was %d\n", rc);*/
test6_socket_close
(((
MQTTClients
*
)
test6_c1
)
->
c
->
net
.
socket
);
test6_socket_close
(((
MQTTClients
*
)
test6_c1
)
->
c
->
net
.
socket
);
MyLog
(
LOGA_INFO
,
"Waiting to receive the will message"
);
count
=
0
;
...
...
test/test3.c
View file @
7c30485c
#define MY_ID "@(#) stmqcom/pub1.c, stmqcom, cs 1.85 10/08/24 07:36:24"
/*--------------------------------------------------------------------*/
/* [Platforms]UNIX NT[/Platforms] */
/* [Title]MQ Telemetry MQTT C client SSL tests */
/* [/Title] */
/* [Testclasses]stcom1 stmqcom1[/Category] */
/* [Category]MQ Telemetry[/Category] */
/* */
/* Copyright IBM 2012 */
/* All rights reserved. */
/*--------------------------------------------------------------------*/
/*******************************************************************************
* Copyright (c) 2012, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Allan Stockdill-Mander - initial API and implementation and/or initial documentation
*******************************************************************************/
/**
...
...
test/test4.c
View file @
7c30485c
#define MY_ID "@(#) stmqcom/pub1.c, stmqcom, cs 1.85 10/08/24 07:36:24"
/*--------------------------------------------------------------------*/
/* [Platforms]UNIX NT[/Platforms] */
/* [Title]MQ Telemetry MQTT C client tests */
/* [/Title] */
/* [Testclasses]stcom1 stmqcom1[/Category] */
/* [Category]MQ Telemetry[/Category] */
/* */
/* Copyright IBM 2012 */
/* All rights reserved. */
/*--------------------------------------------------------------------*/
/*******************************************************************************
* Copyright (c) 2009, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs - MQTT 3.1.1 support
*******************************************************************************/
/**
...
...
test/test5.c
View file @
7c30485c
#define MY_ID "@(#) stmqcom/pub1.c, stmqcom, cs 1.85 10/08/24 07:36:24"
/*--------------------------------------------------------------------*/
/* [Platforms]UNIX NT[/Platforms] */
/* [Title]MQ Telemetry MQTT C client SSL tests */
/* [/Title] */
/* [Testclasses]stcom1 stmqcom1[/Category] */
/* [Category]MQ Telemetry[/Category] */
/* */
/* Copyright IBM 2012 */
/* All rights reserved. */
/*--------------------------------------------------------------------*/
/*******************************************************************************
* Copyright (c) 2012, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Allan Stockdill-Mander - initial API and implementation and/or initial documentation
*******************************************************************************/
/**
* @file
...
...
test/test6.c
View file @
7c30485c
#define MY_ID "@(#) stmqcom/pub1.c, stmqcom, cs 1.85 10/08/24 07:36:24"
/*--------------------------------------------------------------------*/
/* [Platforms]UNIX NT[/Platforms] */
/* [Title]MQTT restart/recovery application for Async C client */
/* [/Title] */
/* [Testclasses]stcom1 stmqcom1[/Category] */
/* [Category]MQDrivers[/Category] */
/* */
/* Copyright IBM 2011, 2013 */
/* All rights reserved. */
/*--------------------------------------------------------------------*/
/*******************************************************************************
* Copyright (c) 2011, 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or initial documentation
*******************************************************************************/
/**
...
...
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