summaryrefslogtreecommitdiff
path: root/netcon/RPC.h
diff options
context:
space:
mode:
authorJoseph Henry <josephjah@gmail.com>2016-01-12 09:46:49 -0800
committerJoseph Henry <josephjah@gmail.com>2016-01-12 09:46:49 -0800
commite2ae9165c6fea5c1099428da7147a42068c0ce1a (patch)
tree336531450256f83ba04ba6bfff1b8cdbf0b04835 /netcon/RPC.h
parentc6571073feb5eeb2cdd5fe102871fafba43b8c17 (diff)
downloadinfinitytier-e2ae9165c6fea5c1099428da7147a42068c0ce1a.tar.gz
infinitytier-e2ae9165c6fea5c1099428da7147a42068c0ce1a.zip
RPC update
Diffstat (limited to 'netcon/RPC.h')
-rw-r--r--netcon/RPC.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/netcon/RPC.h b/netcon/RPC.h
index 5affc0d4..35387a8f 100644
--- a/netcon/RPC.h
+++ b/netcon/RPC.h
@@ -3,29 +3,28 @@
#include <stdint.h>
-#define MAGIC_SIZE sizeof(uint64_t)
-#define MAGIC_PADDING_SIZE 12
-#define TOKEN_SIZE MAGIC_SIZE+MAGIC_PADDING_SIZE
+#define CANARY_SIZE sizeof(uint64_t)
+#define CANARY_PADDING_SIZE 12
+#define TOKEN_SIZE CANARY_SIZE+CANARY_PADDING_SIZE
#define RPC_PHRASE "zerotier\0"
#define RPC_PHRASE_SIZE 9
-// 1st section
+// 1st RPC section (metdata)
#define IDX_SIGNAL_PHRASE 0
#define IDX_PID IDX_SIGNAL_PHRASE + RPC_PHRASE_SIZE
#define IDX_TID sizeof(pid_t) + IDX_PID
#define IDX_COUNT IDX_TID + sizeof(pid_t)
#define IDX_TIME IDX_COUNT + sizeof(int)
#define IDX_PAYLOAD IDX_TIME + 20 /* 20 being the length of the timestamp string */
+// 2nd RPC section (payload and canary)
+#define CMD_ID_IDX 0
+#define CANARY_IDX 1
+#define STRUCT_IDX CANARY_IDX+CANARY_SIZE
-// 2nd section
-#define CMD_ID_IDX 0
-#define MAGIC_IDX 1
-#define STRUCT_IDX MAGIC_IDX+MAGIC_SIZE
+#define BUF_SZ 256
+#define PAYLOAD_SZ 223 /* BUF_SZ-IDX_PAYLOAD */
-#define BUF_SZ 256
-#define PAYLOAD_SZ 223 /* BUF_SZ-IDX_PAYLOAD */
-
-#define ERR_OK 0
+#define ERR_OK 0
/* RPC codes */
#define RPC_UNDEFINED 0
@@ -54,8 +53,10 @@ extern "C" {
int get_retval(int);
+//#ifdef NETCON_INTERCEPT
int rpc_join(const char * sockname);
-int rpc_send_command(int cmd, int forfd, void *data, int len);
+int rpc_send_command(char *path, int cmd, int forfd, void *data, int len);
+//#endif
int get_new_fd(int sock);
ssize_t sock_fd_write(int sock, int fd);