Merge branch 'master' of git.irl.cs.ucla.edu:ndn/sync
diff --git a/model/sync-app-socket-c.cc b/model/sync-app-socket-c.cc
index 0fc03e1..2445b8c 100644
--- a/model/sync-app-socket-c.cc
+++ b/model/sync-app-socket-c.cc
@@ -20,7 +20,7 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "sync-app-socket-c.h"
+#include "sync-app-socket.h"
using namespace std;
using namespace Sync;
@@ -32,6 +32,9 @@
}
};
+struct SyncAppSocketStruct;
+
+extern "C"
SyncAppSocketStruct *
create_sync_app_socket(const char *prefix, void (*callback)(const char *, const char *))
{
@@ -42,7 +45,7 @@
return (SyncAppSocketStruct *) sock;
}
-
+extern "C"
void
delete_sync_app_socket(SyncAppSocketStruct **sock) {
SyncAppSocket *temp = *((SyncAppSocket **)sock);
@@ -51,14 +54,16 @@
}
// assume char *buf ends with '\0', or otherwise it's going to crash;
-// should fix this "feature"
-bool
-sync_app_socket_publish(SyncAppSocketStruct *sock, const char *prefix, uint32_t session, const char *buf, int freshness)
+// should fix this "feature"
+extern "C"
+int
+sync_app_socket_publish(SyncAppSocketStruct *sock, const char *prefix, int session, const char *buf, int freshness)
{
SyncAppSocket *temp = (SyncAppSocket *)sock;
return temp->publish(prefix, session, buf, freshness);
}
+extern "C"
void
sync_app_socket_remove(SyncAppSocketStruct *sock, const char *prefix)
{
diff --git a/model/sync-app-socket-c.h b/model/sync-app-socket-c.h
index 77afc79..6db2844 100644
--- a/model/sync-app-socket-c.h
+++ b/model/sync-app-socket-c.h
@@ -23,15 +23,17 @@
#ifndef SYNC_APP_SOCKET_C_H
#define SYNC_APP_SOCKET_C_H
-#include "sync-app-socket.h"
-
+#ifdef __cplusplus
extern "C" {
- typedef struct SyncAppSocketStruct;
+#endif
+ typedef struct SyncAppSocketStruct SyncAppSocketStruct;
SyncAppSocketStruct *create_sync_app_socket(const char *prefix, void (*callback)(const char *, const char *));
void delete_sync_app_socket(SyncAppSocketStruct **sock);
- bool sync_app_socket_publish(SyncAppSocketStruct *sock, const char *prefix, uint32_t session, const char *buf, int freshness);
+ int sync_app_socket_publish(SyncAppSocketStruct *sock, const char *prefix, int session, const char *buf, int freshness);
void sync_app_socket_remove(SyncAppSocketStruct *sock, const char *prefix);
+#ifdef __cplusplus
}
+#endif
#endif // SYNC_APP_SOCKET_C_H