Signed-off-by: fengye <fengye10@huawei.com>
This commit is contained in:
fengye 2022-11-21 02:24:13 +00:00
parent 036fe6a988
commit 52fb2892b7
3 changed files with 18 additions and 10 deletions

View File

@ -27,6 +27,20 @@ WifiDeviceCallBackStub::WifiDeviceCallBackStub() : callback_(nullptr), mRemoteDi
WifiDeviceCallBackStub::~WifiDeviceCallBackStub()
{}
int WifiDeviceCallBackStub::OnRemoteInterfaceToken(IpcIo *data)
{
size_t length;
uint16_t* interfaceRead = nullptr;
interfaceRead = ReadInterfaceToken(data, &length);
for (size_t i = 0; i < length; i++) {
if (i >= DECLARE_INTERFACE_DESCRIPTOR_L1_LENGTH || interfaceRead[i] != DECLARE_INTERFACE_DESCRIPTOR_L1[i]) {
WIFI_LOGE("Sta stub token verification error: %{public}d", code);
return WIFI_OPT_FAILED;
}
}
return WIFI_OPT_SUCCESS;
}
int WifiDeviceCallBackStub::OnRemoteRequest(uint32_t code, IpcIo *data)
{
int ret = WIFI_OPT_FAILED;
@ -37,16 +51,9 @@ int WifiDeviceCallBackStub::OnRemoteRequest(uint32_t code, IpcIo *data)
return ret;
}
size_t length;
uint16_t* interfaceRead = nullptr;
interfaceRead = ReadInterfaceToken(data, &length);
for (size_t i = 0; i < length; i++) {
if (i >= DECLARE_INTERFACE_DESCRIPTOR_L1_LENGTH || interfaceRead[i] != DECLARE_INTERFACE_DESCRIPTOR_L1[i]) {
WIFI_LOGE("Sta stub token verification error: %{public}d", code);
return WIFI_OPT_FAILED;
}
if (OnRemoteInterfaceToken(data) == WIFI_OPT_FAILED) {
return WIFI_OPT_FAILED;
}
int exception = WIFI_OPT_FAILED;
(void)ReadInt32(data, &exception);
if (exception) {

View File

@ -38,6 +38,7 @@ public:
void SetRemoteDied(bool val);
private:
int OnRemoteInterfaceToken(IpcIo *data);
int RemoteOnWifiStateChanged(uint32_t code, IpcIo *data);
int RemoteOnWifiConnectionChanged(uint32_t code, IpcIo *data);
int RemoteOnWifiRssiChanged(uint32_t code, IpcIo *data);

View File

@ -52,7 +52,7 @@ int WifiScanStub::OnRemoteRequest(uint32_t code, IpcIo *req, IpcIo *reply)
WIFI_LOGE("req:%{public}d, reply:%{public}d", req == nullptr, reply == nullptr);
return ERR_FAILED;
}
if(CheckInterfaceToken(req) == WIFI_OPT_FAILED) {
if (CheckInterfaceToken(req) == WIFI_OPT_FAILED) {
return WIFI_OPT_FAILED;
}
int exception = ERR_FAILED;