1 /*
2  * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_WIFI_P2P_MSG_H
17 #define OHOS_WIFI_P2P_MSG_H
18 
19 #include <string>
20 #include <vector>
21 #include <climits>
22 #include "securec.h"
23 #include "wifi_common_msg.h"
24 
25 namespace OHOS {
26 namespace Wifi {
27 constexpr int WIFI_STR_MAC_LENGTH = 17;
28 constexpr int MAX_PASSPHRASE_LENGTH = 127;
29 constexpr int DEVICE_NAME_LENGTH = 32;
30 
31 enum class P2pGroupStatus { GS_CREATING, GS_CREATED, GS_STARTED, GS_REMOVING, GS_INVALID };
32 enum class P2pServiceStatus : unsigned char {
33     PSRS_SUCCESS,
34     PSRS_SERVICE_PROTOCOL_NOT_AVAILABLE,
35     PSRS_REQUESTED_INFORMATION_NOT_AVAILABLE,
36     PSRS_BAD_REQUEST,
37 };
38 
39 enum class P2pServicerProtocolType : unsigned char {
40     SERVICE_TYPE_ALL = 0,
41     SERVICE_TYPE_BONJOUR = 1,
42     SERVICE_TYPE_UP_NP = 2,
43     SERVICE_TYPE_WS_DISCOVERY = 3,
44     SERVICE_TYPE_VENDOR_SPECIFIC = 255,
45 };
46 
47 enum class P2pActionCallback : unsigned char {
48     DiscoverDevices,
49     StopDiscoverDevices,
50     DiscoverServices,
51     StopDiscoverServices,
52     PutLocalP2pService,
53     DeleteLocalP2pService,
54     RequestService,
55     StartP2pListen,
56     StopP2pListen,
57     CreateGroup,
58     RemoveGroup,
59     DeleteGroup,
60     P2pConnect,
61     P2pCancelConnect,
62     P2pSetDeviceName,
63     CreateHid2dGroup,
64     Hid2dConnect,
65     RemoveGroupClient,
66     DiscoverPeers,
67     UNKNOWN
68 };
69 
70 enum class P2pState {
71     P2P_STATE_NONE = 0,
72     P2P_STATE_IDLE,
73     P2P_STATE_STARTING,
74     P2P_STATE_STARTED,
75     P2P_STATE_CLOSING,
76     P2P_STATE_CLOSED,
77 };
78 
79 enum class P2pDiscoverState {
80     P2P_DISCOVER_NONE = 0,
81     P2P_DISCOVER_STARTING,
82     P2P_DISCOVER_CLOSED,
83 };
84 
85 enum class P2pConnectedState {
86     P2P_DISCONNECTED = 0,
87     P2P_CONNECTED,
88 };
89 
90 enum class P2pWfdInfoType {
91     WFD_SOURCE = 0x00,
92     PRIMARY_SINK = 0x01,
93     SECONDARY_SINK = 0x10,
94     SOURCE_OR_PRIMARY_SINK = 0x11
95 };
96 enum class P2pDeviceType {
97     DEVICE_TYPE = 0x3,
98     COUPLED_SINK_SUPPORT_AT_SOURCE = 0x4,
99     COUPLED_SINK_SUPPORT_AT_SINK = 0x8,
100     SESSION_AVAILABLE = 0x30,
101     SESSION_AVAILABLE_BIT1 = 0x10,
102     SESSION_AVAILABLE_BIT2 = 0x20
103 };
104 
105 enum class P2pDeviceStatus { PDS_CONNECTED, PDS_INVITED, PDS_FAILED, PDS_AVAILABLE, PDS_UNAVAILABLE };
106 
107 enum class WpsMethod { WPS_METHOD_PBC, WPS_METHOD_DISPLAY, WPS_METHOD_KEYPAD, WPS_METHOD_LABEL, WPS_METHOD_INVALID };
108 
109 enum class WpsConfigMethod {
110     WPS_CFG_INVALID = 0,
111     WPS_CFG_DISPLAY = 0x0008,
112     WPS_CFG_PUSHBUTTON = 0x0080,
113     WPS_CFG_KEYPAD = 0x0100,
114 };
115 
116 enum class P2pDeviceCapability {
117     PDC_SERVICE_DISCOVERY = 1,
118     PDC_CLIENT_DISCOVERABILITY = 1 << 1,
119     PDC_STARTED_CONCURRENT_OPER = 1 << 2,
120     PDC_REMOVING_INFRA_MANAGED = 1 << 3,
121     PDC_DEVICE_LIMIT = 1 << 4,
122     PDC_INVITATION_PROCEDURE = 1 << 5
123 };
124 
125 enum class P2pGroupCapability {
126     PGC_GROUP_OWNER = 1,
127     PGC_PERSISTENT_GROUP = 1 << 1,
128     PGC_GROUP_LIMIT = 1 << 2,
129     PGC_INTRA_BSS_DIST = 1 << 3,
130     PGC_CROSS_CONN = 1 << 4,
131     PGC_PERSISTENT_RECONN = 1 << 5,
132     PGC_GROUP_FORMATION = 1 << 6,
133     PGC_IP_ADDR_ALLOC = 1 << 7
134 };
135 
136 struct GcInfo {
137     std::string ip;
138     std::string mac;
139     std::string host;
140 };
141 
142 enum class GroupOwnerBand { GO_BAND_AUTO, GO_BAND_2GHZ, GO_BAND_5GHZ };
143 inline const int MAX_WFD_SUBELEMS = 12;
144 const char DeviceInfoSubelemLenHex[] = {"0006"};
145 class WifiP2pWfdInfo {
146 public:
WifiP2pWfdInfo()147     WifiP2pWfdInfo() : wfdEnabled(false), deviceInfo(0), ctrlPort(0), maxThroughput(0)
148     {}
WifiP2pWfdInfo(int info, int port, int throughput)149     WifiP2pWfdInfo(int info, int port, int throughput)
150         : wfdEnabled(true), deviceInfo(info), ctrlPort(port), maxThroughput(throughput)
151     {}
~WifiP2pWfdInfo()152     ~WifiP2pWfdInfo()
153     {}
154     void SetWfdEnabled(bool value);
155     bool GetWfdEnabled() const;
156     void SetDeviceInfo(int info);
157     int GetDeviceInfo() const;
158     void SetCtrlPort(int port);
159     int GetCtrlPort() const;
160     void SetMaxThroughput(int throughput);
161     int GetMaxThroughput() const;
162     bool isSessionAvailable();
163     void setSessionAvailable(bool enabled);
164     void GetDeviceInfoElement(std::string &subelement);
165 
166 private:
167     bool wfdEnabled;
168     int deviceInfo;
169     int ctrlPort;
170     int maxThroughput;
171 };
172 
173 class WifiP2pDevice {
174 public:
WifiP2pDevice()175     WifiP2pDevice()
176         : deviceName(""),
177           networkName(""),
178           mDeviceAddress(""),
179           deviceAddressType(REAL_DEVICE_ADDRESS),
180           primaryDeviceType(""),
181           secondaryDeviceType(""),
182           status(P2pDeviceStatus::PDS_UNAVAILABLE),
183           supportWpsConfigMethods(0),
184           deviceCapabilitys(0),
185           groupCapabilitys(0)
186     {}
~WifiP2pDevice()187     ~WifiP2pDevice()
188     {}
189     void SetDeviceName(const std::string &setDeviceName);
190     const std::string &GetDeviceName() const;
191     void SetNetworkName(const std::string &name);
192     const std::string &GetNetworkName() const;
193     void SetDeviceAddress(const std::string &deviceAddress);
194     void SetRandomDeviceAddress(const std::string &deviceAddress);
195     const std::string &GetDeviceAddress() const;
196     const std::string &GetRandomDeviceAddress() const;
197     void SetDeviceAddressType(int devAddressType);
198     int GetDeviceAddressType() const;
199     void SetPrimaryDeviceType(const std::string &setPrimaryDeviceType);
200     const std::string &GetPrimaryDeviceType() const;
201     void SetSecondaryDeviceType(const std::string &deviceType);
202     const std::string &GetSecondaryDeviceType() const;
203     void SetP2pDeviceStatus(P2pDeviceStatus setStatus);
204     P2pDeviceStatus GetP2pDeviceStatus() const;
205     void SetWfdInfo(const WifiP2pWfdInfo &info);
206     const WifiP2pWfdInfo &GetWfdInfo() const;
207     void SetWpsConfigMethod(unsigned int wpsConfigMethod);
208     unsigned int GetWpsConfigMethod() const;
209     void SetDeviceCapabilitys(int capabilitys);
210     int GetDeviceCapabilitys() const;
211     void SetGroupCapabilitys(int capabilitys);
212     int GetGroupCapabilitys() const;
213     bool IsGroupOwner() const;
214     bool IsGroupLimit() const;
215     bool IsDeviceLimit() const;
216     bool Isinviteable() const;
217     bool IsValid() const;
218     bool operator==(const WifiP2pDevice &cmp) const;
219     bool operator!=(const WifiP2pDevice &cmp) const;
220     bool WpsPbcSupported() const;
221     bool WpsDisplaySupported() const;
222     bool WpKeypadSupported() const;
223     void SetGroupAddress(const std::string &groupAddress);
224     const std::string &GetGroupAddress() const;
225 
226 private:
227     std::string deviceName; /* the value range is 0 to 32 characters. */
228     std::string networkName; /* oper_ssid of peer device */
229     std::string mDeviceAddress; /* the device MAC address, the length is 17 characters. */
230     std::string mGroupAddress; /* the group MAC address, the length is 17 characters. */
231     std::string mRandomDeviceAddress; /* the device random MAC address, the length is 17 characters. */
232     int deviceAddressType; /* the device MAC address type */
233     std::string primaryDeviceType;
234     std::string secondaryDeviceType;
235     P2pDeviceStatus status;
236     WifiP2pWfdInfo wfdInfo;
237     unsigned int supportWpsConfigMethods;
238     int deviceCapabilitys;
239     int groupCapabilitys;
240 };
241 
242 inline const int TEMPORARY_NET_ID = -1;
243 inline const int PERSISTENT_NET_ID = -2;
244 inline const int INVALID_NET_ID = -999;
245 class WifiP2pGroupInfo {
246 public:
WifiP2pGroupInfo()247     WifiP2pGroupInfo()
248         : isP2pGroupOwner(false),
249           networkId(INVALID_NET_ID),
250           frequency(0),
251           isP2pPersistent(0),
252           groupStatus(P2pGroupStatus::GS_INVALID),
253           explicitGroup(false)
254     {}
~WifiP2pGroupInfo()255     ~WifiP2pGroupInfo()
256     {}
257     bool operator==(const WifiP2pGroupInfo &group) const;
258     bool operator!=(const WifiP2pGroupInfo &group) const;
259     void SetIsGroupOwner(bool isGroupOwner);
260     bool IsGroupOwner() const;
261     void SetOwner(const WifiP2pDevice &setOwner);
262     const WifiP2pDevice &GetOwner() const;
263     void SetPassphrase(const std::string &setPassphrase);
264     const std::string &GetPassphrase() const;
265     void SetInterface(const std::string &setInterface);
266     const std::string &GetInterface() const;
267     void SetGroupName(const std::string &newGroupName);
268     const std::string &GetGroupName() const;
269     void SetFrequency(int setFrequency);
270     int GetFrequency() const;
271     void SetIsPersistent(bool isPersistent);
272     bool IsPersistent() const;
273     void SetP2pGroupStatus(P2pGroupStatus newGroupStatus);
274     P2pGroupStatus GetP2pGroupStatus() const;
275     void SetNetworkId(int nwId);
276     const int &GetNetworkId() const;
277     void SetGoIpAddress(const std::string &ipAddr);
278     const std::string &GetGoIpAddress() const;
279     void SetGcIpAddress(const std::string &ipAddr);
280     const std::string &GetGcIpAddress() const;
281     void AddClientDevice(const WifiP2pDevice &clientDevice);
282     void AddPersistentDevice(const WifiP2pDevice &clientDevice);
283     void RemoveClientDevice(const WifiP2pDevice &clientDevice);
284     void RemovePersistentDevice(const WifiP2pDevice &clientDevice);
285     bool IsContainsDevice(const WifiP2pDevice &clientDevice) const;
286     bool IsContainsPersistentDevice(const WifiP2pDevice &clientDevice) const;
287     bool IsClientDevicesEmpty() const;
288     const std::vector<WifiP2pDevice> &GetClientDevices() const;
289     const std::vector<WifiP2pDevice> &GetPersistentDevices() const;
290     void SetClientDevices(const std::vector<WifiP2pDevice> &devices);
291     void SetClientPersistentDevices(const std::vector<WifiP2pDevice> &devices);
292     void ClearClientDevices();
293     bool IsExplicitGroup(void) const;
294     void SetExplicitGroup(bool isExplicit);
295     void SetCreatorUid(int uid);
296     int GetCreatorUid();
297 
298 private:
299     WifiP2pDevice owner;
300     bool isP2pGroupOwner;
301     std::string passphrase; /* the value ranges from 8 to 63. */
302     std::string interface;
303     std::string groupName;
304     int networkId;
305     int frequency; /* for example : freq=2412 to select 2.4 GHz channel 1.(Based on 2.4 GHz or 5 GHz) */
306     bool isP2pPersistent;
307     P2pGroupStatus groupStatus;
308     std::vector<WifiP2pDevice> clientDevices;
309     std::vector<WifiP2pDevice> persistentClients;
310     std::string goIpAddress;
311     std::string gcIpAddress;
312     bool explicitGroup;
313     int creatorUid = -1;
314 };
315 
316 class WpsInfo {
317 public:
WpsInfo()318     WpsInfo() : mWpsMethod(WpsMethod::WPS_METHOD_INVALID), bssid(""), pin("")
319     {}
~WpsInfo()320     ~WpsInfo()
321     {}
322     void SetWpsMethod(WpsMethod wpsMethod);
323     WpsMethod GetWpsMethod() const;
324 
325     void SetBssid(const std::string &setBssid);
326     const std::string &GetBssid() const;
327     void SetPin(const std::string &setPin);
328     const std::string &GetPin() const;
329 
330 private:
331     WpsMethod mWpsMethod;
332     std::string bssid; /* the length is 17 characters. */
333     std::string pin; /* the length is 4 or 8 characters. */
334 };
335 
336 inline const int AUTO_GROUP_OWNER_VALUE = -1;
337 inline const int MIN_GROUP_OWNER_VALUE = 0;
338 inline const int MAX_GROUP_OWNER_VALUE = 15;
339 class WifiP2pConfig {
340 public:
WifiP2pConfig()341     WifiP2pConfig()
342         : mDeviceAddress(""),
343           deviceAddressType(REAL_DEVICE_ADDRESS),
344           goBand(GroupOwnerBand::GO_BAND_AUTO),
345           netId(-1),
346           passphrase(""),
347           groupOwnerIntent(AUTO_GROUP_OWNER_VALUE),
348           groupName("")
349     {}
WifiP2pConfig(const WifiP2pConfig &config)350     WifiP2pConfig(const WifiP2pConfig &config)
351         : mDeviceAddress(config.GetDeviceAddress()),
352           deviceAddressType(config.GetDeviceAddressType()),
353           goBand(config.GetGoBand()),
354           netId(config.GetNetId()),
355           passphrase(config.GetPassphrase()),
356           groupOwnerIntent(config.GetGroupOwnerIntent()),
357           groupName(config.GetGroupName())
358     {}
~WifiP2pConfig()359     ~WifiP2pConfig()
360     {}
361     void SetDeviceAddress(const std::string &deviceAddress);
362     const std::string &GetDeviceAddress() const;
363     void SetDeviceAddressType(int addressAddrType);
364     int GetDeviceAddressType() const;
365     void SetGoBand(GroupOwnerBand setGoBand);
366     GroupOwnerBand GetGoBand() const;
367     void SetNetId(int setNetId);
368     int GetNetId() const;
369     void SetPassphrase(const std::string &newPassphrase);
370     const std::string &GetPassphrase() const;
371     void SetGroupOwnerIntent(int goIntent);
372     int GetGroupOwnerIntent() const;
373     void SetGroupName(const std::string &setGroupName);
374     const std::string &GetGroupName() const;
375 
376 private:
377     std::string mDeviceAddress; /* the device MAC address, the length is 17 characters. */
378     int deviceAddressType; /* the device MAC address type */
379     GroupOwnerBand goBand;
380     int netId; /* network id, when -2 means persistent and -1 means temporary, else need >= 0 */
381     std::string passphrase; /* the value ranges from 8 to 63. */
382     int groupOwnerIntent; /* the value is -1.(A value of -1 indicates the system can choose an appropriate value.) */
383     std::string groupName; /* the value ranges from 1 to 32. */
384 };
385 
386 class WifiP2pConfigInternal : public WifiP2pConfig {
387 public:
WifiP2pConfigInternal()388     WifiP2pConfigInternal(): WifiP2pConfig()
389     {
390         wpsInfo.SetWpsMethod(WpsMethod::WPS_METHOD_INVALID);
391     }
WifiP2pConfigInternal(WifiP2pConfig config)392     explicit WifiP2pConfigInternal(WifiP2pConfig config): WifiP2pConfig(config)
393     {
394         wpsInfo.SetWpsMethod(WpsMethod::WPS_METHOD_INVALID);
395     }
~WifiP2pConfigInternal()396     ~WifiP2pConfigInternal()
397     {}
SetWpsInfo(const WpsInfo &info)398     inline void SetWpsInfo(const WpsInfo &info)
399     {
400         wpsInfo = info;
401     }
GetWpsInfo() const402     inline const WpsInfo &GetWpsInfo() const
403     {
404         return wpsInfo;
405     }
406 
407 private:
408     WpsInfo wpsInfo;
409 };
410 
411 class WifiP2pLinkedInfo {
412 public:
WifiP2pLinkedInfo()413     WifiP2pLinkedInfo() : connectState(P2pConnectedState::P2P_DISCONNECTED), isP2pGroupOwner(false)
414     {}
~WifiP2pLinkedInfo()415     ~WifiP2pLinkedInfo()
416     {}
417     void SetConnectState(P2pConnectedState setConnectState);
418     P2pConnectedState GetConnectState() const;
419     void SetIsGroupOwner(bool isGroupOwner);
420     const bool &IsGroupOwner() const;
421     void SetIsGroupOwnerAddress(const std::string &setGroupOwnerAddress);
422     const std::string &GetGroupOwnerAddress() const;
423     void AddClientInfoList(const std::string &mac, const std::string &ip, const std::string &host);
424     void RemoveClientInfo(std::string mac);
425     void ClearClientInfo();
426     const std::vector<GcInfo> &GetClientInfoList() const;
427 private:
428     P2pConnectedState connectState;
429     bool isP2pGroupOwner;
430     std::string groupOwnerAddress; /* the length is 17 characters. */
431     std::vector<GcInfo> gc_info_list;
432 };
433 
434 inline const int SERVICE_TLV_LENGTH_SIZE = 2;
435 inline const int PROTOCOL_SIZE = 1;
436 inline const int TRANSACTION_ID_SIZE = 1;
437 const int SERVICE_STATUS_SIZE = 1;
438 
439 class WifiP2pServiceRequest {
440 public:
WifiP2pServiceRequest()441     WifiP2pServiceRequest() : mProtocolType(P2pServicerProtocolType::SERVICE_TYPE_ALL), mTransactionId(0)
442     {}
WifiP2pServiceRequest(P2pServicerProtocolType protocolType, const std::string &data)443     WifiP2pServiceRequest(P2pServicerProtocolType protocolType, const std::string &data)
444         : mProtocolType(protocolType),
445           mTransactionId(0)
446     {
447         for (unsigned long i = 0; i < data.length(); ++i) {
448             mQuery.push_back(data.at(i));
449         }
450     }
~WifiP2pServiceRequest()451     ~WifiP2pServiceRequest()
452     {}
453     void SetProtocolType(P2pServicerProtocolType serviceProtocolType);
454     P2pServicerProtocolType GetProtocolType() const;
455     void SetTransactionId(unsigned char transactionId);
456     int GetTransactionId() const;
457     void SetQuery(const std::vector<unsigned char> &query);
458     const std::vector<unsigned char> &GetQuery() const;
459 
460     std::vector<unsigned char> GetTlv() const;
461 
462     bool operator==(const WifiP2pServiceRequest &cmp) const;
463 
464 private:
465     P2pServicerProtocolType mProtocolType;
466     unsigned char mTransactionId;
467     std::vector<unsigned char> mQuery;
468 };
469 
470 class WifiP2pServiceResponse {
471 public:
WifiP2pServiceResponse()472     WifiP2pServiceResponse()
473         : mProtocolType(P2pServicerProtocolType::SERVICE_TYPE_ALL),
474           mTransactionId(0),
475           mServiceStatus(P2pServiceStatus::PSRS_BAD_REQUEST)
476     {}
WifiP2pServiceResponse(P2pServicerProtocolType protocolType, P2pServiceStatus serviceStatus, unsigned char transactionId, const std::vector<unsigned char> data)477     WifiP2pServiceResponse(P2pServicerProtocolType protocolType, P2pServiceStatus serviceStatus,
478         unsigned char transactionId, const std::vector<unsigned char> data)
479         : mProtocolType(protocolType), mTransactionId(transactionId), mServiceStatus(serviceStatus), responseData(data)
480     {}
~WifiP2pServiceResponse()481     ~WifiP2pServiceResponse()
482     {}
483     void SetProtocolType(P2pServicerProtocolType serviceProtocolType);
484     P2pServicerProtocolType GetProtocolType() const;
485     void SetTransactionId(unsigned char transactionId);
486     unsigned char GetTransactionId() const;
487     void SetServiceStatus(P2pServiceStatus serviceStatus);
488     P2pServiceStatus GetServiceStatus() const;
489     void SetServiceName(const std::string &name);
490     const std::string &GetServiceName() const;
491     void SetData(const std::vector<unsigned char> &data);
492     const std::vector<unsigned char> &GetData() const;
493     std::vector<unsigned char> GetTlv() const;
494     bool operator==(const WifiP2pServiceResponse &cmp) const;
495 
496 protected:
497     P2pServicerProtocolType mProtocolType;
498     unsigned char mTransactionId;
499     P2pServiceStatus mServiceStatus;
500     std::string mSvrName;
501     std::vector<unsigned char> responseData;
502 };
503 
504 class WifiP2pServiceInfo {
505 public:
WifiP2pServiceInfo()506     WifiP2pServiceInfo()
507         : mDeviceAddress("00:00:00:00:00:00"), mProtocolType(P2pServicerProtocolType::SERVICE_TYPE_VENDOR_SPECIFIC)
508     {}
WifiP2pServiceInfo(std::vector<std::string> queryList)509     explicit WifiP2pServiceInfo(std::vector<std::string> queryList)
510         : mProtocolType(P2pServicerProtocolType::SERVICE_TYPE_VENDOR_SPECIFIC),
511           mQueryList(queryList)
512     {}
~WifiP2pServiceInfo()513     ~WifiP2pServiceInfo()
514     {}
515     void SetServiceName(const std::string &name);
516     const std::string &GetServiceName() const;
517     void SetDeviceAddress(const std::string &deviceAddress);
518     const std::string &GetDeviceAddress() const;
519     void SetServicerProtocolType(P2pServicerProtocolType type);
520     P2pServicerProtocolType GetServicerProtocolType() const;
521     void SetQueryList(const std::vector<std::string> &queryList);
522     const std::vector<std::string> &GetQueryList() const;
523     bool operator==(const WifiP2pServiceInfo &cmp) const;
524     /**
525      * @Description - Pack all data into a P2P service request packet based on the data interface.
526      * @return - WifiP2pServiceRequest
527      */
528     WifiP2pServiceRequest BuildRequest();
529     P2pServiceStatus ProcessServiceRequest(
530         const std::vector<unsigned char> &Query, std::vector<unsigned char> &data) const;
531     void ProcessServiceResponse(const std::vector<unsigned char> &data) const;
532     static std::string Bin2HexStr(std::vector<unsigned char> data);
533     static std::string Bin2HexStr(std::string data);
534 
535 private:
536     std::string serviceName;
537     std::string mDeviceAddress;
538     P2pServicerProtocolType mProtocolType;
539     std::vector<std::string> mQueryList;
540 };
541 
542 class P2pVendorConfig {
543 public:
P2pVendorConfig()544     P2pVendorConfig() : randomMacSupport(false), isAutoListen(false), primaryDeviceType("10-0050F204-5")
545     {}
~P2pVendorConfig()546     ~P2pVendorConfig()
547     {}
548     bool GetRandomMacSupport() const;
549     void SetRandomMacSupport(bool support);
550     bool GetIsAutoListen() const;
551     void SetIsAutoListen(bool autoListen);
552     const std::string &GetDeviceName() const;
553     void SetDeviceName(const std::string &name);
554     const std::string &GetPrimaryDeviceType() const;
555     void SetPrimaryDeviceType(const std::string &setPrimaryDeviceType);
556     const std::string &GetSecondaryDeviceType() const;
557     void SetSecondaryDeviceType(const std::string &setSecondaryDeviceType);
558 
559 private:
560     bool randomMacSupport;
561     bool isAutoListen;
562     std::string deviceName;
563     std::string primaryDeviceType;
564     std::string secondaryDeviceType;
565 };
566 }  // namespace Wifi
567 }  // namespace OHOS
568 #endif
569