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 <messaging/ApplicationExchangeDispatch.h>
24 : #include <protocols/secure_channel/Constants.h>
25 :
26 : namespace chip {
27 : namespace Messaging {
28 :
29 17676 : bool ApplicationExchangeDispatch::MessagePermitted(Protocols::Id protocol, uint8_t type)
30 : {
31 : // TODO: Change this check to only include the protocol and message types that are allowed
32 17676 : if (protocol == Protocols::SecureChannel::Id)
33 : {
34 1580 : switch (type)
35 : {
36 0 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PBKDFParamRequest):
37 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PBKDFParamResponse):
38 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PASE_Pake1):
39 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PASE_Pake2):
40 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::PASE_Pake3):
41 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::CASE_Sigma1):
42 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::CASE_Sigma2):
43 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::CASE_Sigma3):
44 : case static_cast<uint8_t>(Protocols::SecureChannel::MsgType::CASE_Sigma2Resume):
45 0 : return false;
46 :
47 1580 : default:
48 1580 : break;
49 : }
50 : }
51 :
52 17676 : return true;
53 : }
54 :
55 : } // namespace Messaging
56 : } // namespace chip
|