diff --git a/dist/antd-publishers-0.1.0a.tar.gz b/dist/antd-publishers-0.1.0a.tar.gz index 3a7c4fc..d032192 100644 Binary files a/dist/antd-publishers-0.1.0a.tar.gz and b/dist/antd-publishers-0.1.0a.tar.gz differ diff --git a/tunnel.c b/tunnel.c index d009ff4..6b465df 100644 --- a/tunnel.c +++ b/tunnel.c @@ -101,11 +101,13 @@ int open_unix_socket(char* path) int msg_read(int fd, tunnel_msg_t* msg) { +#ifdef VERIFY_HEADER if(msg_check_number(fd, MSG_MAGIC_BEGIN) == -1) { M_ERROR(MODULE_NAME, "Unable to check begin magic number"); return -1; } +#endif if(read(fd,&msg->header.type,sizeof(msg->header.type)) == -1) { M_ERROR(MODULE_NAME, "Unable to read msg type: %s", strerror(errno)); @@ -131,6 +133,7 @@ int msg_read(int fd, tunnel_msg_t* msg) M_ERROR(MODULE_NAME, "Unable to read msg payload data"); return -1; } +#ifdef VERIFY_HEADER if(msg_check_number(fd, MSG_MAGIC_END) == -1) { if(msg->data) @@ -140,11 +143,13 @@ int msg_read(int fd, tunnel_msg_t* msg) M_ERROR(MODULE_NAME, "Unable to check end magic number"); return -1; } +#endif return 0; } int msg_write(int fd, tunnel_msg_t* msg) { +#ifdef VERIFY_HEADER // write begin magic number int number = MSG_MAGIC_BEGIN; if(write(fd,&number, sizeof(number)) == -1) @@ -152,6 +157,7 @@ int msg_write(int fd, tunnel_msg_t* msg) M_ERROR(MODULE_NAME, "Unable to write begin magic number: %s", strerror(errno)); return -1; } +#endif // write type if(write(fd,&msg->header.type, sizeof(msg->header.type)) == -1) { @@ -186,11 +192,13 @@ int msg_write(int fd, tunnel_msg_t* msg) return -1; } } +#ifdef VERIFY_HEADER number = MSG_MAGIC_END; if(write(fd,&number, sizeof(number)) == -1) { M_ERROR(MODULE_NAME, "Unable to write end magic number: %s", strerror(errno)); return -1; } +#endif return 0; } \ No newline at end of file diff --git a/tunnel.h b/tunnel.h index 90f04ac..b6896e3 100644 --- a/tunnel.h +++ b/tunnel.h @@ -6,8 +6,10 @@ #define MAX_CHANNEL_PATH 108 #define MAX_CHANNEL_NAME 64 +#ifdef VERIFY_HEADER #define MSG_MAGIC_BEGIN 0x414e5444 //ANTD #define MSG_MAGIC_END 0x44544e41 //DTNA +#endif #define CHANNEL_OK (uint8_t)0x0 #define CHANNEL_ERROR (uint8_t)0x1