3 * Copyright (c) 2020 Project CHIP Authors
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 * This file defines constant enumerations for all public (or
27 #include <core/CHIPVendorIdentifiers.hpp>
33 // CHIP Protocol Ids (32-bits max)
38 constexpr Id(VendorId aVendorId, uint16_t aProtocolId) : mVendorId(aVendorId), mProtocolId(aProtocolId) {}
40 constexpr bool operator==(const Id & aOther) const
42 return mVendorId == aOther.mVendorId && mProtocolId == aOther.mProtocolId;
45 // Convert the Protocols::Id to a TLV profile id.
46 // NOTE: We may want to change the TLV reader/writer to take Protocols::Id
47 // directly later on and get rid of this method.
48 constexpr uint32_t ToTLVProfileId() const { return ToUint32(); }
50 // Convert the protocol id to a 32-bit unsigned integer "fully qualified"
51 // form as defined in the spec. This should only be used in the places
52 // where the spec defines a 32-bit unsigned in as a wire representation of
54 constexpr uint32_t ToFullyQualifiedSpecForm() const { return ToUint32(); }
56 constexpr VendorId GetVendorId() const { return mVendorId; }
57 constexpr uint16_t GetProtocolId() const { return mProtocolId; }
60 constexpr uint32_t ToUint32() const { return (static_cast<uint32_t>(mVendorId) << 16) | mProtocolId; }
62 chip::VendorId mVendorId;
68 // NOTE: Do not attempt to allocate these values yourself.
69 #define CHIP_STANDARD_PROTOCOL(name, id) \
71 static constexpr Protocols::Id Id(VendorId::Common, id); \
74 CHIP_STANDARD_PROTOCOL(SecureChannel, 0x0000) // Secure Channel Protocol
75 CHIP_STANDARD_PROTOCOL(Echo, 0x0002) // Echo Protocol
76 CHIP_STANDARD_PROTOCOL(BDX, 0x0003) // Bulk Data Exchange Protocol
77 CHIP_STANDARD_PROTOCOL(NetworkProvisioning, 0x0004) // Network Provisioning Protocol
78 CHIP_STANDARD_PROTOCOL(InteractionModel, 0x0005) // Interaction Model Protocol
79 CHIP_STANDARD_PROTOCOL(FabricProvisioning, 0x0006) // Fabric Provisioning Protocol
80 CHIP_STANDARD_PROTOCOL(ServiceProvisioning, 0x0007) // Service Provisioning Protocol
81 CHIP_STANDARD_PROTOCOL(OpCredentials, 0x0008) // Operational Credentials
83 #undef CHIP_STANDARD_PROTOCOL
85 // Protocols reserved for internal protocol use
86 static constexpr Id NotSpecified(VendorId::NotSpecified, 0xFFFF); // The profile ID is either not specified or a wildcard
88 // Pre-delare our MessageTypeTraits so message type headers know what they are
91 struct MessageTypeTraits;
93 } // namespace Protocols