From 01e202b60cc8aceb65fd6c82949e2a2b08142f8c Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期一, 18 一月 2021 10:44:50 +0800
Subject: [PATCH] ADD EBUS_NET

---
 src/socket/shm_mod_socket.h |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/socket/shm_mod_socket.h b/src/socket/shm_mod_socket.h
index 5c66fbb..73c91c3 100644
--- a/src/socket/shm_mod_socket.h
+++ b/src/socket/shm_mod_socket.h
@@ -11,23 +11,42 @@
 #include <set>
 #include "socket_def.h"
 
+#define BUS_HEAD_SIZE (64 + 2 * sizeof(uint32_t))
+class BusServerSocket;
+
+struct bus_head_t
+{
+	char action[64];
+	uint32_t topic_size;
+	uint32_t content_size;
+};
+
+
 class ShmModSocket {
+friend class BusServerSocket;
 private:
 	shm_socket_t *shm_socket;
-  socket_mod_t mod;
   
 	std::set<int> *bus_set;
 
 private:
-	inline int _recvfrom_(void **buf, int *size, int *key,  struct timespec *timeout, int flags);
 	 
 	int _sub_( char *topic, int size, int key, struct timespec *timeout, int flags);
 	int _pub_( char *topic, int topic_size, void *content, int content_size, int key, struct timespec *timeout, int flags);
 
 	int  _desub_( char *topic, int size, int key, struct timespec *timeout, int flags);
 
+
+	static int get_bus_sendbuf(bus_head_t &request_head, void *topic_buf, int topic_size, void *content_buf, int content_size, void **retbuf);
+
 public:
 	static size_t remove_keys(int keys[], size_t length);
+
+  // bus header 缂栫爜涓虹綉缁滀紶杈撶殑瀛楄妭
+  static void * encode_bus_head(bus_head_t & bushead);
+  // 瑙g爜 bus  header
+  static bus_head_t  decode_bus_head(void *headbs); 
+  
 public:
 	ShmModSocket();
 	~ShmModSocket();

--
Gitblit v1.8.0