From 34ddc11240baa01d15b24f09e39d09cb4dd15c75 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期二, 13 十月 2020 10:41:20 +0800 Subject: [PATCH] update --- src/socket/net_mod_socket.h | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/socket/net_mod_socket.h b/src/socket/net_mod_socket.h index 4ace2bb..a155c29 100644 --- a/src/socket/net_mod_socket.h +++ b/src/socket/net_mod_socket.h @@ -4,6 +4,12 @@ #include "shm_mod_socket.h" #include "socket_io.h" +#define GET(p) (*(uint32_t *)(p)) +#define PUT(p, val) (*(uint32_t *)(p) = (val)) + +#define NET_MODE_REQUEST_HEAD_LENGTH 12 +#define NET_MODE_RESPONSE_HEAD_LENGTH 4 + struct net_node_t { const char *host; @@ -13,8 +19,8 @@ struct net_mod_request_head_t { - socket_mod_t mod; - int key; + uint32_t mod; + uint32_t key; uint32_t content_length; }; @@ -31,7 +37,7 @@ int port; int key; void *content; - uint32_t content_length; + int content_length; }; @@ -48,9 +54,16 @@ ~NetModSocket(); - static void free_recv_msg_arr(net_mod_recv_msg_t * arr, size_t size); + static void free_recv_msg_arr(net_mod_recv_msg_t * arr, size_t size); + + static void * encode_request_head(net_mod_request_head_t & request); + static net_mod_request_head_t decode_request_head(void *headbs); + + static void * encode_response_head(net_mod_response_head_t & response); + static net_mod_response_head_t decode_response_head(void *_headbs); }; + #endif \ No newline at end of file -- Gitblit v1.8.0