Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed build on Mac. #172

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
415079a
Fixed compiler error on Mac OS, removing redundant but unavailable he…
Mar 13, 2018
cb448df
Fixed build on Mac OS, linking conditionally to non-Mac OS libs.
Mar 13, 2018
8cb23b9
Fixed build on Mac OS, linking conditionally to non-Mac OS libs.
Mar 13, 2018
d9065b4
Added compile selection of SSL/TSL protocol version to all build on M…
Mar 13, 2018
2363ac8
Changed #include guard to distinguish between STD lib time header.
Mar 13, 2018
9b2cebd
Disabled test not ready for Mac OS.
Mar 13, 2018
0db494a
Disabled test not ready for Mac OS.
Mar 13, 2018
a4b1d52
Fixed build on Mac OS and disabled test not ready for Mac OS.
Mar 13, 2018
ef9ab80
Merge branch 'master' of https://github.com/cableramki/parodus
Mar 14, 2018
d721117
Fixed inclusion for correct header.
Mar 14, 2018
208c8a3
Fixed tests build on Mac OS.
Mar 14, 2018
c54c61b
Fixed compilation error on Mac OS using correct version of strerror_r.
Mar 14, 2018
26e1fb0
Removed mock to use actual STD lib function.
Mar 14, 2018
2730652
Fixed build on Mac OS, by including correct STB lib.
Mar 14, 2018
2be84b1
Fixed struct init error on Mac OS.
Mar 14, 2018
bd2ba95
Fixed build on Mac OS, by including correct STB lib.
Mar 14, 2018
2d17351
Fixed type mismatch compiler error on Mac OS.
Mar 14, 2018
5c41d17
Fixed build on Mac OS, by including correct STB lib.
Mar 14, 2018
1623075
Fixed type mismatch compiler error on Mac OS.
Mar 14, 2018
ec62ac2
Merge branch 'master' into master
cableramki Apr 3, 2018
11c91c6
Merge remote-tracking branch 'upstream/master'
Apr 3, 2018
10933fb
Fixed merge error.
Apr 3, 2018
499b81e
Merge branch 'master' of https://github.com/cableramki/parodus
Apr 3, 2018
288aacd
Fixed broken test.
Apr 3, 2018
0bd50a0
Applied another fix to Travis.
Apr 3, 2018
9dc74f1
Fixed config test failure on Travis.
Apr 4, 2018
a4fbf3b
Applied another fix to config test.
Apr 4, 2018
09c05a8
Added another fix to Travis config test failure.
Apr 4, 2018
139a492
Added fix #3 to Travis config test failure.
Apr 4, 2018
833640d
Added fix #4 to Travis config test failure.
Apr 4, 2018
97adcd0
Added fix #5 to Travis config test failure.
Apr 4, 2018
e3ad8d1
Added fix #6 to Travis config test failure.
Apr 4, 2018
7d3cb2d
Added fix #7 to Travis config test failure.
Apr 4, 2018
9a7c3d0
Added fix #8 to Travis config test failure.
Apr 4, 2018
1d063c8
Added fix #9 to Travis config test failure.
Apr 4, 2018
ce31b4d
Added fix #9 to Travis config test failure.
Apr 4, 2018
b689a13
Added fix #10 to Travis config test failure.
Apr 4, 2018
c5e3f26
Merge branch 'master' of https://github.com/cableramki/parodus
Apr 4, 2018
ec22237
Added fix #11 to Travis config test failure.
Apr 4, 2018
8684bfc
Added fix #11 to Travis config test failure.
Apr 4, 2018
86ea2fe
Added fix #12 to Travis config test failure.
Apr 4, 2018
4b919aa
Added fix to Travis connection interface test failure.
Apr 4, 2018
10599a8
Added fix #2 to Travis connection interface test failure.
Apr 4, 2018
209c04a
Ensured proper order of linked libs.
Apr 4, 2018
26eda8f
Ensured proper order of linked libs to parodus internal code test.
Apr 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ ExternalProject_Add(cJSON
GIT_REPOSITORY https://github.com/DaveGamble/cJSON.git
GIT_TAG "aafb64a1c549b7b927e339df6d35b1d5059dc235"
CMAKE_ARGS += -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
CMAKE_ARGS += -DCMAKE_MACOSX_RPATH=true
endif()
)
add_library(libcJSON STATIC SHARED IMPORTED)
add_dependencies(libcJSON cJSON)
Expand Down
7 changes: 5 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ target_link_libraries (parodus
-lmsgpackc
-ltrower-base64
-lnopoll
-luuid
-lm
-lcimplog
-lssl
Expand All @@ -40,9 +39,13 @@ target_link_libraries (parodus
-lcjson
-lcjwt
-lpthread
-lrt
)

if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries (parodus -luuid)
target_link_libraries (parodus rt)
endif()

if (FEATURE_DNS_QUERY)
target_link_libraries (parodus -lucresolv -lresolv)
endif (FEATURE_DNS_QUERY)
Expand Down
3 changes: 1 addition & 2 deletions src/ParodusInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <ctype.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/sysinfo.h>
#include <pthread.h>
#include <netdb.h>
#include <arpa/inet.h>
Expand Down Expand Up @@ -99,7 +98,7 @@ char* getWebpaConveyHeader();
#ifdef __cplusplus
}
#endif


#endif

18 changes: 17 additions & 1 deletion src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static noPollConnOpts * createConnOpts (char * extra_headers, bool secure);
static noPollConn * nopoll_tls_common_conn (noPollCtx * ctx,char * serverAddr,char *serverPort,char * extra_headers,unsigned int *fallback);
static char* build_extra_headers( const char *auth, const char *device_id,
const char *user_agent, const char *convey );
static noPollSslProtocol get_nopoll_tls_protocol(void);
static void toggleIPFlag (unsigned int *ptrFallback);
static noPollConn * __internal_fallbackConn(noPollCtx * ctx,noPollConnOpts * opts,char * serverAddr,char *serverPort,char * extra_headers,unsigned int *fallback);

Expand Down Expand Up @@ -501,16 +502,18 @@ static noPollConn * __internal_fallbackConn(noPollCtx * ctx,noPollConnOpts * op
static noPollConnOpts * createConnOpts (char * extra_headers, bool secure)
{
noPollConnOpts * opts;
noPollSslProtocol protocol = NOPOLL_METHOD_TLSV1_2;

opts = nopoll_conn_opts_new ();
protocol = get_nopoll_tls_protocol();
if(secure)
{
if(strlen(get_parodus_cfg()->cert_path) > 0)
{
nopoll_conn_opts_set_ssl_certs(opts, NULL, NULL, NULL, get_parodus_cfg()->cert_path);
}
nopoll_conn_opts_ssl_peer_verify (opts, nopoll_true);
nopoll_conn_opts_set_ssl_protocol (opts, NOPOLL_METHOD_TLSV1_2);
nopoll_conn_opts_set_ssl_protocol (opts, protocol);
}
nopoll_conn_opts_set_interface (opts,get_parodus_cfg()->webpa_interface_used);
nopoll_conn_opts_set_extra_headers (opts,extra_headers);
Expand All @@ -528,3 +531,16 @@ void close_and_unref_connection(noPollConn *conn)
}
}

static noPollSslProtocol get_nopoll_tls_protocol( void )
{
noPollSslProtocol _protocol;
#if defined(NOPOLL_HAVE_TLSv12_ENABLED)
_protocol = NOPOLL_METHOD_TLSV1_2;
#elif defined(NOPOLL_HAVE_TLSv11_ENABLED)
_protocol = NOPOLL_METHOD_TLSV1_1;
#elif defined(NOPOLL_HAVE_TLSv10_ENABLED)
_protocol = NOPOLL_METHOD_TLSV1;
#endif
return _protocol;
}

2 changes: 1 addition & 1 deletion src/string_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
*/
#include "string.h"
#include <string.h>

/*----------------------------------------------------------------------------*/
/* Macros */
Expand Down
4 changes: 2 additions & 2 deletions src/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <stdint.h>
#include <time.h>

#ifndef _TIME_H_
#define _TIME_H_
#ifndef __TIME_H__
#define __TIME_H__

#ifdef __cplusplus
extern "C" {
Expand Down
Loading