Skip to content

Commit

Permalink
Rename classes in transport layer (#9814)
Browse files Browse the repository at this point in the history
SecureSession => CryptoContext
PeerConnectionState => SecureSession
PeerConnections => SecureSessionTable
SecureSessionMgr => SessionManager

Co-authored-by: Tennessee Carmel-Veilleux <[email protected]>
  • Loading branch information
kghost and tcarmelveilleux authored Sep 22, 2021
1 parent a5731da commit eca9bff
Show file tree
Hide file tree
Showing 90 changed files with 677 additions and 681 deletions.
4 changes: 2 additions & 2 deletions examples/shell/shell_common/cmd_ping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <protocols/secure_channel/MessageCounterManager.h>
#include <protocols/secure_channel/PASESession.h>
#include <system/SystemPacketBuffer.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/TCP.h>
#include <transport/raw/UDP.h>

Expand Down Expand Up @@ -249,7 +249,7 @@ CHIP_ERROR EstablishSecureSession(streamer_t * stream, const Transport::PeerAddr
peerAddr = Optional<Transport::PeerAddress>::Value(peerAddress);

// Attempt to connect to the peer.
err = gSessionManager.NewPairing(peerAddr, kTestDeviceNodeId, testSecurePairingSecret, SecureSession::SessionRole::kInitiator,
err = gSessionManager.NewPairing(peerAddr, kTestDeviceNodeId, testSecurePairingSecret, CryptoContext::SessionRole::kInitiator,
gFabricIndex);

exit:
Expand Down
4 changes: 2 additions & 2 deletions examples/shell/shell_common/cmd_send.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <protocols/secure_channel/PASESession.h>
#include <system/SystemPacketBuffer.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/TCP.h>
#include <transport/raw/UDP.h>

Expand Down Expand Up @@ -180,7 +180,7 @@ CHIP_ERROR EstablishSecureSession(streamer_t * stream, Transport::PeerAddress &
peerAddr = Optional<Transport::PeerAddress>::Value(peerAddress);

// Attempt to connect to the peer.
err = gSessionManager.NewPairing(peerAddr, kTestDeviceNodeId, testSecurePairingSecret, SecureSession::SessionRole::kInitiator,
err = gSessionManager.NewPairing(peerAddr, kTestDeviceNodeId, testSecurePairingSecret, CryptoContext::SessionRole::kInitiator,
gFabricIndex);

exit:
Expand Down
2 changes: 1 addition & 1 deletion examples/shell/shell_common/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

chip::secure_channel::MessageCounterManager gMessageCounterManager;
chip::Messaging::ExchangeManager gExchangeManager;
chip::SecureSessionMgr gSessionManager;
chip::SessionManager gSessionManager;
chip::Inet::IPAddress gDestAddr;

chip::FabricIndex gFabricIndex = 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/shell/shell_common/include/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <lib/core/CHIPCore.h>
#include <messaging/ExchangeMgr.h>
#include <protocols/secure_channel/MessageCounterManager.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/TCP.h>
#include <transport/raw/UDP.h>

Expand All @@ -32,7 +32,7 @@ constexpr size_t kResponseTimeOut = 1000;

extern chip::secure_channel::MessageCounterManager gMessageCounterManager;
extern chip::Messaging::ExchangeManager gExchangeManager;
extern chip::SecureSessionMgr gSessionManager;
extern chip::SessionManager gSessionManager;
extern chip::Inet::IPAddress gDestAddr;

extern chip::FabricIndex gFabricIndex;
Expand Down
4 changes: 2 additions & 2 deletions src/app/ReadClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ CHIP_ERROR ReadClient::RefreshLivenessCheckTimer()
{
CancelLivenessCheckTimer();
ChipLogProgress(DataManagement, "Refresh LivenessCheckTime with %d seconds", mMaxIntervalCeilingSeconds);
CHIP_ERROR err = InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionMgr()->SystemLayer()->StartTimer(
CHIP_ERROR err = InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->StartTimer(
mMaxIntervalCeilingSeconds * kMillisecondsPerSecond, OnLivenessTimeoutCallback, this);

if (err != CHIP_NO_ERROR)
Expand All @@ -545,7 +545,7 @@ CHIP_ERROR ReadClient::RefreshLivenessCheckTimer()

void ReadClient::CancelLivenessCheckTimer()
{
InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionMgr()->SystemLayer()->CancelTimer(
InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->CancelTimer(
OnLivenessTimeoutCallback, this);
}

Expand Down
6 changes: 3 additions & 3 deletions src/app/ReadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void ReadHandler::Shutdown(ShutdownOptions aOptions)
{
if (IsSubscriptionType())
{
InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionMgr()->SystemLayer()->CancelTimer(
InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->CancelTimer(
OnRefreshSubscribeTimerSyncCallback, this);
}
if (aOptions == ShutdownOptions::AbortCurrentExchange)
Expand Down Expand Up @@ -573,10 +573,10 @@ void ReadHandler::OnRefreshSubscribeTimerSyncCallback(System::Layer * apSystemLa
CHIP_ERROR ReadHandler::RefreshSubscribeSyncTimer()
{
ChipLogProgress(DataManagement, "ReadHandler::Refresh Subscribe Sync Timer with %d seconds", mMinIntervalFloorSeconds);
InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionMgr()->SystemLayer()->CancelTimer(
InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->CancelTimer(
OnRefreshSubscribeTimerSyncCallback, this);
mHoldReport = true;
return InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionMgr()->SystemLayer()->StartTimer(
return InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->StartTimer(
mMinIntervalFloorSeconds * kMillisecondsPerSecond, OnRefreshSubscribeTimerSyncCallback, this);
}
} // namespace app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class FabricCleanupExchangeDelegate : public Messaging::ExchangeDelegate
void OnExchangeClosing(Messaging::ExchangeContext * ec) override
{
FabricIndex currentFabricIndex = ec->GetSecureSession().GetFabricIndex();
ec->GetExchangeMgr()->GetSessionMgr()->ExpireAllPairingsForFabric(currentFabricIndex);
ec->GetExchangeMgr()->GetSessionManager()->ExpireAllPairingsForFabric(currentFabricIndex);
}
};

Expand Down Expand Up @@ -287,7 +287,7 @@ bool emberAfOperationalCredentialsClusterRemoveFabricCallback(EndpointId endpoin
}
else
{
ec->GetExchangeMgr()->GetSessionMgr()->ExpireAllPairingsForFabric(fabricBeingRemoved);
ec->GetExchangeMgr()->GetSessionManager()->ExpireAllPairingsForFabric(fabricBeingRemoved);
}
}
return true;
Expand Down
3 changes: 2 additions & 1 deletion src/app/reporting/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ CHIP_ERROR Engine::ScheduleRun()
{
if (InteractionModelEngine::GetInstance()->GetExchangeManager() != nullptr)
{
return InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionMgr()->SystemLayer()->ScheduleWork(Run, this);
return InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->ScheduleWork(Run,
this);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/server/CommissioningWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void CommissioningWindowManager::OnSessionEstablished()
{
CHIP_ERROR err = mServer->GetSecureSessionManager().NewPairing(
Optional<Transport::PeerAddress>::Value(mPairingSession.GetPeerAddress()), mPairingSession.GetPeerNodeId(),
&mPairingSession, SecureSession::SessionRole::kResponder, 0);
&mPairingSession, CryptoContext::SessionRole::kResponder, 0);
if (err != CHIP_NO_ERROR)
{
ChipLogError(AppServer, "Commissioning failed while setting up secure channel: err %s", ErrorStr(err));
Expand Down
4 changes: 2 additions & 2 deletions src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <system/SystemPacketBuffer.h>
#include <system/TLVPacketBufferBackingStore.h>
#include <transport/FabricTable.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>

using chip::RendezvousInformationFlag;
using chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr;
Expand Down Expand Up @@ -242,7 +242,7 @@ CHIP_ERROR Server::AddTestCommissioning()
testSession = chip::Platform::New<PASESession>();
testSession->FromSerializable(serializedTestSession);
SuccessOrExit(err = mSessions.NewPairing(Optional<PeerAddress>{ PeerAddress::Uninitialized() }, chip::kTestControllerNodeId,
testSession, SecureSession::SessionRole::kResponder, kMinValidFabricIndex));
testSession, CryptoContext::SessionRole::kResponder, kMinValidFabricIndex));

exit:
if (testSession)
Expand Down
6 changes: 3 additions & 3 deletions src/app/server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <protocols/secure_channel/RendezvousParameters.h>
#include <protocols/user_directed_commissioning/UserDirectedCommissioning.h>
#include <transport/FabricTable.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/TransportMgr.h>
#include <transport/TransportMgrBase.h>
#include <transport/raw/BLE.h>
Expand Down Expand Up @@ -67,7 +67,7 @@ class Server : public Messaging::ExchangeDelegate

SessionIDAllocator & GetSessionIDAllocator() { return mSessionIDAllocator; }

SecureSessionMgr & GetSecureSessionManager() { return mSessions; }
SessionManager & GetSecureSessionManager() { return mSessions; }

TransportMgrBase & GetTransportManager() { return mTransports; }

Expand Down Expand Up @@ -111,7 +111,7 @@ class Server : public Messaging::ExchangeDelegate
AppDelegate * mAppDelegate = nullptr;

ServerTransportMgr mTransports;
SecureSessionMgr mSessions;
SessionManager mSessions;
CASEServer mCASEServer;
Messaging::ExchangeManager mExchangeMgr;
Transport::FabricTable mFabrics;
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/TestCommandInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@
#include <system/SystemLayerImpl.h>
#include <system/SystemPacketBuffer.h>
#include <system/TLVPacketBufferBackingStore.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/UDP.h>

#include <nlunit-test.h>

namespace chip {
static System::LayerImpl gSystemLayer;
static SecureSessionMgr gSessionManager;
static SessionManager gSessionManager;
static Messaging::ExchangeManager gExchangeManager;
static TransportMgr<Transport::UDP> gTransportManager;
static secure_channel::MessageCounterManager gMessageCounterManager;
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/TestEventLogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <system/SystemLayerImpl.h>
#include <system/SystemPacketBuffer.h>
#include <system/TLVPacketBufferBackingStore.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/UDP.h>

#include <nlunit-test.h>
Expand All @@ -63,7 +63,7 @@ static uint8_t gInfoEventBuffer[128];
static uint8_t gCritEventBuffer[128];
static chip::app::CircularEventBuffer gCircularEventBuffer[3];

chip::SecureSessionMgr gSessionManager;
chip::SessionManager gSessionManager;
chip::Messaging::ExchangeManager gExchangeManager;
chip::secure_channel::MessageCounterManager gMessageCounterManager;

Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/TestInteractionModelEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
#include <system/SystemLayerImpl.h>
#include <system/SystemPacketBuffer.h>
#include <system/TLVPacketBufferBackingStore.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/UDP.h>

#include <nlunit-test.h>

namespace {
static chip::System::LayerImpl gSystemLayer;
static chip::SecureSessionMgr gSessionManager;
static chip::SessionManager gSessionManager;
static chip::Messaging::ExchangeManager gExchangeManager;
static chip::secure_channel::MessageCounterManager gMessageCounterManager;
static chip::TransportMgr<chip::Transport::UDP> gTransportManager;
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/TestReadInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <protocols/secure_channel/PASESession.h>
#include <system/SystemPacketBuffer.h>
#include <system/TLVPacketBufferBackingStore.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/UDP.h>
#include <transport/raw/tests/NetworkTestHelpers.h>
#include <type_traits>
Expand Down Expand Up @@ -1132,7 +1132,7 @@ int Initialize(void * aContext)
VerifyOrReturnError(ctx->Init(&sSuite, &gTransportManager, &gIOContext) == CHIP_NO_ERROR, FAILURE);

InitializeEventLogging(ctx->GetExchangeManager());
gTransportManager.SetSecureSessionMgr(&ctx->GetSecureSessionManager());
gTransportManager.SetSessionManager(&ctx->GetSecureSessionManager());
return SUCCESS;
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/TestReportingEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
#include <system/SystemLayerImpl.h>
#include <system/SystemPacketBuffer.h>
#include <system/TLVPacketBufferBackingStore.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/UDP.h>

#include <nlunit-test.h>

namespace chip {
static System::LayerImpl gSystemLayer;
static SecureSessionMgr gSessionManager;
static SessionManager gSessionManager;
static Messaging::ExchangeManager gExchangeManager;
static TransportMgr<Transport::UDP> gTransportManager;
static secure_channel::MessageCounterManager gMessageCounterManager;
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/TestWriteInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <protocols/secure_channel/PASESession.h>
#include <system/SystemPacketBuffer.h>
#include <system/TLVPacketBufferBackingStore.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/UDP.h>
#include <transport/raw/tests/NetworkTestHelpers.h>

Expand Down Expand Up @@ -360,7 +360,7 @@ int Initialize(void * aContext)
auto * ctx = static_cast<TestContext *>(aContext);
VerifyOrReturnError(ctx->Init(&sSuite, &gTransportManager, &gIOContext) == CHIP_NO_ERROR, FAILURE);

gTransportManager.SetSecureSessionMgr(&ctx->GetSecureSessionManager());
gTransportManager.SetSessionManager(&ctx->GetSecureSessionManager());
return SUCCESS;
}

Expand Down
6 changes: 3 additions & 3 deletions src/app/tests/integration/MockEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <protocols/secure_channel/PASESession.h>
#include <system/SystemPacketBuffer.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>

static uint64_t kLivenessDeviceStatus = chip::TLV::ContextTag(1);
static bool gMockEventStop = false;
Expand Down Expand Up @@ -154,7 +154,7 @@ CHIP_ERROR MockEventGeneratorImpl::Init(chip::Messaging::ExchangeManager * apExc
mEventsLeft = mpEventGenerator->GetNumStates();

if (mTimeBetweenEvents != 0)
mpExchangeMgr->GetSessionMgr()->SystemLayer()->StartTimer(mTimeBetweenEvents, HandleNextEvent, this);
mpExchangeMgr->GetSessionManager()->SystemLayer()->StartTimer(mTimeBetweenEvents, HandleNextEvent, this);

return err;
}
Expand Down Expand Up @@ -186,7 +186,7 @@ void MockEventGeneratorImpl::SetEventGeneratorStop()
// This helps quit the standalone app in an orderly way without
// spurious leaked timers.
if (mTimeBetweenEvents != 0)
mpExchangeMgr->GetSessionMgr()->SystemLayer()->StartTimer(0, HandleNextEvent, this);
mpExchangeMgr->GetSessionManager()->SystemLayer()->StartTimer(0, HandleNextEvent, this);
}

bool MockEventGeneratorImpl::IsEventGeneratorStopped()
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/integration/chip_im_initiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <protocols/secure_channel/PASESession.h>
#include <system/SystemPacketBuffer.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/UDP.h>

#define IM_CLIENT_PORT (CHIP_PORT + 1)
Expand Down Expand Up @@ -326,7 +326,7 @@ CHIP_ERROR EstablishSecureSession()
// Attempt to connect to the peer.
err = gSessionManager.NewPairing(chip::Optional<chip::Transport::PeerAddress>::Value(
chip::Transport::PeerAddress::UDP(gDestAddr, CHIP_PORT, INET_NULL_INTERFACEID)),
chip::kTestDeviceNodeId, testSecurePairingSecret, chip::SecureSession::SessionRole::kInitiator,
chip::kTestDeviceNodeId, testSecurePairingSecret, chip::CryptoContext::SessionRole::kInitiator,
gFabricIndex);

exit:
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/integration/chip_im_responder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <protocols/secure_channel/PASESession.h>
#include <system/SystemPacketBuffer.h>
#include <transport/SecureSessionMgr.h>
#include <transport/SessionManager.h>
#include <transport/raw/UDP.h>

namespace chip {
Expand Down Expand Up @@ -225,7 +225,7 @@ int main(int argc, char * argv[])

InitializeEventLogging(&gExchangeManager);

err = gSessionManager.NewPairing(peer, chip::kTestControllerNodeId, &gTestPairing, chip::SecureSession::SessionRole::kResponder,
err = gSessionManager.NewPairing(peer, chip::kTestControllerNodeId, &gTestPairing, chip::CryptoContext::SessionRole::kResponder,
gFabricIndex);
SuccessOrExit(err);

Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/integration/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <platform/CHIPDeviceLayer.h>

chip::Messaging::ExchangeManager gExchangeManager;
chip::SecureSessionMgr gSessionManager;
chip::SessionManager gSessionManager;
chip::secure_channel::MessageCounterManager gMessageCounterManager;

void InitializeChip(void)
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/integration/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define NETWORK_SLEEP_TIME_MSECS (100 * 1000)

extern chip::Messaging::ExchangeManager gExchangeManager;
extern chip::SecureSessionMgr gSessionManager;
extern chip::SessionManager gSessionManager;
extern chip::secure_channel::MessageCounterManager gMessageCounterManager;

constexpr chip::NodeId kTestNodeId = 0x1ULL;
Expand Down
Loading

0 comments on commit eca9bff

Please sign in to comment.