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