Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2021 Project CHIP Authors
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * See the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 :
18 : /**
19 : * @file
20 : * This file provides implementation of Application Channel class.
21 : */
22 :
23 : #include <lib/core/CHIPError.h>
24 : #include <protocols/secure_channel/Constants.h>
25 : #include <protocols/secure_channel/SessionEstablishmentExchangeDispatch.h>
26 :
27 : namespace chip {
28 :
29 : using namespace Messaging;
30 :
31 165 : bool SessionEstablishmentExchangeDispatch::MessagePermitted(Protocols::Id protocol, uint8_t type)
32 : {
33 165 : if (protocol == Protocols::SecureChannel::Id)
34 : {
35 165 : switch (type)
36 : {
37 165 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::StandaloneAck):
38 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PBKDFParamRequest):
39 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PBKDFParamResponse):
40 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PASE_Pake1):
41 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PASE_Pake2):
42 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PASE_Pake3):
43 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::CASE_Sigma1):
44 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::CASE_Sigma2):
45 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::CASE_Sigma3):
46 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::CASE_Sigma2Resume):
47 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::StatusReport):
48 165 : return true;
49 :
50 0 : default:
51 0 : break;
52 : }
53 : }
54 :
55 0 : return false;
56 : }
57 :
58 : } // namespace chip
|