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
83087449
Commit
83087449
authored
Mar 24, 2017
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build TLS libraries on Windows
parent
5db08261
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
66 additions
and
56 deletions
+66
-56
CMakeLists.txt
CMakeLists.txt
+1
-1
appveyor.yml
appveyor.yml
+7
-1
cbuild.bat
cbuild.bat
+2
-1
CMakeLists.txt
src/CMakeLists.txt
+8
-4
paho_c_pub.c
src/samples/paho_c_pub.c
+1
-3
paho_c_sub.c
src/samples/paho_c_sub.c
+16
-19
paho_cs_pub.c
src/samples/paho_cs_pub.c
+1
-3
paho_cs_sub.c
src/samples/paho_cs_sub.c
+20
-21
CMakeLists.txt
test/CMakeLists.txt
+9
-3
test3.c
test/test3.c
+1
-0
No files found.
CMakeLists.txt
View file @
83087449
...
@@ -63,7 +63,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
...
@@ -63,7 +63,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
ENDIF
()
ENDIF
()
IF
(
WIN32
)
IF
(
WIN32
)
ADD_DEFINITIONS
(
-D
WIN32 -D_WINDOWS -D_CRT_SECURE_NO_DEPRECATE
)
ADD_DEFINITIONS
(
-D
_CRT_SECURE_NO_DEPRECATE -DWIN32_LEAN_AND_MEAN -MD
)
ELSEIF
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"Darwin"
)
ELSEIF
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"Darwin"
)
ADD_DEFINITIONS
(
-DOSX
)
ADD_DEFINITIONS
(
-DOSX
)
ENDIF
()
ENDIF
()
...
...
appveyor.yml
View file @
83087449
...
@@ -2,7 +2,11 @@ version: 1.0.{build}
...
@@ -2,7 +2,11 @@ version: 1.0.{build}
image
:
Visual Studio 2015
image
:
Visual Studio 2015
configuration
:
Debug
configuration
:
Debug
install
:
install
:
-
cmd
:
cinst openssl.light
-
ps
:
cinst openssl.light -y
-
ps
:
(new-object net.webclient).DownloadFile('https://eclipse.org/downloads/download.php?file=/mosquitto/binary/win32/mosquitto-1.4.11-install-win32.exe', 'mosquitto-1.4.11-install-win32.exe')
-
ps
:
mosquitto-1.4.11-install-win32.exe /S
-
ps
:
taskkill
-
ps
:
(new-object net.webclient).DownloadFile('ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/dll/x86/pthreadVC2.dll', "C:\Program Files (x86)\mosquitto\pthreadVC2.dll")
build_script
:
build_script
:
-
cmd
:
>
-
-
cmd
:
>
-
mkdir build.paho
mkdir build.paho
...
@@ -15,6 +19,8 @@ build_script:
...
@@ -15,6 +19,8 @@ build_script:
nmake
nmake
python ..\test\mqttsas2.py mqtt.iotree.co.uk
ctest -T test -VV
ctest -T test -VV
cd ..
cd ..
...
...
cbuild.bat
View file @
83087449
setlocal
setlocal
rmdir /s /q build.paho
mkdir build.paho
mkdir build.paho
cd build.paho
cd build.paho
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
cmake -G "NMake Makefiles" -DPAHO_WITH_SSL=
FALS
E -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE ..
cmake -G "NMake Makefiles" -DPAHO_WITH_SSL=
TRU
E -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE ..
nmake
nmake
...
...
src/CMakeLists.txt
View file @
83087449
...
@@ -36,14 +36,18 @@ IF (PAHO_WITH_SSL)
...
@@ -36,14 +36,18 @@ IF (PAHO_WITH_SSL)
SET
(
OPENSSL_BREW_PATH
"/usr/local/opt/openssl"
)
SET
(
OPENSSL_BREW_PATH
"/usr/local/opt/openssl"
)
ENDIF
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"Darwin"
)
ENDIF
(
${
CMAKE_SYSTEM_NAME
}
STREQUAL
"Darwin"
)
IF
(
WIN32
)
SET
(
OPENSSL_DIR $ENV{OPENSSL_DIR}
)
ENDIF
()
FIND_PATH
(
OPENSSL_INCLUDE_DIR openssl/ssl.h
FIND_PATH
(
OPENSSL_INCLUDE_DIR openssl/ssl.h
HINTS
${
OPENSSL_INC_SEARCH_PATH
}
/include
${
OPENSSL_BREW_PATH
}
/include/
)
HINTS
${
OPENSSL_INC_SEARCH_PATH
}
/include
${
OPENSSL_
DIR
}
/include
${
OPENSSL_
BREW_PATH
}
/include/
)
FIND_LIBRARY
(
OPENSSL_LIB NAMES ssl libssl
FIND_LIBRARY
(
OPENSSL_LIB NAMES ssl libssl
ssleay32
HINTS
${
OPENSSL_BREW_PATH
}
/lib
${
OPENSSL_DIR
}
/lib
${
OPENSSL_DIR
}
/lib64
)
HINTS
${
OPENSSL_BREW_PATH
}
/lib
${
OPENSSL_DIR
}
/lib
${
OPENSSL_DIR
}
/lib64
)
FIND_LIBRARY
(
OPENSSLCRYPTO_LIB NAMES crypto libcrypto
FIND_LIBRARY
(
OPENSSLCRYPTO_LIB NAMES crypto libcrypto
libeay32
HINTS
${
OPENSSL_BREW_PATH
}
/lib
${
OPENSSL_DIR
}
/lib
${
OPENSSL_DIR
}
/lib64
)
HINTS
${
OPENSSL_BREW_PATH
}
/lib
${
OPENSSL_DIR
}
/lib
${
OPENSSL_DIR
}
/lib64
)
MESSAGE
(
STATUS
"OpenSSL hint
${
PENSSL_INC_SEARCH_PATH
}
(includes) / "
)
MESSAGE
(
STATUS
"OpenSSL hint
${
O
PENSSL_INC_SEARCH_PATH
}
(includes) / "
)
MESSAGE
(
STATUS
"OpenSSL headers found at
${
OPENSSL_INCLUDE_DIR
}
"
)
MESSAGE
(
STATUS
"OpenSSL headers found at
${
OPENSSL_INCLUDE_DIR
}
"
)
MESSAGE
(
STATUS
"OpenSSL library found at
${
OPENSSL_LIB
}
"
)
MESSAGE
(
STATUS
"OpenSSL library found at
${
OPENSSL_LIB
}
"
)
MESSAGE
(
STATUS
"OpenSSL Crypto library found at
${
OPENSSLCRYPTO_LIB
}
"
)
MESSAGE
(
STATUS
"OpenSSL Crypto library found at
${
OPENSSLCRYPTO_LIB
}
"
)
...
...
src/samples/paho_c_pub.c
View file @
83087449
...
@@ -42,15 +42,13 @@
...
@@ -42,15 +42,13 @@
#include <stdio.h>
#include <stdio.h>
#include <signal.h>
#include <signal.h>
#include <memory.h>
#include <memory.h>
#include <stdlib.h>
#if defined(WIN32)
#if defined(WIN32)
#include <Windows.h>
#define sleep Sleep
#define sleep Sleep
#else
#else
#include <unistd.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#endif
#endif
...
...
src/samples/paho_c_sub.c
View file @
83087449
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
*
*
* All rights reserved. This program and the accompanying materials
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
*
* The Eclipse Public License is available at
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
* http://www.eclipse.org/org/documents/edl-v10.php.
*
*
* Contributors:
* Contributors:
...
@@ -17,15 +17,15 @@
...
@@ -17,15 +17,15 @@
*******************************************************************************/
*******************************************************************************/
/*
/*
stdout subscriber for the asynchronous client
stdout subscriber for the asynchronous client
compulsory parameters:
compulsory parameters:
--topic topic to subscribe to
--topic topic to subscribe to
defaulted parameters:
defaulted parameters:
--host localhost
--host localhost
--port 1883
--port 1883
--qos 2
--qos 2
...
@@ -33,10 +33,10 @@
...
@@ -33,10 +33,10 @@
--clientid stdout-subscriber-async
--clientid stdout-subscriber-async
--showtopics off
--showtopics off
--keepalive 10
--keepalive 10
--userid none
--userid none
--password none
--password none
*/
*/
#include "MQTTAsync.h"
#include "MQTTAsync.h"
...
@@ -45,14 +45,13 @@
...
@@ -45,14 +45,13 @@
#include <stdio.h>
#include <stdio.h>
#include <signal.h>
#include <signal.h>
#include <memory.h>
#include <memory.h>
#include <stdlib.h>
#if defined(WIN32)
#if defined(WIN32)
#include <windows.h>
#define sleep Sleep
#define sleep Sleep
#else
#else
#include <sys/time.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#endif
#endif
...
@@ -108,7 +107,7 @@ void usage(void)
...
@@ -108,7 +107,7 @@ void usage(void)
void
getopts
(
int
argc
,
char
**
argv
)
void
getopts
(
int
argc
,
char
**
argv
)
{
{
int
count
=
2
;
int
count
=
2
;
while
(
count
<
argc
)
while
(
count
<
argc
)
{
{
if
(
strcmp
(
argv
[
count
],
"--qos"
)
==
0
)
if
(
strcmp
(
argv
[
count
],
"--qos"
)
==
0
)
...
@@ -198,7 +197,7 @@ void getopts(int argc, char** argv)
...
@@ -198,7 +197,7 @@ void getopts(int argc, char** argv)
}
}
count
++
;
count
++
;
}
}
}
}
...
@@ -287,10 +286,10 @@ int main(int argc, char** argv)
...
@@ -287,10 +286,10 @@ int main(int argc, char** argv)
MQTTAsync_disconnectOptions
disc_opts
=
MQTTAsync_disconnectOptions_initializer
;
MQTTAsync_disconnectOptions
disc_opts
=
MQTTAsync_disconnectOptions_initializer
;
int
rc
=
0
;
int
rc
=
0
;
char
url
[
100
];
char
url
[
100
];
if
(
argc
<
2
)
if
(
argc
<
2
)
usage
();
usage
();
topic
=
argv
[
1
];
topic
=
argv
[
1
];
if
(
strchr
(
topic
,
'#'
)
||
strchr
(
topic
,
'+'
))
if
(
strchr
(
topic
,
'#'
)
||
strchr
(
topic
,
'+'
))
...
@@ -298,7 +297,7 @@ int main(int argc, char** argv)
...
@@ -298,7 +297,7 @@ int main(int argc, char** argv)
if
(
opts
.
showtopics
)
if
(
opts
.
showtopics
)
printf
(
"topic is %s
\n
"
,
topic
);
printf
(
"topic is %s
\n
"
,
topic
);
getopts
(
argc
,
argv
);
getopts
(
argc
,
argv
);
sprintf
(
url
,
"%s:%s"
,
opts
.
host
,
opts
.
port
);
sprintf
(
url
,
"%s:%s"
,
opts
.
host
,
opts
.
port
);
rc
=
MQTTAsync_create
(
&
client
,
url
,
opts
.
clientid
,
MQTTCLIENT_PERSISTENCE_NONE
,
NULL
);
rc
=
MQTTAsync_create
(
&
client
,
url
,
opts
.
clientid
,
MQTTCLIENT_PERSISTENCE_NONE
,
NULL
);
...
@@ -357,5 +356,3 @@ exit:
...
@@ -357,5 +356,3 @@ exit:
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
src/samples/paho_cs_pub.c
View file @
83087449
...
@@ -41,14 +41,12 @@
...
@@ -41,14 +41,12 @@
#include <stdio.h>
#include <stdio.h>
#include <signal.h>
#include <signal.h>
#include <memory.h>
#include <memory.h>
#include <stdlib.h>
#if defined(WIN32)
#if defined(WIN32)
#include <Windows.h>
#define sleep Sleep
#define sleep Sleep
#else
#else
#include <sys/time.h>
#include <sys/time.h>
#include <stdlib.h>
#endif
#endif
...
...
src/samples/paho_cs_sub.c
View file @
83087449
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
*
*
* All rights reserved. This program and the accompanying materials
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
*
* The Eclipse Public License is available at
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
* http://www.eclipse.org/org/documents/edl-v10.php.
*
*
* Contributors:
* Contributors:
...
@@ -17,15 +17,15 @@
...
@@ -17,15 +17,15 @@
*******************************************************************************/
*******************************************************************************/
/*
/*
stdout subscriber
stdout subscriber
compulsory parameters:
compulsory parameters:
--topic topic to subscribe to
--topic topic to subscribe to
defaulted parameters:
defaulted parameters:
--host localhost
--host localhost
--port 1883
--port 1883
--qos 2
--qos 2
...
@@ -33,10 +33,10 @@
...
@@ -33,10 +33,10 @@
--clientid stdout-subscriber
--clientid stdout-subscriber
--showtopics off
--showtopics off
--keepalive 10
--keepalive 10
--userid none
--userid none
--password none
--password none
*/
*/
#include "MQTTClient.h"
#include "MQTTClient.h"
#include "MQTTClientPersistence.h"
#include "MQTTClientPersistence.h"
...
@@ -44,14 +44,13 @@
...
@@ -44,14 +44,13 @@
#include <stdio.h>
#include <stdio.h>
#include <signal.h>
#include <signal.h>
#include <memory.h>
#include <memory.h>
#include <stdlib.h>
#if defined(WIN32)
#if defined(WIN32)
#include <windows.h>
#define sleep Sleep
#define sleep Sleep
#else
#else
#include <sys/time.h>
#include <sys/time.h>
#include <stdlib.h>
#endif
#endif
...
@@ -119,10 +118,10 @@ int main(int argc, char** argv)
...
@@ -119,10 +118,10 @@ int main(int argc, char** argv)
char
*
topic
=
NULL
;
char
*
topic
=
NULL
;
int
rc
=
0
;
int
rc
=
0
;
char
url
[
100
];
char
url
[
100
];
if
(
argc
<
2
)
if
(
argc
<
2
)
usage
();
usage
();
topic
=
argv
[
1
];
topic
=
argv
[
1
];
if
(
strchr
(
topic
,
'#'
)
||
strchr
(
topic
,
'+'
))
if
(
strchr
(
topic
,
'#'
)
||
strchr
(
topic
,
'+'
))
...
@@ -130,7 +129,7 @@ int main(int argc, char** argv)
...
@@ -130,7 +129,7 @@ int main(int argc, char** argv)
if
(
opts
.
showtopics
)
if
(
opts
.
showtopics
)
printf
(
"topic is %s
\n
"
,
topic
);
printf
(
"topic is %s
\n
"
,
topic
);
getopts
(
argc
,
argv
);
getopts
(
argc
,
argv
);
sprintf
(
url
,
"%s:%s"
,
opts
.
host
,
opts
.
port
);
sprintf
(
url
,
"%s:%s"
,
opts
.
host
,
opts
.
port
);
rc
=
MQTTClient_create
(
&
client
,
url
,
opts
.
clientid
,
MQTTCLIENT_PERSISTENCE_NONE
,
NULL
);
rc
=
MQTTClient_create
(
&
client
,
url
,
opts
.
clientid
,
MQTTCLIENT_PERSISTENCE_NONE
,
NULL
);
...
@@ -143,9 +142,9 @@ int main(int argc, char** argv)
...
@@ -143,9 +142,9 @@ int main(int argc, char** argv)
conn_opts
.
cleansession
=
1
;
conn_opts
.
cleansession
=
1
;
conn_opts
.
username
=
opts
.
username
;
conn_opts
.
username
=
opts
.
username
;
conn_opts
.
password
=
opts
.
password
;
conn_opts
.
password
=
opts
.
password
;
myconnect
(
&
client
,
&
conn_opts
);
myconnect
(
&
client
,
&
conn_opts
);
rc
=
MQTTClient_subscribe
(
client
,
topic
,
opts
.
qos
);
rc
=
MQTTClient_subscribe
(
client
,
topic
,
opts
.
qos
);
while
(
!
toStop
)
while
(
!
toStop
)
...
@@ -153,7 +152,7 @@ int main(int argc, char** argv)
...
@@ -153,7 +152,7 @@ int main(int argc, char** argv)
char
*
topicName
=
NULL
;
char
*
topicName
=
NULL
;
int
topicLen
;
int
topicLen
;
MQTTClient_message
*
message
=
NULL
;
MQTTClient_message
*
message
=
NULL
;
rc
=
MQTTClient_receive
(
client
,
&
topicName
,
&
topicLen
,
&
message
,
1000
);
rc
=
MQTTClient_receive
(
client
,
&
topicName
,
&
topicLen
,
&
message
,
1000
);
if
(
message
)
if
(
message
)
{
{
...
@@ -170,7 +169,7 @@ int main(int argc, char** argv)
...
@@ -170,7 +169,7 @@ int main(int argc, char** argv)
if
(
rc
!=
0
)
if
(
rc
!=
0
)
myconnect
(
&
client
,
&
conn_opts
);
myconnect
(
&
client
,
&
conn_opts
);
}
}
printf
(
"Stopping
\n
"
);
printf
(
"Stopping
\n
"
);
MQTTClient_disconnect
(
client
,
0
);
MQTTClient_disconnect
(
client
,
0
);
...
@@ -183,7 +182,7 @@ int main(int argc, char** argv)
...
@@ -183,7 +182,7 @@ int main(int argc, char** argv)
void
getopts
(
int
argc
,
char
**
argv
)
void
getopts
(
int
argc
,
char
**
argv
)
{
{
int
count
=
2
;
int
count
=
2
;
while
(
count
<
argc
)
while
(
count
<
argc
)
{
{
if
(
strcmp
(
argv
[
count
],
"--qos"
)
==
0
)
if
(
strcmp
(
argv
[
count
],
"--qos"
)
==
0
)
...
@@ -267,5 +266,5 @@ void getopts(int argc, char** argv)
...
@@ -267,5 +266,5 @@ void getopts(int argc, char** argv)
}
}
count
++
;
count
++
;
}
}
}
}
test/CMakeLists.txt
View file @
83087449
PROJECT
(
mqtt-tests
)
PROJECT
(
mqtt-tests
)
SET
(
MQTT_TEST_BROKER
"tcp://localhost:1883"
CACHE STRING
"Hostname of a test MQTT broker to use"
)
IF
(
WIN32
)
SET
(
MQTT_TEST_PROXY
"tcp://localhost:1884"
CACHE STRING
"Hostname of the test proxy to use"
)
SET
(
MQTT_TEST_BROKER
"tcp://mqtt.iotree.co.uk:1883"
CACHE STRING
"Hostname of a test MQTT broker to use"
)
SET
(
MQTT_SSL_HOSTNAME
"localhost"
CACHE STRING
"Hostname of a test SSL MQTT broker to use"
)
SET
(
MQTT_TEST_PROXY
"tcp://localhost:1883"
CACHE STRING
"Hostname of the test proxy to use"
)
SET
(
MQTT_SSL_HOSTNAME
"mqtt.iotree.co.uk"
CACHE STRING
"Hostname of a test SSL MQTT broker to use"
)
ELSE
()
SET
(
MQTT_TEST_BROKER
"tcp://localhost:1883"
CACHE STRING
"Hostname of a test MQTT broker to use"
)
SET
(
MQTT_TEST_PROXY
"tcp://localhost:1884"
CACHE STRING
"Hostname of the test proxy to use"
)
SET
(
MQTT_SSL_HOSTNAME
"localhost"
CACHE STRING
"Hostname of a test SSL MQTT broker to use"
)
ENDIF
()
SET
(
CERTDIR $ENV{TRAVIS_BUILD_DIR}/test/ssl
)
SET
(
CERTDIR $ENV{TRAVIS_BUILD_DIR}/test/ssl
)
ADD_EXECUTABLE
(
ADD_EXECUTABLE
(
...
...
test/test3.c
View file @
83087449
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <errno.h>
#include <errno.h>
#else
#else
#include <windows.h>
#include <windows.h>
#include <applink.c>
#define MAXHOSTNAMELEN 256
#define MAXHOSTNAMELEN 256
#define snprintf _snprintf
#define snprintf _snprintf
#define setenv(a, b, c) _putenv_s(a, b)
#define setenv(a, b, c) _putenv_s(a, b)
...
...
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