3 * Copyright (c) 2020 Project CHIP Authors
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 * The defines constants for the CHIP Secure Channel Protocol, present in
28 #include <protocols/Protocols.h>
29 #include <support/CodeUtils.h>
32 * @namespace chip::Protocols::SecureChannel
35 * This namespace includes all interfaces within CHIP for the
36 * CHIP SecureChannel protocol.
38 * The interfaces define message types and status codes.
43 namespace SecureChannel {
46 * SecureChannel Protocol Message Types
48 enum class MsgType : uint8_t
50 // Message Counter Synchronization Protocol Message Types
51 MsgCounterSyncReq = 0x00,
52 MsgCounterSyncRsp = 0x01,
54 // Reliable Messaging Protocol Message Types
57 // Password-based session establishment Message Types
58 PBKDFParamRequest = 0x20,
59 PBKDFParamResponse = 0x21,
63 PASE_Spake2pError = 0x2F,
65 // Certificate-based session establishment Message Types
74 // Placeholder value for the ProtocolCode field when the GeneralCode is Success or Continue.
75 constexpr uint16_t kProtocolCodeSuccess = 0x0000;
77 // Placeholder value for the ProtocolCode field when there is no additional protocol-specific code to provide more information.
78 constexpr uint16_t kProtocolCodeGeneralFailure = 0xFFFF;
81 * Status Report - General Status Codes used to convey protocol-agnostic status info.
83 enum class GeneralStatusCode : uint16_t
85 kSuccess = 0, /**< Operation completed successfully. */
86 kFailure = 1, /**< Generic failure, additional details may be included in the protocol specific status. */
87 kBadPrecondition = 2, /**< Operation was rejected by the system because the system is in an invalid state. */
88 kOutOfRange = 3, /**< A value was out of a required range. */
89 kBadRequest = 4, /**< A request was unrecognized or malformed. */
90 kUnsupported = 5, /**< An unrecognized or unsupported request was received. */
91 kUnexpected = 6, /**< A request was not expected at this time. */
92 kResourceExhausted = 7, /**< Insufficient resources to process the given request. */
93 kBusy = 8, /**< Device is busy and cannot handle this request at this time. */
94 kTimeout = 9, /**< A timeout occurred. */
95 kContinue = 10, /**< Context-specific signal to proceed. */
96 kAborted = 11, /**< Failure, often due to a concurrency error. */
97 kInvalidArgument = 12, /**< An invalid/unsupported argument was provided. */
98 kNotFound = 13, /**< Some requested entity was not found. */
99 kAlreadyExists = 14, /**< The caller attempted to create something that already exists. */
100 kPermissionDenied = 15, /**< Caller does not have sufficient permissions to execute the requested operations. */
101 kDataLoss = 16, /**< Unrecoverable data loss or corruption has occurred. */
105 * Status Report - Status Codes specific only to the SecureChannel Protocol
107 enum class StatusCode
109 AlreadyMemberOfFabric = 1, /**< The recipient is already a member of a fabric. */
110 NotMemberOfFabric = 2, /**< The recipient is not a member of a fabric. */
111 InvalidFabricConfig = 3 /**< The specified fabric configuration was invalid. */
114 } // namespace SecureChannel
117 struct MessageTypeTraits<SecureChannel::MsgType>
119 static constexpr const Protocols::Id & ProtocolId() { return SecureChannel::Id; }
122 } // namespace Protocols