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 WPA_P2P_CMD_H 16 #define WPA_P2P_CMD_H 17 18 #include "../wpa_impl.h" 19 #include "wpa_client.h" 20 21 /** 22 * @brief Defines the enum for P2p Wps Method 23 * 24 * @since 4.1 25 * @version 1.0 26 */ 27 enum P2pWpsMethod { 28 P2P_WPS_METHOD_PBC, 29 P2P_WPS_METHOD_DISPLAY, 30 P2P_WPS_METHOD_KEYPAD, 31 P2P_WPS_METHOD_LABEL, 32 P2P_WPS_METHOD_INVALID 33 }; 34 35 enum P2pRemoveGroupEvent { 36 P2P_REMOVE_GROUP_CLIENT = 0, 37 P2P_REJECT, 38 P2P_SET_MIRACAST_SINK_CONFIG, 39 P2P_CREATE_TEMP_GROUP, 40 EVENT_MAX 41 }; 42 43 int32_t WpaInterfaceP2pSetSsidPostfixName(struct IWpaInterface *self, const char *ifName, const char *name); 44 45 int32_t WpaInterfaceP2pSetWpsDeviceType(struct IWpaInterface *self, const char *ifName, const char *type); 46 47 int32_t WpaInterfaceP2pSetWpsConfigMethods(struct IWpaInterface *self, const char *ifName, const char *methods); 48 49 int32_t WpaInterfaceP2pSetGroupMaxIdle(struct IWpaInterface *self, const char *ifName, int32_t time); 50 51 int32_t WpaInterfaceP2pSetWfdEnable(struct IWpaInterface *self, const char *ifName, int32_t enable); 52 53 int32_t WpaInterfaceP2pSetPersistentReconnect(struct IWpaInterface *self, const char *ifName, int32_t status); 54 55 int32_t WpaInterfaceP2pSetWpsSecondaryDeviceType(struct IWpaInterface *self, const char *ifName, const char *type); 56 57 int32_t WpaInterfaceP2pSetupWpsPbc(struct IWpaInterface *self, const char *ifName, const char *address); 58 59 int32_t WpaInterfaceP2pSetupWpsPin(struct IWpaInterface *self, const char *ifName, const char *address, 60 const char *pin, char *result, uint32_t resultLen); 61 62 int32_t WpaInterfaceP2pSetPowerSave(struct IWpaInterface *self, const char *ifName, int32_t enable); 63 64 int32_t WpaInterfaceP2pSetDeviceName(struct IWpaInterface *self, const char *ifName, const char *name); 65 66 int32_t WpaInterfaceP2pSetWfdDeviceConfig(struct IWpaInterface *self, const char *ifName, const char *config); 67 68 int32_t WpaInterfaceP2pSetRandomMac(struct IWpaInterface *self, const char *ifName, int32_t networkId); 69 70 int32_t WpaInterfaceP2pStartFind(struct IWpaInterface *self, const char *ifName, int32_t timeout); 71 72 int32_t WpaInterfaceP2pSetExtListen(struct IWpaInterface *self, const char *ifName, int32_t enable, 73 int32_t period, int32_t interval); 74 75 int32_t WpaInterfaceP2pSetListenChannel(struct IWpaInterface *self, const char *ifName, int32_t channel, 76 int32_t regClass); 77 78 int32_t WpaInterfaceP2pProvisionDiscovery(struct IWpaInterface *self, const char *ifName, 79 const char *peerBssid, int32_t mode); 80 81 int32_t WpaInterfaceP2pAddGroup(struct IWpaInterface *self, const char *ifName, int32_t isPersistent, 82 int32_t networkId, int32_t freq); 83 84 int32_t WpaInterfaceP2pAddService(struct IWpaInterface *self, const char *ifName, 85 const struct HdiP2pServiceInfo *info); 86 87 int32_t WpaInterfaceP2pRemoveService(struct IWpaInterface *self, const char *ifName, 88 const struct HdiP2pServiceInfo *info); 89 90 int32_t WpaInterfaceP2pStopFind(struct IWpaInterface *self, const char *ifName); 91 92 int32_t WpaInterfaceP2pFlush(struct IWpaInterface *self, const char *ifName); 93 94 int32_t WpaInterfaceP2pFlushService(struct IWpaInterface *self, const char *ifName); 95 96 int32_t WpaInterfaceP2pRemoveNetwork(struct IWpaInterface *self, const char *ifName, int32_t networkId); 97 98 int32_t WpaInterfaceP2pSetGroupConfig(struct IWpaInterface *self, const char *ifName, 99 const int32_t networkId, const char *name, const char *value); 100 101 int32_t WpaInterfaceP2pInvite(struct IWpaInterface *self, const char *ifName, const char *peerBssid, 102 const char *goBssid); 103 104 int32_t WpaInterfaceP2pReinvoke(struct IWpaInterface *self, const char *ifName, const int32_t networkId, 105 const char *bssid); 106 107 int32_t WpaInterfaceP2pGetDeviceAddress(struct IWpaInterface *self, const char *ifName, char *deviceAddress, 108 uint32_t deviceAddressLen); 109 110 int32_t WpaInterfaceP2pReqServiceDiscovery(struct IWpaInterface *self, const char *ifName, 111 const struct HdiP2pReqService *reqService, char *replyDisc, uint32_t replyDiscLen); 112 113 int32_t WpaInterfaceP2pCancelServiceDiscovery(struct IWpaInterface *self, const char *ifName, const char *id); 114 115 int32_t WpaInterfaceP2pRespServerDiscovery(struct IWpaInterface *self, const char *ifName, 116 const struct HdiP2pServDiscReqInfo *info); 117 118 int32_t WpaInterfaceP2pConnect(struct IWpaInterface *self, const char *ifName, 119 const struct HdiP2pConnectInfo *info, char *replyPin, uint32_t replyPinLen); 120 121 int32_t WpaInterfaceP2pHid2dConnect(struct IWpaInterface *self, const char *ifName, 122 const struct HdiHid2dConnectInfo *info); 123 124 int32_t WpaInterfaceP2pSetServDiscExternal(struct IWpaInterface *self, const char *ifName, int32_t mode); 125 126 int32_t WpaInterfaceP2pRemoveGroup(struct IWpaInterface *self, const char *ifName, const char *groupName); 127 128 int32_t WpaInterfaceP2pCancelConnect(struct IWpaInterface *self, const char *ifName); 129 130 int32_t WpaInterfaceP2pGetGroupConfig(struct IWpaInterface *self, const char *ifName, 131 const int32_t networkId, const char *param, char *value, uint32_t valueLen); 132 133 int32_t WpaInterfaceP2pAddNetwork(struct IWpaInterface *self, const char *ifName, int32_t *networkId); 134 135 int32_t WpaInterfaceP2pGetPeer(struct IWpaInterface *self, const char *ifName, const char *bssid, 136 struct HdiP2pDeviceInfo *info); 137 138 int32_t WpaInterfaceP2pGetGroupCapability(struct IWpaInterface *self, const char *ifName, const char *bssid, 139 int32_t *cap); 140 141 int32_t WpaInterfaceP2pListNetworks(struct IWpaInterface *self, const char *ifName, 142 struct HdiP2pNetworkList *infoList); 143 144 int32_t WpaInterfaceP2pSaveConfig(struct IWpaInterface *self, const char *ifName); 145 146 int32_t WpaInterfaceVendorExtProcessCmd(struct IWpaInterface *self, const char *ifName, const char *cmd); 147 148 int32_t WpaInterfaceDeliverP2pData(struct IWpaInterface *self, const char *ifName, 149 int32_t cmdType, int32_t dataType, const char *carryData); 150 /** 151 * @brief Defines callback for P2p 152 * 153 * @since 4.1 154 * @version 1.0 155 */ 156 int32_t ProcessEventP2pDeviceFound(struct HdfWpaRemoteNode *node, 157 struct P2pDeviceInfoParam *deviceInfoParam, const char *ifName); 158 159 int32_t ProcessEventP2pDeviceLost(struct HdfWpaRemoteNode *node, 160 struct P2pDeviceLostParam *deviceLostParam, const char *ifName); 161 162 int32_t ProcessEventP2pGoNegotiationRequest(struct HdfWpaRemoteNode *node, 163 struct P2pGoNegotiationRequestParam *goNegotiationRequestParam, const char *ifName); 164 165 int32_t ProcessEventP2pGoNegotiationCompleted(struct HdfWpaRemoteNode *node, 166 struct P2pGoNegotiationCompletedParam *goNegotiationCompletedParam, const char *ifName); 167 168 int32_t ProcessEventP2pInvitationReceived(struct HdfWpaRemoteNode *node, 169 struct P2pInvitationReceivedParam *invitationReceivedParam, const char *ifName); 170 171 int32_t ProcessEventP2pInvitationResult(struct HdfWpaRemoteNode *node, 172 struct P2pInvitationResultParam *invitationResultParam, const char *ifName); 173 174 int32_t ProcessEventP2pGroupFormationSuccess(struct HdfWpaRemoteNode *node, 175 const char *ifName); 176 177 int32_t ProcessEventP2pGroupFormationFailure(struct HdfWpaRemoteNode *node, char *reason, 178 const char *ifName); 179 180 int32_t ProcessEventP2pGroupStarted(struct HdfWpaRemoteNode *node, 181 struct P2pGroupStartedParam *groupStartedParam, const char *ifName); 182 183 int32_t ProcessEventP2pGroupRemoved(struct HdfWpaRemoteNode *node, 184 struct P2pGroupRemovedParam *groupRemovedParam, const char *ifName); 185 186 int32_t ProcessEventP2pProvisionDiscoveryCompleted(struct HdfWpaRemoteNode *node, 187 struct P2pProvisionDiscoveryCompletedParam *provisionDiscoveryCompletedParam, const char *ifName); 188 189 int32_t ProcessEventP2pFindStopped(struct HdfWpaRemoteNode *node, 190 const char *ifName); 191 192 int32_t ProcessEventP2pServDiscReq(struct HdfWpaRemoteNode *node, 193 struct P2pServDiscReqInfoParam *servDiscReqInfo, const char *ifName); 194 195 int32_t ProcessEventP2pServDiscResp(struct HdfWpaRemoteNode *node, 196 struct P2pServDiscRespParam *servDiscRespParam, const char *ifName); 197 198 int32_t ProcessEventP2pStaConnectState(struct HdfWpaRemoteNode *node, 199 struct P2pStaConnectStateParam *staConnectStateParam, const char *ifName); 200 201 int32_t ProcessEventP2pIfaceCreated(struct HdfWpaRemoteNode *node, struct P2pIfaceCreatedParam *ifaceCreatedParam, 202 const char *ifName); 203 204 #endif 205