Skip to content

Commit

Permalink
Put echo protocol implementation under namespace 'Echo' to align with…
Browse files Browse the repository at this point in the history
… other protocols (#4455)
  • Loading branch information
yufengwangca authored Jan 26, 2021
1 parent 12aea86 commit 2097bcc
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/messaging/tests/TestReliableMessageProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void CheckResendMessage(nlTestSuite * inSuite, void * inContext)

gSendMessageCount = 0;

err = exchange->SendMessage(kProtocol_Echo, kEchoMessageType_EchoRequest, std::move(buffer),
err = exchange->SendMessage(kProtocol_Echo, Echo::kEchoMessageType_EchoRequest, std::move(buffer),
Messaging::SendFlags(Messaging::SendMessageFlags::kNone));
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

Expand Down
2 changes: 1 addition & 1 deletion src/messaging/tests/echo/echo_requester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ constexpr size_t kMaxEchoCount = 3;
constexpr int32_t gEchoInterval = 1000;

// The EchoClient object.
chip::Protocols::EchoClient gEchoClient;
chip::Protocols::Echo::EchoClient gEchoClient;

chip::TransportMgr<chip::Transport::UDP> gUDPManager;
chip::TransportMgr<chip::Transport::TCP<kMaxTcpActiveConnectionCount, kMaxTcpPendingPackets>> gTCPManager;
Expand Down
2 changes: 1 addition & 1 deletion src/messaging/tests/echo/echo_responder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
namespace {

// The EchoServer object.
chip::Protocols::EchoServer gEchoServer;
chip::Protocols::Echo::EchoServer gEchoServer;
chip::TransportMgr<chip::Transport::UDP> gUDPManager;
chip::TransportMgr<chip::Transport::TCP<kMaxTcpActiveConnectionCount, kMaxTcpPendingPackets>> gTCPManager;
chip::SecureSessionMgr gSessionManager;
Expand Down
2 changes: 2 additions & 0 deletions src/protocols/echo/Echo.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

namespace chip {
namespace Protocols {
namespace Echo {

enum
{
Expand Down Expand Up @@ -145,5 +146,6 @@ class DLL_EXPORT EchoServer : public Messaging::ExchangeDelegate
void OnResponseTimeout(Messaging::ExchangeContext * ec) override {}
};

} // namespace Echo
} // namespace Protocols
} // namespace chip
2 changes: 2 additions & 0 deletions src/protocols/echo/EchoClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace chip {
namespace Protocols {
namespace Echo {

CHIP_ERROR EchoClient::Init(Messaging::ExchangeManager * exchangeMgr, SecureSessionHandle session)
{
Expand Down Expand Up @@ -120,5 +121,6 @@ void EchoClient::OnResponseTimeout(Messaging::ExchangeContext * ec)
ChipLogProgress(Echo, "Time out! failed to receive echo response from Exchange: %p", ec);
}

} // namespace Echo
} // namespace Protocols
} // namespace chip
2 changes: 2 additions & 0 deletions src/protocols/echo/EchoServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace chip {
namespace Protocols {
namespace Echo {

CHIP_ERROR EchoServer::Init(Messaging::ExchangeManager * exchangeMgr)
{
Expand Down Expand Up @@ -85,5 +86,6 @@ void EchoServer::OnMessageReceived(Messaging::ExchangeContext * ec, const Packet
ec->Close();
}

} // namespace Echo
} // namespace Protocols
} // namespace chip
6 changes: 3 additions & 3 deletions src/transport/tests/TestSecureSessionMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void SendEncryptedPacketTest(nlTestSuite * inSuite, void * inContext)
payloadHeader.SetProtocolID(chip::Protocols::kProtocol_Echo);

// Set the message type for this header.
payloadHeader.SetMessageType(chip::Protocols::kEchoMessageType_EchoRequest);
payloadHeader.SetMessageType(chip::Protocols::Echo::kEchoMessageType_EchoRequest);

payloadHeader.SetInitiator(true);

Expand Down Expand Up @@ -320,10 +320,10 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext)
payloadHeader.SetExchangeID(0);

// Set the protocol ID for this header.
payloadHeader.SetProtocolID(chip::Protocols::kProtocol_Echo);
payloadHeader.SetProtocolID(Protocols::kProtocol_Echo);

// Set the message type for this header.
payloadHeader.SetMessageType(chip::Protocols::kEchoMessageType_EchoRequest);
payloadHeader.SetMessageType(Protocols::Echo::kEchoMessageType_EchoRequest);

payloadHeader.SetInitiator(true);

Expand Down

0 comments on commit 2097bcc

Please sign in to comment.