summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-07-22 15:20:09 -0700
committerirungentoo <irungentoo@gmail.com>2013-07-22 15:20:09 -0700
commite9e9a37867a5f13f0cd8c78f43d23e9b10d9c4f7 (patch)
treeff7a31673c7628e08528d81fa554fb694d7389ff
parentd0b4fa56a3f8334cfffce45a9eadfcd8143f7944 (diff)
parent52f3b1553fec56a7d558a013cef5e6afd0ed5aaf (diff)
Merge pull request #91 from nurupo/master
Added support of linkage with C++ code
-rw-r--r--core/DHT.h8
-rw-r--r--core/Lossless_UDP.h7
-rw-r--r--core/Messenger.h8
-rw-r--r--core/friend_requests.h7
-rw-r--r--core/net_crypto.h7
-rw-r--r--core/network.h8
6 files changed, 44 insertions, 1 deletions
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 @@
28 28
29#include "net_crypto.h" 29#include "net_crypto.h"
30 30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
31/* Current time, unix format */ 35/* Current time, unix format */
32#define unix_time() ((uint32_t)time(NULL)) 36#define unix_time() ((uint32_t)time(NULL))
33 37
@@ -112,4 +116,8 @@ int DHT_load(uint8_t * data, uint32_t size);
112 returns 1 if we are */ 116 returns 1 if we are */
113int DHT_isconnected(); 117int DHT_isconnected();
114 118
119#ifdef __cplusplus
120}
121#endif
122
115#endif 123#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 @@
27 27
28#include "network.h" 28#include "network.h"
29 29
30#ifdef __cplusplus
31extern "C" {
32#endif
30 33
31/* maximum length of the data in the data packets */ 34/* maximum length of the data in the data packets */
32#define MAX_DATA_SIZE 1024 35#define MAX_DATA_SIZE 1024
@@ -106,4 +109,8 @@ void doLossless_UDP();
106 return 1 if it didn't handle the packet or if the packet was shit. */ 109 return 1 if it didn't handle the packet or if the packet was shit. */
107int LosslessUDP_handlepacket(uint8_t * packet, uint32_t length, IP_Port source); 110int LosslessUDP_handlepacket(uint8_t * packet, uint32_t length, IP_Port source);
108 111
112#ifdef __cplusplus
113}
114#endif
115
109#endif 116#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 @@
31#include "DHT.h" 31#include "DHT.h"
32#include "friend_requests.h" 32#include "friend_requests.h"
33 33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
34#define MAX_NAME_LENGTH 128 38#define MAX_NAME_LENGTH 128
35#define MAX_USERSTATUS_LENGTH 128 39#define MAX_USERSTATUS_LENGTH 128
36 40
@@ -147,4 +151,8 @@ void Messenger_save(uint8_t * data);
147/* load the messenger from data of size length */ 151/* load the messenger from data of size length */
148int Messenger_load(uint8_t * data, uint32_t length); 152int Messenger_load(uint8_t * data, uint32_t length);
149 153
154#ifdef __cplusplus
155}
156#endif
157
150#endif 158#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 @@
12#include "DHT.h" 12#include "DHT.h"
13#include "net_crypto.h" 13#include "net_crypto.h"
14 14
15#ifdef __cplusplus
16extern "C" {
17#endif
15 18
16/* Try to send a friendrequest to peer with public_key 19/* Try to send a friendrequest to peer with public_key
17 data is the data in the request and length is the length. */ 20 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);
29 32
30 33
31 34
32 35#ifdef __cplusplus
36}
37#endif
33 38
34#endif \ No newline at end of file 39#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 @@
26 26
27#include "Lossless_UDP.h" 27#include "Lossless_UDP.h"
28 28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
29/* Our public key. */ 33/* Our public key. */
30extern uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; 34extern uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
31extern uint8_t self_secret_key[crypto_box_SECRETKEYBYTES]; 35extern uint8_t self_secret_key[crypto_box_SECRETKEYBYTES];
@@ -129,5 +133,8 @@ void initNetCrypto();
129/* main loop */ 133/* main loop */
130void doNetCrypto(); 134void doNetCrypto();
131 135
136#ifdef __cplusplus
137}
138#endif
132 139
133#endif 140#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 @@
65 65
66#endif 66#endif
67 67
68#ifdef __cplusplus
69extern "C" {
70#endif
68 71
69#define MAX_UDP_PACKET_SIZE 65507 72#define MAX_UDP_PACKET_SIZE 65507
70 73
@@ -130,4 +133,9 @@ void shutdown_networking();
130 on success returns a data in network byte order that can be used to set IP.i or IP_Port.ip.i 133 on success returns a data in network byte order that can be used to set IP.i or IP_Port.ip.i
131 on failure returns -1 */ 134 on failure returns -1 */
132int resolve_addr(char *address); 135int resolve_addr(char *address);
136
137#ifdef __cplusplus
138}
139#endif
140
133#endif 141#endif