1 /* 2 * Copyright (c) 2023 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 #ifndef WIFI_DIRECT_INTERFACE_INFO_H 16 #define WIFI_DIRECT_INTERFACE_INFO_H 17 18 #include "info_container.h" 19 #include "common_list.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 enum InterfaceInfoKey { 26 II_KEY_DYNAMIC_MAC = 0, 27 II_KEY_INTERFACE_NAME = 1, 28 II_KEY_CONNECT_CAPABILITY = 2, 29 II_KEY_WIFI_DIRECT_ROLE = 3, 30 II_KEY_BASE_MAC = 4, 31 II_KEY_PHYSICAL_RATE = 5, 32 II_KEY_SUPPORT_BAND = 6, 33 II_KEY_CHANNEL_AND_BANDWIDTH = 7, 34 II_KEY_COEXIST_CHANNEL_LIST = 8, 35 II_KEY_HML_LINK_COUNT = 9, 36 II_KEY_ISLAND_DEVICE_COUNT = 10, 37 II_KEY_COEXIST_VAP_COUNT = 11, 38 II_KEY_IPV4 = 12, 39 II_KEY_CHANNEL_5G_LIST = 13, 40 II_KEY_SSID = 14, 41 II_KEY_PORT = 15, 42 II_KEY_IS_WIDE_BAND_SUPPORT = 16, 43 II_KEY_CENTER_20M = 17, 44 II_KEY_CENTER_FREQUENCY1 = 18, 45 II_KEY_CENTER_FREQUENCY2 = 19, 46 II_KEY_BANDWIDTH = 20, 47 II_KEY_WIFI_CFG_INFO = 21, 48 II_KEY_IS_ENABLE = 22, 49 II_KEY_CONNECTED_DEVICE_COUNT = 23, 50 II_KEY_PSK = 24, 51 II_KEY_REUSE_COUNT = 25, 52 II_KEY_IS_AVAILABLE = 26, 53 II_KEY_COEXIST_RULE = 27, 54 II_KEY_MAX, 55 }; 56 57 struct InterfaceInfo { 58 INFO_CONTAINER_BASE(InterfaceInfo, II_KEY_MAX); 59 60 char* (*getName)(struct InterfaceInfo *self); 61 void (*putName)(struct InterfaceInfo *self, const char *name); 62 int32_t (*getIpString)(struct InterfaceInfo *self, char *ipString, int32_t ipStringSize); 63 void (*putIpString)(struct InterfaceInfo *self, const char *ipString); 64 bool (*isEnable); 65 int32_t (*getP2pGroupConfig)(struct InterfaceInfo *self, char *buffer, size_t bufferSize); 66 int32_t (*setP2pGroupConfig)(struct InterfaceInfo *self, char *groupConfig); 67 void (*increaseRefCount)(struct InterfaceInfo *self); 68 void (*decreaseRefCount)(struct InterfaceInfo *self); 69 70 struct ListNode node; 71 }; 72 73 void InterfaceInfoConstructor(struct InterfaceInfo* self); 74 void InterfaceInfoConstructorWithName(struct InterfaceInfo* self, const char *name); 75 void InterfaceInfoDestructor(struct InterfaceInfo* self); 76 77 struct InterfaceInfo* InterfaceInfoNew(void); 78 void InterfaceInfoDelete(struct InterfaceInfo* self); 79 struct InterfaceInfo* InterfaceInfoNewArray(size_t size); 80 void InterfaceInfoDeleteArray(struct InterfaceInfo* self, size_t size); 81 82 #ifdef __cplusplus 83 } 84 #endif 85 #endif