-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
StandaloneAck handling: Untangle code path for UMH and StandaloneAck (#…
…19443) * StandaloneAck handling: Untangle code path for UMH and StandaloneAck * Fix comments from Boris * Resolve comments
- Loading branch information
Showing
6 changed files
with
147 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2022 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <messaging/ExchangeMessageDispatch.h> | ||
#include <protocols/secure_channel/Constants.h> | ||
|
||
namespace chip { | ||
namespace Messaging { | ||
|
||
class EphemeralExchangeDispatch : public ExchangeMessageDispatch | ||
{ | ||
public: | ||
static ExchangeMessageDispatch & Instance() | ||
{ | ||
static EphemeralExchangeDispatch instance; | ||
return instance; | ||
} | ||
|
||
EphemeralExchangeDispatch() {} | ||
~EphemeralExchangeDispatch() override {} | ||
|
||
protected: | ||
bool MessagePermitted(Protocols::Id protocol, uint8_t type) override | ||
{ | ||
// Only permit StandaloneAck | ||
return (protocol == Protocols::SecureChannel::Id && | ||
type == to_underlying(Protocols::SecureChannel::MsgType::StandaloneAck)); | ||
} | ||
|
||
bool IsEncryptionRequired() const override | ||
{ | ||
// This function should not be called at all | ||
VerifyOrDie(false); | ||
return false; | ||
} | ||
}; | ||
|
||
} // namespace Messaging | ||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters