diff --git a/examples/shell/shell_common/cmd_ping.cpp b/examples/shell/shell_common/cmd_ping.cpp index ecc3eebfe69043..8626fe338435c5 100644 --- a/examples/shell/shell_common/cmd_ping.cpp +++ b/examples/shell/shell_common/cmd_ping.cpp @@ -311,8 +311,7 @@ void StartPinging(streamer_t * stream, char * destination) #if INET_CONFIG_ENABLE_TCP_ENDPOINT if (gPingArguments.IsUsingTCP()) { - err = gSessionManager.Init(kTestControllerNodeId, &DeviceLayer::SystemLayer, &gTCPManager, &gFabrics, - &gMessageCounterManager); + err = gSessionManager.Init(&DeviceLayer::SystemLayer, &gTCPManager, &gFabrics, &gMessageCounterManager); SuccessOrExit(err); err = gExchangeManager.Init(&gSessionManager); @@ -321,8 +320,7 @@ void StartPinging(streamer_t * stream, char * destination) else #endif { - err = gSessionManager.Init(kTestControllerNodeId, &DeviceLayer::SystemLayer, &gUDPManager, &gFabrics, - &gMessageCounterManager); + err = gSessionManager.Init(&DeviceLayer::SystemLayer, &gUDPManager, &gFabrics, &gMessageCounterManager); SuccessOrExit(err); err = gExchangeManager.Init(&gSessionManager); diff --git a/examples/shell/shell_common/cmd_send.cpp b/examples/shell/shell_common/cmd_send.cpp index 0f396a2cc7ba60..f45b744df47c41 100644 --- a/examples/shell/shell_common/cmd_send.cpp +++ b/examples/shell/shell_common/cmd_send.cpp @@ -231,8 +231,7 @@ void ProcessCommand(streamer_t * stream, char * destination) { peerAddress = Transport::PeerAddress::TCP(gDestAddr, gSendArguments.GetPort()); - err = - gSessionManager.Init(kTestControllerNodeId, &DeviceLayer::SystemLayer, &gTCPManager, &fabrics, &gMessageCounterManager); + err = gSessionManager.Init(&DeviceLayer::SystemLayer, &gTCPManager, &fabrics, &gMessageCounterManager); SuccessOrExit(err); } else @@ -240,8 +239,7 @@ void ProcessCommand(streamer_t * stream, char * destination) { peerAddress = Transport::PeerAddress::UDP(gDestAddr, gSendArguments.GetPort(), INET_NULL_INTERFACEID); - err = - gSessionManager.Init(kTestControllerNodeId, &DeviceLayer::SystemLayer, &gUDPManager, &fabrics, &gMessageCounterManager); + err = gSessionManager.Init(&DeviceLayer::SystemLayer, &gUDPManager, &fabrics, &gMessageCounterManager); SuccessOrExit(err); } diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 6cd072919b190f..9592972add22f6 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -504,7 +504,7 @@ void InitServer(AppDelegate * delegate) SuccessOrExit(err); - err = gSessions.Init(chip::kTestDeviceNodeId, &DeviceLayer::SystemLayer, &gTransports, &gFabrics, &gMessageCounterManager); + err = gSessions.Init(&DeviceLayer::SystemLayer, &gTransports, &gFabrics, &gMessageCounterManager); SuccessOrExit(err); err = gExchangeMgr.Init(&gSessions); diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index 2cc397245fbd4a..5c1c05b1524cf8 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -434,8 +434,7 @@ void InitializeChip(nlTestSuite * apSuite) chip::gSystemLayer.Init(); - err = chip::gSessionManager.Init(chip::kTestDeviceNodeId, &chip::gSystemLayer, &chip::gTransportManager, &fabrics, - &chip::gMessageCounterManager); + err = chip::gSessionManager.Init(&chip::gSystemLayer, &chip::gTransportManager, &fabrics, &chip::gMessageCounterManager); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = chip::gExchangeManager.Init(&chip::gSessionManager); diff --git a/src/app/tests/TestEventLogging.cpp b/src/app/tests/TestEventLogging.cpp index bc05b3ac9bbe81..36068a58526cd9 100644 --- a/src/app/tests/TestEventLogging.cpp +++ b/src/app/tests/TestEventLogging.cpp @@ -81,7 +81,7 @@ void InitializeChip(nlTestSuite * apSuite) gSystemLayer.Init(); - err = gSessionManager.Init(kTestDeviceNodeId1, &gSystemLayer, &gTransportManager, &fabrics, &gMessageCounterManager); + err = gSessionManager.Init(&gSystemLayer, &gTransportManager, &fabrics, &gMessageCounterManager); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = gExchangeManager.Init(&gSessionManager); diff --git a/src/app/tests/TestInteractionModelEngine.cpp b/src/app/tests/TestInteractionModelEngine.cpp index 3cca9889c45a0e..89494b4f7cce6d 100644 --- a/src/app/tests/TestInteractionModelEngine.cpp +++ b/src/app/tests/TestInteractionModelEngine.cpp @@ -119,7 +119,7 @@ void InitializeChip(nlTestSuite * apSuite) gSystemLayer.Init(); - err = gSessionManager.Init(chip::kTestDeviceNodeId, &gSystemLayer, &gTransportManager, &fabrics, &gMessageCounterManager); + err = gSessionManager.Init(&gSystemLayer, &gTransportManager, &fabrics, &gMessageCounterManager); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = gExchangeManager.Init(&gSessionManager); diff --git a/src/app/tests/TestReportingEngine.cpp b/src/app/tests/TestReportingEngine.cpp index 1b5b3ab0acdc57..f7c9cbf482013e 100644 --- a/src/app/tests/TestReportingEngine.cpp +++ b/src/app/tests/TestReportingEngine.cpp @@ -158,8 +158,7 @@ void InitializeChip(nlTestSuite * apSuite) chip::gSystemLayer.Init(); - err = chip::gSessionManager.Init(chip::kTestDeviceNodeId, &chip::gSystemLayer, &chip::gTransportManager, &fabrics, - &chip::gMessageCounterManager); + err = chip::gSessionManager.Init(&chip::gSystemLayer, &chip::gTransportManager, &fabrics, &chip::gMessageCounterManager); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = chip::gExchangeManager.Init(&chip::gSessionManager); diff --git a/src/app/tests/integration/chip_im_initiator.cpp b/src/app/tests/integration/chip_im_initiator.cpp index a8a108e2bcaf2e..9e3a8d544f5ea0 100644 --- a/src/app/tests/integration/chip_im_initiator.cpp +++ b/src/app/tests/integration/chip_im_initiator.cpp @@ -574,8 +574,7 @@ int main(int argc, char * argv[]) .SetListenPort(IM_CLIENT_PORT)); SuccessOrExit(err); - err = gSessionManager.Init(chip::kTestControllerNodeId, &chip::DeviceLayer::SystemLayer, &gTransportManager, &fabrics, - &gMessageCounterManager); + err = gSessionManager.Init(&chip::DeviceLayer::SystemLayer, &gTransportManager, &fabrics, &gMessageCounterManager); SuccessOrExit(err); err = gExchangeManager.Init(&gSessionManager); diff --git a/src/app/tests/integration/chip_im_responder.cpp b/src/app/tests/integration/chip_im_responder.cpp index 773d4f683b7e21..93e9dc2a56f13c 100644 --- a/src/app/tests/integration/chip_im_responder.cpp +++ b/src/app/tests/integration/chip_im_responder.cpp @@ -180,8 +180,7 @@ int main(int argc, char * argv[]) chip::Transport::UdpListenParameters(&chip::DeviceLayer::InetLayer).SetAddressType(chip::Inet::kIPAddressType_IPv4)); SuccessOrExit(err); - err = gSessionManager.Init(chip::kTestDeviceNodeId, &chip::DeviceLayer::SystemLayer, &gTransportManager, &fabrics, - &gMessageCounterManager); + err = gSessionManager.Init(&chip::DeviceLayer::SystemLayer, &gTransportManager, &fabrics, &gMessageCounterManager); SuccessOrExit(err); err = gExchangeManager.Init(&gSessionManager); diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 10f42ee7a10f47..77af68346b9260 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -172,7 +172,7 @@ CHIP_ERROR DeviceController::Init(NodeId localDeviceId, ControllerInitParams par ReturnErrorOnFailure(mFabrics.LoadFromStorage(mFabricIndex)); - ReturnErrorOnFailure(mSessionMgr->Init(localDeviceId, mSystemLayer, mTransportMgr, &mFabrics, mMessageCounterManager)); + ReturnErrorOnFailure(mSessionMgr->Init(mSystemLayer, mTransportMgr, &mFabrics, mMessageCounterManager)); ReturnErrorOnFailure(mExchangeMgr->Init(mSessionMgr)); diff --git a/src/messaging/tests/MessagingContext.cpp b/src/messaging/tests/MessagingContext.cpp index 444779628ee007..2f1a035dbc96ad 100644 --- a/src/messaging/tests/MessagingContext.cpp +++ b/src/messaging/tests/MessagingContext.cpp @@ -35,8 +35,7 @@ CHIP_ERROR MessagingContext::Init(nlTestSuite * suite, TransportMgrBase * transp chip::Transport::FabricInfo * destNodeFabric = mFabrics.AssignFabricIndex(mDestFabricIndex, GetDestinationNodeId()); VerifyOrReturnError(destNodeFabric != nullptr, CHIP_ERROR_NO_MEMORY); - ReturnErrorOnFailure( - mSecureSessionMgr.Init(GetSourceNodeId(), &GetSystemLayer(), transport, &mFabrics, &mMessageCounterManager)); + ReturnErrorOnFailure(mSecureSessionMgr.Init(&GetSystemLayer(), transport, &mFabrics, &mMessageCounterManager)); ReturnErrorOnFailure(mExchangeManager.Init(&mSecureSessionMgr)); ReturnErrorOnFailure(mMessageCounterManager.Init(&mExchangeManager)); diff --git a/src/messaging/tests/echo/echo_requester.cpp b/src/messaging/tests/echo/echo_requester.cpp index 20e932326e8421..38ffe990d99591 100644 --- a/src/messaging/tests/echo/echo_requester.cpp +++ b/src/messaging/tests/echo/echo_requester.cpp @@ -238,8 +238,7 @@ int main(int argc, char * argv[]) .SetListenPort(ECHO_CLIENT_PORT)); SuccessOrExit(err); - err = gSessionManager.Init(chip::kTestControllerNodeId, &chip::DeviceLayer::SystemLayer, &gTCPManager, &fabrics, - &gMessageCounterManager); + err = gSessionManager.Init(&chip::DeviceLayer::SystemLayer, &gTCPManager, &fabrics, &gMessageCounterManager); SuccessOrExit(err); } else @@ -249,8 +248,7 @@ int main(int argc, char * argv[]) .SetListenPort(ECHO_CLIENT_PORT)); SuccessOrExit(err); - err = gSessionManager.Init(chip::kTestControllerNodeId, &chip::DeviceLayer::SystemLayer, &gUDPManager, &fabrics, - &gMessageCounterManager); + err = gSessionManager.Init(&chip::DeviceLayer::SystemLayer, &gUDPManager, &fabrics, &gMessageCounterManager); SuccessOrExit(err); } diff --git a/src/messaging/tests/echo/echo_responder.cpp b/src/messaging/tests/echo/echo_responder.cpp index 0afaf4941fcc3e..9cc2e15d7bdd84 100644 --- a/src/messaging/tests/echo/echo_responder.cpp +++ b/src/messaging/tests/echo/echo_responder.cpp @@ -93,8 +93,7 @@ int main(int argc, char * argv[]) chip::Transport::TcpListenParameters(&chip::DeviceLayer::InetLayer).SetAddressType(chip::Inet::kIPAddressType_IPv4)); SuccessOrExit(err); - err = gSessionManager.Init(chip::kTestDeviceNodeId, &chip::DeviceLayer::SystemLayer, &gTCPManager, &fabrics, - &gMessageCounterManager); + err = gSessionManager.Init(&chip::DeviceLayer::SystemLayer, &gTCPManager, &fabrics, &gMessageCounterManager); SuccessOrExit(err); } else @@ -103,8 +102,7 @@ int main(int argc, char * argv[]) chip::Transport::UdpListenParameters(&chip::DeviceLayer::InetLayer).SetAddressType(chip::Inet::kIPAddressType_IPv4)); SuccessOrExit(err); - err = gSessionManager.Init(chip::kTestDeviceNodeId, &chip::DeviceLayer::SystemLayer, &gUDPManager, &fabrics, - &gMessageCounterManager); + err = gSessionManager.Init(&chip::DeviceLayer::SystemLayer, &gUDPManager, &fabrics, &gMessageCounterManager); SuccessOrExit(err); } diff --git a/src/transport/SecureSessionMgr.cpp b/src/transport/SecureSessionMgr.cpp index 34c372f6d31b66..4750398a1d3ffc 100644 --- a/src/transport/SecureSessionMgr.cpp +++ b/src/transport/SecureSessionMgr.cpp @@ -71,15 +71,13 @@ SecureSessionMgr::~SecureSessionMgr() CancelExpiryTimer(); } -CHIP_ERROR SecureSessionMgr::Init(NodeId localNodeId, System::Layer * systemLayer, TransportMgrBase * transportMgr, - Transport::FabricTable * fabrics, +CHIP_ERROR SecureSessionMgr::Init(System::Layer * systemLayer, TransportMgrBase * transportMgr, Transport::FabricTable * fabrics, Transport::MessageCounterManagerInterface * messageCounterManager) { VerifyOrReturnError(mState == State::kNotReady, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(transportMgr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); mState = State::kInitialized; - mLocalNodeId = localNodeId; mSystemLayer = systemLayer; mTransportMgr = transportMgr; mFabrics = fabrics; @@ -87,8 +85,6 @@ CHIP_ERROR SecureSessionMgr::Init(NodeId localNodeId, System::Layer * systemLaye mGlobalEncryptedMessageCounter.Init(); - ChipLogProgress(Inet, "local node id is 0x" ChipLogFormatX64, ChipLogValueX64(mLocalNodeId)); - ScheduleExpiryTimer(); mTransportMgr->SetSecureSessionMgr(this); @@ -103,7 +99,6 @@ void SecureSessionMgr::Shutdown() mMessageCounterManager = nullptr; mState = State::kNotReady; - mLocalNodeId = kUndefinedNodeId; mSystemLayer = nullptr; mTransportMgr = nullptr; mFabrics = nullptr; diff --git a/src/transport/SecureSessionMgr.h b/src/transport/SecureSessionMgr.h index 142920ead7cec8..b77c779791beb3 100644 --- a/src/transport/SecureSessionMgr.h +++ b/src/transport/SecureSessionMgr.h @@ -236,14 +236,13 @@ class DLL_EXPORT SecureSessionMgr : public TransportMgrDelegate * @brief * Initialize a Secure Session Manager * - * @param localNodeId Node id for the current node * @param systemLayer System, layer to use * @param transportMgr Transport to use * @param fabrics A table of device administrators * @param messageCounterManager The message counter manager */ - CHIP_ERROR Init(NodeId localNodeId, System::Layer * systemLayer, TransportMgrBase * transportMgr, - Transport::FabricTable * fabrics, Transport::MessageCounterManagerInterface * messageCounterManager); + CHIP_ERROR Init(System::Layer * systemLayer, TransportMgrBase * transportMgr, Transport::FabricTable * fabrics, + Transport::MessageCounterManagerInterface * messageCounterManager); /** * @brief @@ -252,16 +251,6 @@ class DLL_EXPORT SecureSessionMgr : public TransportMgrDelegate */ void Shutdown(); - /** - * @brief - * Set local node ID - * - * @param nodeId Node id for the current node - */ - void SetLocalNodeId(NodeId nodeId) { mLocalNodeId = nodeId; } - - NodeId GetLocalNodeId() { return mLocalNodeId; } - TransportMgrBase * GetTransportManager() const { return mTransportMgr; } /** @@ -290,7 +279,6 @@ class DLL_EXPORT SecureSessionMgr : public TransportMgrDelegate }; System::Layer * mSystemLayer = nullptr; - NodeId mLocalNodeId; // < Id of the current node Transport::PeerConnections mPeerConnections; // < Active connections to other peers State mState; // < Initialization state of the object diff --git a/src/transport/tests/TestSecureSessionMgr.cpp b/src/transport/tests/TestSecureSessionMgr.cpp index 0ef7bdf2a20500..b45fac4ac350c8 100644 --- a/src/transport/tests/TestSecureSessionMgr.cpp +++ b/src/transport/tests/TestSecureSessionMgr.cpp @@ -124,7 +124,7 @@ void CheckSimpleInitTest(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); Transport::FabricTable fabrics; - err = secureSessionMgr.Init(kSourceNodeId, ctx.GetInetLayer().SystemLayer(), &transportMgr, &fabrics, &gMessageCounterManager); + err = secureSessionMgr.Init(ctx.GetInetLayer().SystemLayer(), &transportMgr, &fabrics, &gMessageCounterManager); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); } @@ -153,7 +153,7 @@ void CheckMessageTest(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); Transport::FabricTable fabrics; - err = secureSessionMgr.Init(kSourceNodeId, ctx.GetInetLayer().SystemLayer(), &transportMgr, &fabrics, &gMessageCounterManager); + err = secureSessionMgr.Init(ctx.GetInetLayer().SystemLayer(), &transportMgr, &fabrics, &gMessageCounterManager); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); callback.mSuite = inSuite; @@ -251,7 +251,7 @@ void SendEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); Transport::FabricTable fabrics; - err = secureSessionMgr.Init(kSourceNodeId, ctx.GetInetLayer().SystemLayer(), &transportMgr, &fabrics, &gMessageCounterManager); + err = secureSessionMgr.Init(ctx.GetInetLayer().SystemLayer(), &transportMgr, &fabrics, &gMessageCounterManager); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); callback.mSuite = inSuite; @@ -333,7 +333,7 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); Transport::FabricTable fabrics; - err = secureSessionMgr.Init(kSourceNodeId, ctx.GetInetLayer().SystemLayer(), &transportMgr, &fabrics, &gMessageCounterManager); + err = secureSessionMgr.Init(ctx.GetInetLayer().SystemLayer(), &transportMgr, &fabrics, &gMessageCounterManager); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); callback.mSuite = inSuite;