From 1ff714838c03cba1a18884d5b48a20ee6c4275ac Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期五, 21 五月 2021 15:00:53 +0800
Subject: [PATCH] class MsgI, ShmMsgQueue, no bind to shm.

---
 src/defs.h |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/defs.h b/src/defs.h
index 51040e6..b117579 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -23,6 +23,7 @@
 #include <atomic>
 #include <string>
 
+class ShmSocket;
 typedef uint64_t MQId;
 
 int64_t CalcAllocIndex(int64_t size);
@@ -50,21 +51,25 @@
 class SharedMemory;
 } // namespace bhome_shm
 
+using bhome_shm::SharedMemory;
+
 std::string BHomeShmName();
-bhome_shm::SharedMemory &BHomeShm();
-CenterInfo *GetCenterInfo(bhome_shm::SharedMemory &shm);
-bool CenterInit(bhome_shm::SharedMemory &shm);
-bool GlobalInit(bhome_shm::SharedMemory &shm);
+SharedMemory &BHomeShm();
+CenterInfo *GetCenterInfo(SharedMemory &shm);
+ShmSocket &DefaultSender(SharedMemory &shm);
+
+MQId NewSession();
+bool CenterInit(SharedMemory &shm);
+bool GlobalInit(SharedMemory &shm);
 typedef std::string Topic;
 void SetLastError(const int ec, const std::string &msg);
 void GetLastError(int &ec, std::string &msg);
 //TODO center can check shm for previous crash.
 
-const MQInfo &BHGlobalSenderAddress();
-const MQInfo &BHTopicCenterAddress();
-const MQInfo &BHTopicBusAddress();
-bool BHNodeInit(const int64_t request, int64_t &reply);
-void BHCenterHandleInit(std::function<int64_t(const int64_t)> const &onReq);
+const MQInfo &BHTopicCenterAddress(SharedMemory &shm);
+const MQInfo &BHTopicBusAddress(SharedMemory &shm);
+bool BHNodeInit(SharedMemory &shm, const int64_t request, int64_t &reply);
+void BHCenterHandleInit(SharedMemory &shm, std::function<int64_t(const int64_t)> const &onReq);
 
 // node mq is avail with in timeout; after that may get killed.
 int NodeTimeoutSec();

--
Gitblit v1.8.0