3 * Copyright (c) 2020 Project CHIP Authors
4 * Copyright (c) 2018 Nest Labs, Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
26 namespace DeviceLayer {
30 * Constants for common network metadata entries
32 // ---- WiFi-specific Limits ----
33 constexpr size_t kMaxWiFiSSIDLength = 32;
34 constexpr size_t kMaxWiFiKeyLength = 64;
36 // ---- Thread-specific Limits ----
37 constexpr size_t kMaxThreadNetworkNameLength = 16;
38 constexpr size_t kThreadExtendedPANIdLength = 8;
39 constexpr size_t kThreadMeshPrefixLength = 8;
40 constexpr size_t kThreadMasterKeyLength = 16;
41 constexpr size_t kThreadPSKcLength = 16;
42 constexpr size_t kThreadChannel_NotSpecified = UINT8_MAX;
43 constexpr size_t kThreadPANId_NotSpecified = UINT16_MAX;
46 * Ids for well-known network provision types.
51 kWiFiStationNetworkId = 2,
55 * WiFi Security Modes.
57 enum WiFiAuthSecurityType : int8_t
59 kWiFiSecurityType_NotSpecified = -1,
61 kWiFiSecurityType_None = 1,
62 kWiFiSecurityType_WEP = 2,
63 kWiFiSecurityType_WPAPersonal = 3,
64 kWiFiSecurityType_WPA2Personal = 4,
65 kWiFiSecurityType_WPA2MixedPersonal = 5,
66 kWiFiSecurityType_WPAEnterprise = 6,
67 kWiFiSecurityType_WPA2Enterprise = 7,
68 kWiFiSecurityType_WPA2MixedEnterprise = 8,
69 kWiFiSecurityType_WPA3Personal = 9,
70 kWiFiSecurityType_WPA3MixedPersonal = 10,
71 kWiFiSecurityType_WPA3Enterprise = 11,
72 kWiFiSecurityType_WPA3MixedEnterprise = 12,
75 class DeviceNetworkInfo
78 uint32_t NetworkId; /**< The network id assigned to the network by the device. */
82 bool NetworkId : 1; /**< True if the NetworkId field is present. */
83 bool ThreadExtendedPANId : 1; /**< True if the ThreadExtendedPANId field is present. */
84 bool ThreadMeshPrefix : 1; /**< True if the ThreadMeshPrefix field is present. */
85 bool ThreadPSKc : 1; /**< True if the ThreadPSKc field is present. */
88 // ---- WiFi-specific Fields ----
89 char WiFiSSID[kMaxWiFiSSIDLength + 1]; /**< The WiFi SSID as a NULL-terminated string. */
90 uint8_t WiFiKey[kMaxWiFiKeyLength]; /**< The WiFi key (NOT NULL-terminated). */
91 uint8_t WiFiKeyLen; /**< The length in bytes of the WiFi key. */
92 WiFiAuthSecurityType WiFiSecurityType; /**< The WiFi security type. */
94 // ---- Thread-specific Fields ----
95 char ThreadNetworkName[kMaxThreadNetworkNameLength + 1];
96 /**< The Thread network name as a NULL-terminated string. */
97 uint8_t ThreadExtendedPANId[kThreadExtendedPANIdLength];
98 /**< The Thread extended PAN ID. */
99 uint8_t ThreadMeshPrefix[kThreadMeshPrefixLength];
100 /**< The Thread mesh prefix. */
101 uint8_t ThreadMasterKey[kThreadMasterKeyLength];
102 /**< The Thread master key (NOT NULL-terminated). */
103 uint8_t ThreadPSKc[kThreadPSKcLength];
104 /**< The Thread pre-shared commissioner key (NOT NULL-terminated). */
105 uint16_t ThreadPANId; /**< The 16-bit Thread PAN ID, or kThreadPANId_NotSpecified */
106 uint8_t ThreadChannel; /**< The Thread channel (currently [11..26]), or kThreadChannel_NotSpecified */
107 uint64_t ThreadDatasetTimestamp; /**< Thread active dataset timestamp */
110 } // namespace Internal
111 } // namespace DeviceLayer