From 52f3b1553fec56a7d558a013cef5e6afd0ed5aaf Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Mon, 22 Jul 2013 18:06:24 -0400 Subject: Added support of linkage with C++ code --- core/DHT.h | 8 ++++++++ core/Lossless_UDP.h | 7 +++++++ core/Messenger.h | 8 ++++++++ core/friend_requests.h | 7 ++++++- core/net_crypto.h | 7 +++++++ core/network.h | 8 ++++++++ 6 files changed, 44 insertions(+), 1 deletion(-) diff --git a/core/DHT.h b/core/DHT.h index f561d559..fdb89de6 100644 --- a/core/DHT.h +++ b/core/DHT.h @@ -28,6 +28,10 @@ #include "net_crypto.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Current time, unix format */ #define unix_time() ((uint32_t)time(NULL)) @@ -112,4 +116,8 @@ int DHT_load(uint8_t * data, uint32_t size); returns 1 if we are */ int DHT_isconnected(); +#ifdef __cplusplus +} +#endif + #endif diff --git a/core/Lossless_UDP.h b/core/Lossless_UDP.h index 8a71bd68..0f5bb119 100644 --- a/core/Lossless_UDP.h +++ b/core/Lossless_UDP.h @@ -27,6 +27,9 @@ #include "network.h" +#ifdef __cplusplus +extern "C" { +#endif /* maximum length of the data in the data packets */ #define MAX_DATA_SIZE 1024 @@ -106,4 +109,8 @@ void doLossless_UDP(); return 1 if it didn't handle the packet or if the packet was shit. */ int LosslessUDP_handlepacket(uint8_t * packet, uint32_t length, IP_Port source); +#ifdef __cplusplus +} +#endif + #endif diff --git a/core/Messenger.h b/core/Messenger.h index a7f114cf..2484692c 100644 --- a/core/Messenger.h +++ b/core/Messenger.h @@ -31,6 +31,10 @@ #include "DHT.h" #include "friend_requests.h" +#ifdef __cplusplus +extern "C" { +#endif + #define MAX_NAME_LENGTH 128 #define MAX_USERSTATUS_LENGTH 128 @@ -147,4 +151,8 @@ void Messenger_save(uint8_t * data); /* load the messenger from data of size length */ int Messenger_load(uint8_t * data, uint32_t length); +#ifdef __cplusplus +} +#endif + #endif diff --git a/core/friend_requests.h b/core/friend_requests.h index a3de46c8..de116b33 100644 --- a/core/friend_requests.h +++ b/core/friend_requests.h @@ -12,6 +12,9 @@ #include "DHT.h" #include "net_crypto.h" +#ifdef __cplusplus +extern "C" { +#endif /* Try to send a friendrequest to peer with public_key data is the data in the request and length is the length. */ @@ -29,6 +32,8 @@ int friendreq_handlepacket(uint8_t * packet, uint32_t length, IP_Port source); - +#ifdef __cplusplus +} +#endif #endif \ No newline at end of file diff --git a/core/net_crypto.h b/core/net_crypto.h index 5a282002..b497f1fb 100644 --- a/core/net_crypto.h +++ b/core/net_crypto.h @@ -26,6 +26,10 @@ #include "Lossless_UDP.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Our public key. */ extern uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; extern uint8_t self_secret_key[crypto_box_SECRETKEYBYTES]; @@ -129,5 +133,8 @@ void initNetCrypto(); /* main loop */ void doNetCrypto(); +#ifdef __cplusplus +} +#endif #endif diff --git a/core/network.h b/core/network.h index daab6e41..460bedbd 100644 --- a/core/network.h +++ b/core/network.h @@ -65,6 +65,9 @@ #endif +#ifdef __cplusplus +extern "C" { +#endif #define MAX_UDP_PACKET_SIZE 65507 @@ -130,4 +133,9 @@ void shutdown_networking(); on success returns a data in network byte order that can be used to set IP.i or IP_Port.ip.i on failure returns -1 */ int resolve_addr(char *address); + +#ifdef __cplusplus +} +#endif + #endif -- cgit v1.2.3