Wifi: Add support for Wifi Aware 3.1

Bug: 203220137
Test: pass vts test
Change-Id: I576e03b7cb94466c094a7e4ca1714dddd81ddd5f
This commit is contained in:
Nate Jiang 2022-01-12 16:06:01 -08:00
parent 208491d282
commit 50c001dd21
10 changed files with 1144 additions and 158 deletions

View file

@ -27,7 +27,6 @@ import IWifiRttController;
* Interface that represents a chip that must be configured as a single unit.
*/
interface IWifiChip extends @1.5::IWifiChip {
/**
* Create a RTTController instance.
*
@ -85,6 +84,6 @@ interface IWifiChip extends @1.5::IWifiChip {
* represents whether particular mode is allowed on that channel.
*/
getUsableChannels_1_6(WifiBand band, bitfield<WifiIfaceMode> ifaceModeMask,
bitfield<UsableChannelFilter> filterMask)
bitfield<UsableChannelFilter> filterMask)
generates (WifiStatus status, vec<WifiUsableChannel> channels);
};

View file

@ -17,8 +17,15 @@
package android.hardware.wifi@1.6;
import @1.0::WifiStatus;
import @1.0::CommandIdShort;
import @1.4::NanConfigRequest;
import @1.4::NanEnableRequest;
import @1.5::IWifiNanIface;
import IWifiNanIfaceEventCallback;
import NanConfigRequestSupplemental;
import NanInitiateDataPathRequest;
import NanPublishRequest;
import NanRespondToDataPathIndicationRequest;
/**
* Interface used to represent a single NAN (Neighbour Aware Network) iface.
@ -40,4 +47,109 @@ interface IWifiNanIface extends @1.5::IWifiNanIface {
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
*/
registerEventCallback_1_6(IWifiNanIfaceEventCallback callback) generates (WifiStatus status);
/**
* Initiate a data-path (NDP) setup operation: Initiator.
* Asynchronous response is with |IWifiNanIfaceEventCallback.notifyInitiateDataPathResponse|.
*
* Note: supersedes the @1.0::IWifiNanIface.respondToDataPathIndicationRequest() method which is
* deprecated as of HAL version 1.6.
*
* @param cmdId command Id to use for this invocation.
* @param msg Instance of |NanInitiateDataPathRequest|.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_INVALID_ARGS|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
initiateDataPathRequest_1_6(CommandIdShort cmdId, NanInitiateDataPathRequest msg)
generates (WifiStatus status);
/**
* Respond to a received data indication as part of a data-path (NDP) setup operation. An
* indication is received by the Responder from the Initiator.
* Asynchronous response is with
* |IWifiNanIfaceEventCallback.notifyRespondToDataPathIndicationResponse|.
*
* Note: supersedes the @1.0::IWifiNanIface.respondToDataPathIndicationRequest() method which is
* deprecated as of HAL version 1.6.
*
* @param cmdId command Id to use for this invocation.
* @param msg Instance of |NanRespondToDataPathIndicationRequest|.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_INVALID_ARGS|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
respondToDataPathIndicationRequest_1_6(CommandIdShort cmdId,
NanRespondToDataPathIndicationRequest msg) generates (WifiStatus status);
/**
* Enable NAN: configures and activates NAN clustering (does not start
* a discovery session or set up data-interfaces or data-paths). Use the
* |IWifiNanIface.configureRequest| method to change the configuration of an already enabled
* NAN interface.
* Asynchronous response is with |IWifiNanIfaceEventCallback.notifyEnableResponse|.
*
* Note: supersedes the @1.5::IWifiNanIface.enableRequest() method which is deprecated as of
* HAL version 1.6.
*
* @param cmdId command Id to use for this invocation.
* @param msg1 Instance of |NanEnableRequest|.
* @param msg2 Instance of |NanConfigRequestSupplemental|.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_INVALID_ARGS|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
enableRequest_1_6(CommandIdShort cmdId, NanEnableRequest msg1,
NanConfigRequestSupplemental msg2) generates (WifiStatus status);
/**
* Configure NAN: configures an existing NAN functionality (i.e. assumes
* |IWifiNanIface.enableRequest| already submitted and succeeded).
* Asynchronous response is with |IWifiNanIfaceEventCallback.notifyConfigResponse|.
*
* Note: supersedes the @1.5::IWifiNanIface.configRequest() method which is deprecated as of
* HAL version 1.6.
*
* @param cmdId command Id to use for this invocation.
* @param msg1 Instance of |NanConfigRequest|.
* @param msg2 Instance of |NanConfigRequestSupplemental|.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_INVALID_ARGS|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
configRequest_1_6(CommandIdShort cmdId, NanConfigRequest msg1,
NanConfigRequestSupplemental msg2) generates (WifiStatus status);
/**
* Publish request to start advertising a discovery service.
* Asynchronous response is with |IWifiNanIfaceEventCallback.notifyStartPublishResponse|.
*
* Note: supersedes the @1.0::IWifiNanIface.startPublishRequest() method which is deprecated as
* of HAL version 1.6.
*
* @param cmdId command Id to use for this invocation.
* @param msg Instance of |NanPublishRequest|.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_INVALID_ARGS|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
startPublishRequest_1_6(CommandIdShort cmdId, NanPublishRequest msg)
generates (WifiStatus status);
};

View file

@ -45,4 +45,30 @@ interface IWifiNanIfaceEventCallback extends @1.5::IWifiNanIfaceEventCallback {
* @param event: NanDataPathScheduleUpdateInd containing event details.
*/
oneway eventDataPathScheduleUpdate_1_6(NanDataPathScheduleUpdateInd event);
/**
* Asynchronous callback indicating that a match has occurred: i.e. a service has been
* discovered.
*
* Note: supersedes the @1.0::IWifiNanIfaceEventCallback.eventMatch(NanMatchInd event) method
* which is deprecated as of HAL version 1.6.
*
* @param event: NanMatchInd containing event details.
*/
oneway eventMatch_1_6(NanMatchInd event);
/**
* Asynchronous callback invoked in response to a capability request
* |IWifiNanIface.getCapabilitiesRequest|.
*
* Note: supersedes the @1.5::IWifiNanIfaceEventCallback.notifyCapabilitiesResponse() method
* which is deprecated as of HAL version 1.6.
*
* @param cmdId command Id corresponding to the original request.
* @param status WifiNanStatus of the operation. Possible status codes are:
* |NanStatusType.SUCCESS|
* @param capabilities Capability data.
*/
oneway notifyCapabilitiesResponse_1_6(CommandIdShort id, WifiNanStatus status,
NanCapabilities capabilities);
};

View file

@ -20,6 +20,7 @@ import @1.0::CommandId;
import @1.0::WifiStatus;
import @1.4::IWifiRttController;
import IWifiRttControllerEventCallback;
/**
* Interface used to perform RTT(Round trip time) operations.
*/

View file

@ -26,7 +26,7 @@ namespace V1_6 {
namespace implementation {
namespace hidl_struct_util {
using V1_5::NanConfigRequestSupplemental;
using V1_6::NanConfigRequestSupplemental;
WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl(legacy_hal::wifi_channel_width type);
@ -1363,11 +1363,11 @@ bool convertHidlNanEnableRequestToLegacy(const V1_4::NanEnableRequest& hidl_requ
return true;
}
bool convertHidlNanEnableRequest_1_4ToLegacy(const V1_4::NanEnableRequest& hidl_request1,
bool convertHidlNanEnableRequest_1_6ToLegacy(const V1_4::NanEnableRequest& hidl_request1,
const NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanEnableRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanEnableRequest_1_4ToLegacy: null legacy_request";
LOG(ERROR) << "convertHidlNanEnableRequest_1_6ToLegacy: null legacy_request";
return false;
}
@ -1377,57 +1377,57 @@ bool convertHidlNanEnableRequest_1_4ToLegacy(const V1_4::NanEnableRequest& hidl_
}
legacy_request->config_discovery_beacon_int = 1;
legacy_request->discovery_beacon_interval = hidl_request2.V1_2.discoveryBeaconIntervalMs;
legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs;
legacy_request->config_nss = 1;
legacy_request->nss = hidl_request2.V1_2.numberOfSpatialStreamsInDiscovery;
legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery;
legacy_request->config_dw_early_termination = 1;
legacy_request->enable_dw_termination =
hidl_request2.V1_2.enableDiscoveryWindowEarlyTermination;
hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination;
legacy_request->config_enable_ranging = 1;
legacy_request->enable_ranging = hidl_request2.V1_2.enableRanging;
return true;
}
bool convertHidlNanEnableRequest_1_5ToLegacy(const V1_4::NanEnableRequest& hidl_request1,
const NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanEnableRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanEnableRequest_1_5ToLegacy: null legacy_request";
return false;
}
*legacy_request = {};
if (!convertHidlNanEnableRequest_1_4ToLegacy(hidl_request1, hidl_request2, legacy_request)) {
return false;
}
legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging;
legacy_request->config_enable_instant_mode = 1;
legacy_request->enable_instant_mode = hidl_request2.enableInstantCommunicationMode;
legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode;
legacy_request->config_instant_mode_channel = 1;
legacy_request->instant_mode_channel = hidl_request2.instantModeChannel;
return true;
}
bool convertHidlNanConfigRequest_1_5ToLegacy(const V1_4::NanConfigRequest& hidl_request1,
bool convertHidlNanConfigRequest_1_6ToLegacy(const V1_4::NanConfigRequest& hidl_request1,
const NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanConfigRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanConfigRequest_1_5ToLegacy: null legacy_request";
LOG(ERROR) << "convertHidlNanConfigRequest_1_6ToLegacy: null legacy_request";
return false;
}
*legacy_request = {};
if (!convertHidlNanConfigRequest_1_4ToLegacy(hidl_request1, hidl_request2, legacy_request)) {
if (!convertHidlNanConfigRequestToLegacy(hidl_request1, legacy_request)) {
return false;
}
legacy_request->config_discovery_beacon_int = 1;
legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs;
legacy_request->config_nss = 1;
legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery;
legacy_request->config_dw_early_termination = 1;
legacy_request->enable_dw_termination =
hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination;
legacy_request->config_enable_ranging = 1;
legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging;
return true;
legacy_request->config_enable_instant_mode = 1;
legacy_request->enable_instant_mode = hidl_request2.enableInstantCommunicationMode;
legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode;
legacy_request->config_instant_mode_channel = 1;
legacy_request->instant_mode_channel = hidl_request2.instantModeChannel;
return true;
}
bool convertHidlNanPublishRequestToLegacy(const NanPublishRequest& hidl_request,
bool convertHidlNanPublishRequestToLegacy(const V1_6::NanPublishRequest& hidl_request,
legacy_hal::NanPublishRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: null legacy_request";
@ -1494,6 +1494,15 @@ bool convertHidlNanPublishRequestToLegacy(const NanPublishRequest& hidl_request,
hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0;
legacy_request->recv_indication_cfg |= 0x8;
legacy_request->cipher_type = (unsigned int)hidl_request.baseConfigs.securityConfig.cipherType;
legacy_request->scid_len = hidl_request.baseConfigs.securityConfig.scid.size();
if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) {
LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: scid_len too large";
return false;
}
memcpy(legacy_request->scid, hidl_request.baseConfigs.securityConfig.scid.data(),
legacy_request->scid_len);
if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) {
legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
legacy_request->key_info.body.pmk_info.pmk_len =
@ -1531,6 +1540,7 @@ bool convertHidlNanPublishRequestToLegacy(const NanPublishRequest& hidl_request,
(hidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN)
? legacy_hal::NAN_DP_CONFIG_SECURITY
: legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired
? legacy_hal::NAN_RANGING_ENABLE
: legacy_hal::NAN_RANGING_DISABLE;
@ -1554,7 +1564,7 @@ bool convertHidlNanPublishRequestToLegacy(const NanPublishRequest& hidl_request,
return true;
}
bool convertHidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& hidl_request,
bool convertHidlNanSubscribeRequestToLegacy(const V1_0::NanSubscribeRequest& hidl_request,
legacy_hal::NanSubscribeRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: legacy_request is null";
@ -1835,35 +1845,8 @@ bool convertHidlNanConfigRequestToLegacy(const V1_4::NanConfigRequest& hidl_requ
return true;
}
bool convertHidlNanConfigRequest_1_4ToLegacy(const V1_4::NanConfigRequest& hidl_request1,
const NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanConfigRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanConfigRequest_1_4ToLegacy: legacy_request "
"is null";
return false;
}
*legacy_request = {};
if (!convertHidlNanConfigRequestToLegacy(hidl_request1, legacy_request)) {
return false;
}
legacy_request->config_discovery_beacon_int = 1;
legacy_request->discovery_beacon_interval = hidl_request2.V1_2.discoveryBeaconIntervalMs;
legacy_request->config_nss = 1;
legacy_request->nss = hidl_request2.V1_2.numberOfSpatialStreamsInDiscovery;
legacy_request->config_dw_early_termination = 1;
legacy_request->enable_dw_termination =
hidl_request2.V1_2.enableDiscoveryWindowEarlyTermination;
legacy_request->config_enable_ranging = 1;
legacy_request->enable_ranging = hidl_request2.V1_2.enableRanging;
return true;
}
bool convertHidlNanDataPathInitiatorRequestToLegacy(
const NanInitiateDataPathRequest& hidl_request,
const V1_0::NanInitiateDataPathRequest& hidl_request,
legacy_hal::NanDataPathInitiatorRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: "
@ -1939,8 +1922,91 @@ bool convertHidlNanDataPathInitiatorRequestToLegacy(
return true;
}
bool convertHidlNanDataPathInitiatorRequest_1_6ToLegacy(
const V1_6::NanInitiateDataPathRequest& hidl_request,
legacy_hal::NanDataPathInitiatorRequest* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: "
"legacy_request is null";
return false;
}
*legacy_request = {};
legacy_request->requestor_instance_id = hidl_request.peerId;
memcpy(legacy_request->peer_disc_mac_addr, hidl_request.peerDiscMacAddr.data(), 6);
legacy_request->channel_request_type =
convertHidlNanDataPathChannelCfgToLegacy(hidl_request.channelRequestType);
legacy_request->channel = hidl_request.channel;
if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: "
"ifaceName too long";
return false;
}
strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
legacy_request->ndp_cfg.security_cfg =
(hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN)
? legacy_hal::NAN_DP_CONFIG_SECURITY
: legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size();
if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: "
"ndp_app_info_len too large";
return false;
}
memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(),
legacy_request->app_info.ndp_app_info_len);
legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType;
if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) {
legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size();
if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: "
"invalid pmk_len";
return false;
}
memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(),
legacy_request->key_info.body.pmk_info.pmk_len);
}
if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) {
legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE;
legacy_request->key_info.body.passphrase_info.passphrase_len =
hidl_request.securityConfig.passphrase.size();
if (legacy_request->key_info.body.passphrase_info.passphrase_len <
NAN_SECURITY_MIN_PASSPHRASE_LEN) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: "
"passphrase_len too small";
return false;
}
if (legacy_request->key_info.body.passphrase_info.passphrase_len >
NAN_SECURITY_MAX_PASSPHRASE_LEN) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: "
"passphrase_len too large";
return false;
}
memcpy(legacy_request->key_info.body.passphrase_info.passphrase,
hidl_request.securityConfig.passphrase.data(),
legacy_request->key_info.body.passphrase_info.passphrase_len);
}
legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size();
if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: "
"service_name_len too large";
return false;
}
memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(),
legacy_request->service_name_len);
legacy_request->scid_len = hidl_request.securityConfig.scid.size();
if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: scid_len too large";
return false;
}
memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len);
return true;
}
bool convertHidlNanDataPathIndicationResponseToLegacy(
const NanRespondToDataPathIndicationRequest& hidl_request,
const V1_0::NanRespondToDataPathIndicationRequest& hidl_request,
legacy_hal::NanDataPathIndicationResponse* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: "
@ -2014,6 +2080,87 @@ bool convertHidlNanDataPathIndicationResponseToLegacy(
return true;
}
bool convertHidlNanDataPathIndicationResponse_1_6ToLegacy(
const V1_6::NanRespondToDataPathIndicationRequest& hidl_request,
legacy_hal::NanDataPathIndicationResponse* legacy_request) {
if (!legacy_request) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: "
"legacy_request is null";
return false;
}
*legacy_request = {};
legacy_request->rsp_code = hidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT
: legacy_hal::NAN_DP_REQUEST_REJECT;
legacy_request->ndp_instance_id = hidl_request.ndpInstanceId;
if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: "
"ifaceName too long";
return false;
}
strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
legacy_request->ndp_cfg.security_cfg =
(hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN)
? legacy_hal::NAN_DP_CONFIG_SECURITY
: legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size();
if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: "
"ndp_app_info_len too large";
return false;
}
memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(),
legacy_request->app_info.ndp_app_info_len);
legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType;
if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) {
legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size();
if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: "
"invalid pmk_len";
return false;
}
memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(),
legacy_request->key_info.body.pmk_info.pmk_len);
}
if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) {
legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE;
legacy_request->key_info.body.passphrase_info.passphrase_len =
hidl_request.securityConfig.passphrase.size();
if (legacy_request->key_info.body.passphrase_info.passphrase_len <
NAN_SECURITY_MIN_PASSPHRASE_LEN) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: "
"passphrase_len too small";
return false;
}
if (legacy_request->key_info.body.passphrase_info.passphrase_len >
NAN_SECURITY_MAX_PASSPHRASE_LEN) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: "
"passphrase_len too large";
return false;
}
memcpy(legacy_request->key_info.body.passphrase_info.passphrase,
hidl_request.securityConfig.passphrase.data(),
legacy_request->key_info.body.passphrase_info.passphrase_len);
}
legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size();
if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: "
"service_name_len too large";
return false;
}
memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(),
legacy_request->service_name_len);
legacy_request->scid_len = hidl_request.securityConfig.scid.size();
if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: scid_len too large";
return false;
}
memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len);
return true;
}
bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& legacy_response,
WifiNanStatus* wifiNanStatus) {
if (!wifiNanStatus) {
@ -2028,7 +2175,7 @@ bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& lega
}
bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilities& legacy_response,
V1_5::NanCapabilities* hidl_response) {
V1_6::NanCapabilities* hidl_response) {
if (!hidl_response) {
LOG(ERROR) << "convertLegacyNanCapabilitiesResponseToHidl: "
"hidl_response is null";
@ -2036,29 +2183,29 @@ bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilitie
}
*hidl_response = {};
hidl_response->V1_0.maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters;
hidl_response->V1_0.maxPublishes = legacy_response.max_publishes;
hidl_response->V1_0.maxSubscribes = legacy_response.max_subscribes;
hidl_response->V1_0.maxServiceNameLen = legacy_response.max_service_name_len;
hidl_response->V1_0.maxMatchFilterLen = legacy_response.max_match_filter_len;
hidl_response->V1_0.maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len;
hidl_response->V1_0.maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len;
hidl_response->V1_0.maxExtendedServiceSpecificInfoLen =
hidl_response->maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters;
hidl_response->maxPublishes = legacy_response.max_publishes;
hidl_response->maxSubscribes = legacy_response.max_subscribes;
hidl_response->maxServiceNameLen = legacy_response.max_service_name_len;
hidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len;
hidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len;
hidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len;
hidl_response->maxExtendedServiceSpecificInfoLen =
legacy_response.max_sdea_service_specific_info_len;
hidl_response->V1_0.maxNdiInterfaces = legacy_response.max_ndi_interfaces;
hidl_response->V1_0.maxNdpSessions = legacy_response.max_ndp_sessions;
hidl_response->V1_0.maxAppInfoLen = legacy_response.max_app_info_len;
hidl_response->V1_0.maxQueuedTransmitFollowupMsgs =
hidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces;
hidl_response->maxNdpSessions = legacy_response.max_ndp_sessions;
hidl_response->maxAppInfoLen = legacy_response.max_app_info_len;
hidl_response->maxQueuedTransmitFollowupMsgs =
legacy_response.max_queued_transmit_followup_msgs;
hidl_response->V1_0.maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address;
hidl_response->V1_0.supportedCipherSuites = legacy_response.cipher_suites_supported;
hidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address;
hidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported;
hidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported;
return true;
}
bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
NanMatchInd* hidl_ind) {
V1_6::NanMatchInd* hidl_ind) {
if (!hidl_ind) {
LOG(ERROR) << "convertLegacyNanMatchIndToHidl: hidl_ind is null";
return false;
@ -2080,14 +2227,14 @@ bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
hidl_ind->matchOccuredInBeaconFlag = legacy_ind.match_occured_flag == 1;
hidl_ind->outOfResourceFlag = legacy_ind.out_of_resource_flag == 1;
hidl_ind->rssiValue = legacy_ind.rssi_value;
hidl_ind->peerCipherType = (NanCipherSuiteType)legacy_ind.peer_cipher_type;
hidl_ind->peerCipherType = (V1_6::NanCipherSuiteType)legacy_ind.peer_cipher_type;
hidl_ind->peerRequiresSecurityEnabledInNdp =
legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY;
hidl_ind->peerRequiresRanging =
legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE;
hidl_ind->rangingMeasurementInCm = legacy_ind.range_info.range_measurement_mm / 10;
hidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm;
hidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type;
hidl_ind->scid = std::vector<uint8_t>(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len);
return true;
}

View file

@ -116,41 +116,40 @@ bool convertHidlNanEnableRequestToLegacy(const V1_4::NanEnableRequest& hidl_requ
legacy_hal::NanEnableRequest* legacy_request);
bool convertHidlNanConfigRequestToLegacy(const V1_4::NanConfigRequest& hidl_request,
legacy_hal::NanConfigRequest* legacy_request);
bool convertHidlNanEnableRequest_1_4ToLegacy(
bool convertHidlNanEnableRequest_1_6ToLegacy(
const V1_4::NanEnableRequest& hidl_request1,
const V1_5::NanConfigRequestSupplemental& hidl_request2,
const V1_6::NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanEnableRequest* legacy_request);
bool convertHidlNanConfigRequest_1_4ToLegacy(
bool convertHidlNanConfigRequest_1_6ToLegacy(
const V1_4::NanConfigRequest& hidl_request1,
const V1_5::NanConfigRequestSupplemental& hidl_request2,
const V1_6::NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanConfigRequest* legacy_request);
bool convertHidlNanEnableRequest_1_5ToLegacy(
const V1_4::NanEnableRequest& hidl_request1,
const V1_5::NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanEnableRequest* legacy_request);
bool convertHidlNanConfigRequest_1_5ToLegacy(
const V1_4::NanConfigRequest& hidl_request1,
const V1_5::NanConfigRequestSupplemental& hidl_request2,
legacy_hal::NanConfigRequest* legacy_request);
bool convertHidlNanPublishRequestToLegacy(const NanPublishRequest& hidl_request,
bool convertHidlNanPublishRequestToLegacy(const V1_6::NanPublishRequest& hidl_request,
legacy_hal::NanPublishRequest* legacy_request);
bool convertHidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& hidl_request,
bool convertHidlNanSubscribeRequestToLegacy(const V1_0::NanSubscribeRequest& hidl_request,
legacy_hal::NanSubscribeRequest* legacy_request);
bool convertHidlNanTransmitFollowupRequestToLegacy(
const NanTransmitFollowupRequest& hidl_request,
legacy_hal::NanTransmitFollowupRequest* legacy_request);
bool convertHidlNanDataPathInitiatorRequestToLegacy(
const NanInitiateDataPathRequest& hidl_request,
const V1_0::NanInitiateDataPathRequest& hidl_request,
legacy_hal::NanDataPathInitiatorRequest* legacy_request);
bool convertHidlNanDataPathIndicationResponseToLegacy(
const NanRespondToDataPathIndicationRequest& hidl_response,
const V1_0::NanRespondToDataPathIndicationRequest& hidl_response,
legacy_hal::NanDataPathIndicationResponse* legacy_response);
bool convertHidlNanDataPathInitiatorRequest_1_6ToLegacy(
const V1_6::NanInitiateDataPathRequest& hidl_request,
legacy_hal::NanDataPathInitiatorRequest* legacy_request);
bool convertHidlNanDataPathIndicationResponse_1_6ToLegacy(
const V1_6::NanRespondToDataPathIndicationRequest& hidl_response,
legacy_hal::NanDataPathIndicationResponse* legacy_response);
bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& legacy_response,
WifiNanStatus* wifiNanStatus);
bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilities& legacy_response,
V1_5::NanCapabilities* hidl_response);
V1_6::NanCapabilities* hidl_response);
bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
NanMatchInd* hidl_ind);
V1_6::NanMatchInd* hidl_ind);
bool convertLegacyNanFollowupIndToHidl(const legacy_hal::NanFollowupInd& legacy_ind,
NanFollowupReceivedInd* hidl_ind);
bool convertLegacyNanDataPathRequestIndToHidl(const legacy_hal::NanDataPathRequestInd& legacy_ind,

View file

@ -77,7 +77,8 @@ class MockNanIfaceEventCallback : public V1_5::IWifiNanIfaceEventCallback {
MOCK_METHOD1(eventDisabled, Return<void>(const WifiNanStatus&));
MOCK_METHOD2(eventPublishTerminated, Return<void>(uint8_t, const WifiNanStatus&));
MOCK_METHOD2(eventSubscribeTerminated, Return<void>(uint8_t, const WifiNanStatus&));
MOCK_METHOD1(eventMatch, Return<void>(const NanMatchInd&));
MOCK_METHOD1(eventMatch, Return<void>(const V1_0::NanMatchInd&));
MOCK_METHOD1(eventMatch_1_6, Return<void>(const NanMatchInd&));
MOCK_METHOD2(eventMatchExpired, Return<void>(uint8_t, uint32_t));
MOCK_METHOD1(eventFollowupReceived, Return<void>(const NanFollowupReceivedInd&));
MOCK_METHOD2(eventTransmitFollowup, Return<void>(uint16_t, const WifiNanStatus&));

View file

@ -135,14 +135,14 @@ WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface,
break;
}
case legacy_hal::NAN_GET_CAPABILITIES: {
V1_5::NanCapabilities hidl_struct;
V1_6::NanCapabilities hidl_struct;
if (!hidl_struct_util::convertLegacyNanCapabilitiesResponseToHidl(
msg.body.nan_capabilities, &hidl_struct)) {
LOG(ERROR) << "Failed to convert nan capabilities response";
return;
}
for (const auto& callback : shared_ptr_this->getEventCallbacks_1_5()) {
if (!callback->notifyCapabilitiesResponse_1_5(id, wifiNanStatus, hidl_struct)
for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) {
if (!callback->notifyCapabilitiesResponse_1_6(id, wifiNanStatus, hidl_struct)
.isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@ -285,14 +285,14 @@ WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface,
LOG(ERROR) << "Callback invoked on an invalid object";
return;
}
NanMatchInd hidl_struct;
V1_6::NanMatchInd hidl_struct;
if (!hidl_struct_util::convertLegacyNanMatchIndToHidl(msg, &hidl_struct)) {
LOG(ERROR) << "Failed to convert nan capabilities response";
return;
}
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventMatch(hidl_struct).isOk()) {
for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) {
if (!callback->eventMatch_1_6(hidl_struct).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
}
@ -554,7 +554,7 @@ Return<void> WifiNanIface::disableRequest(uint16_t cmd_id, disableRequest_cb hid
&WifiNanIface::disableRequestInternal, hidl_status_cb, cmd_id);
}
Return<void> WifiNanIface::startPublishRequest(uint16_t cmd_id, const NanPublishRequest& msg,
Return<void> WifiNanIface::startPublishRequest(uint16_t cmd_id, const V1_0::NanPublishRequest& msg,
startPublishRequest_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::startPublishRequestInternal, hidl_status_cb, cmd_id, msg);
@ -567,7 +567,8 @@ Return<void> WifiNanIface::stopPublishRequest(uint16_t cmd_id, uint8_t sessionId
sessionId);
}
Return<void> WifiNanIface::startSubscribeRequest(uint16_t cmd_id, const NanSubscribeRequest& msg,
Return<void> WifiNanIface::startSubscribeRequest(uint16_t cmd_id,
const V1_0::NanSubscribeRequest& msg,
startSubscribeRequest_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::startSubscribeRequestInternal, hidl_status_cb, cmd_id,
@ -606,7 +607,7 @@ Return<void> WifiNanIface::deleteDataInterfaceRequest(
}
Return<void> WifiNanIface::initiateDataPathRequest(uint16_t cmd_id,
const NanInitiateDataPathRequest& msg,
const V1_0::NanInitiateDataPathRequest& msg,
initiateDataPathRequest_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::initiateDataPathRequestInternal, hidl_status_cb, cmd_id,
@ -614,7 +615,7 @@ Return<void> WifiNanIface::initiateDataPathRequest(uint16_t cmd_id,
}
Return<void> WifiNanIface::respondToDataPathIndicationRequest(
uint16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg,
uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg,
respondToDataPathIndicationRequest_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::respondToDataPathIndicationRequestInternal,
@ -699,6 +700,46 @@ Return<void> WifiNanIface::getCapabilitiesRequest_1_5(
cmd_id);
}
Return<void> WifiNanIface::enableRequest_1_6(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1,
const V1_6::NanConfigRequestSupplemental& msg2,
enableRequest_1_5_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::enableRequest_1_6Internal, hidl_status_cb, cmd_id, msg1,
msg2);
}
Return<void> WifiNanIface::configRequest_1_6(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1,
const V1_6::NanConfigRequestSupplemental& msg2,
configRequest_1_5_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::configRequest_1_6Internal, hidl_status_cb, cmd_id, msg1,
msg2);
}
Return<void> WifiNanIface::initiateDataPathRequest_1_6(uint16_t cmd_id,
const V1_6::NanInitiateDataPathRequest& msg,
initiateDataPathRequest_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::initiateDataPathRequest_1_6Internal, hidl_status_cb,
cmd_id, msg);
}
Return<void> WifiNanIface::respondToDataPathIndicationRequest_1_6(
uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg,
respondToDataPathIndicationRequest_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::respondToDataPathIndicationRequest_1_6Internal,
hidl_status_cb, cmd_id, msg);
}
Return<void> WifiNanIface::startPublishRequest_1_6(uint16_t cmd_id,
const V1_6::NanPublishRequest& msg,
startPublishRequest_cb hidl_status_cb) {
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
&WifiNanIface::startPublishRequest_1_6Internal, hidl_status_cb, cmd_id,
msg);
}
std::pair<WifiStatus, std::string> WifiNanIface::getNameInternal() {
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
}
@ -742,15 +783,9 @@ WifiStatus WifiNanIface::disableRequestInternal(uint16_t cmd_id) {
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiNanIface::startPublishRequestInternal(uint16_t cmd_id,
const NanPublishRequest& msg) {
legacy_hal::NanPublishRequest legacy_msg;
if (!hidl_struct_util::convertHidlNanPublishRequestToLegacy(msg, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->nanPublishRequest(ifname_, cmd_id, legacy_msg);
return createWifiStatusFromLegacyError(legacy_status);
WifiStatus WifiNanIface::startPublishRequestInternal(uint16_t /* cmd_id */,
const V1_0::NanPublishRequest& /* msg */) {
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
}
WifiStatus WifiNanIface::stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId) {
@ -762,7 +797,7 @@ WifiStatus WifiNanIface::stopPublishRequestInternal(uint16_t cmd_id, uint8_t ses
}
WifiStatus WifiNanIface::startSubscribeRequestInternal(uint16_t cmd_id,
const NanSubscribeRequest& msg) {
const V1_0::NanSubscribeRequest& msg) {
legacy_hal::NanSubscribeRequest legacy_msg;
if (!hidl_struct_util::convertHidlNanSubscribeRequestToLegacy(msg, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
@ -803,8 +838,8 @@ WifiStatus WifiNanIface::deleteDataInterfaceRequestInternal(uint16_t cmd_id,
legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, cmd_id, iface_name);
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiNanIface::initiateDataPathRequestInternal(uint16_t cmd_id,
const NanInitiateDataPathRequest& msg) {
WifiStatus WifiNanIface::initiateDataPathRequestInternal(
uint16_t cmd_id, const V1_0::NanInitiateDataPathRequest& msg) {
legacy_hal::NanDataPathInitiatorRequest legacy_msg;
if (!hidl_struct_util::convertHidlNanDataPathInitiatorRequestToLegacy(msg, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
@ -814,7 +849,7 @@ WifiStatus WifiNanIface::initiateDataPathRequestInternal(uint16_t cmd_id,
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiNanIface::respondToDataPathIndicationRequestInternal(
uint16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg) {
uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg) {
legacy_hal::NanDataPathIndicationResponse legacy_msg;
if (!hidl_struct_util::convertHidlNanDataPathIndicationResponseToLegacy(msg, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
@ -886,11 +921,23 @@ WifiStatus WifiNanIface::getCapabilitiesRequest_1_5Internal(uint16_t cmd_id) {
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiNanIface::enableRequest_1_5Internal(uint16_t cmd_id,
WifiStatus WifiNanIface::enableRequest_1_5Internal(
uint16_t /* cmd_id */, const V1_4::NanEnableRequest& /* msg1 */,
const V1_5::NanConfigRequestSupplemental& /* msg2 */) {
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
}
WifiStatus WifiNanIface::configRequest_1_5Internal(
uint16_t /* cmd_id */, const V1_4::NanConfigRequest& /* msg1 */,
const V1_5::NanConfigRequestSupplemental& /* msg2 */) {
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
}
WifiStatus WifiNanIface::enableRequest_1_6Internal(uint16_t cmd_id,
const V1_4::NanEnableRequest& msg1,
const V1_5::NanConfigRequestSupplemental& msg2) {
const V1_6::NanConfigRequestSupplemental& msg2) {
legacy_hal::NanEnableRequest legacy_msg;
if (!hidl_struct_util::convertHidlNanEnableRequest_1_5ToLegacy(msg1, msg2, &legacy_msg)) {
if (!hidl_struct_util::convertHidlNanEnableRequest_1_6ToLegacy(msg1, msg2, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
legacy_hal::wifi_error legacy_status =
@ -898,11 +945,11 @@ WifiStatus WifiNanIface::enableRequest_1_5Internal(uint16_t cmd_id,
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiNanIface::configRequest_1_5Internal(uint16_t cmd_id,
WifiStatus WifiNanIface::configRequest_1_6Internal(uint16_t cmd_id,
const V1_4::NanConfigRequest& msg1,
const V1_5::NanConfigRequestSupplemental& msg2) {
const V1_6::NanConfigRequestSupplemental& msg2) {
legacy_hal::NanConfigRequest legacy_msg;
if (!hidl_struct_util::convertHidlNanConfigRequest_1_5ToLegacy(msg1, msg2, &legacy_msg)) {
if (!hidl_struct_util::convertHidlNanConfigRequest_1_6ToLegacy(msg1, msg2, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
legacy_hal::wifi_error legacy_status =
@ -910,6 +957,39 @@ WifiStatus WifiNanIface::configRequest_1_5Internal(uint16_t cmd_id,
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiNanIface::initiateDataPathRequest_1_6Internal(
uint16_t cmd_id, const V1_6::NanInitiateDataPathRequest& msg) {
legacy_hal::NanDataPathInitiatorRequest legacy_msg;
if (!hidl_struct_util::convertHidlNanDataPathInitiatorRequest_1_6ToLegacy(msg, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg);
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiNanIface::respondToDataPathIndicationRequest_1_6Internal(
uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg) {
legacy_hal::NanDataPathIndicationResponse legacy_msg;
if (!hidl_struct_util::convertHidlNanDataPathIndicationResponse_1_6ToLegacy(msg, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg);
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiNanIface::startPublishRequest_1_6Internal(uint16_t cmd_id,
const V1_6::NanPublishRequest& msg) {
legacy_hal::NanPublishRequest legacy_msg;
if (!hidl_struct_util::convertHidlNanPublishRequestToLegacy(msg, &legacy_msg)) {
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->nanPublishRequest(ifname_, cmd_id, legacy_msg);
return createWifiStatusFromLegacyError(legacy_status);
}
WifiStatus WifiNanIface::registerEventCallback_1_6Internal(
const sp<V1_6::IWifiNanIfaceEventCallback>& callback) {
sp<V1_0::IWifiNanIfaceEventCallback> callback_1_0 = callback;

View file

@ -32,6 +32,8 @@ namespace V1_6 {
namespace implementation {
using namespace android::hardware::wifi::V1_0;
using namespace android::hardware::wifi::V1_2;
using namespace android::hardware::wifi::V1_4;
using namespace android::hardware::wifi::V1_6;
/**
* HIDL interface object used to control a NAN Iface instance.
@ -58,11 +60,11 @@ class WifiNanIface : public V1_6::IWifiNanIface {
Return<void> configRequest(uint16_t cmd_id, const V1_0::NanConfigRequest& msg,
configRequest_cb hidl_status_cb) override;
Return<void> disableRequest(uint16_t cmd_id, disableRequest_cb hidl_status_cb) override;
Return<void> startPublishRequest(uint16_t cmd_id, const NanPublishRequest& msg,
Return<void> startPublishRequest(uint16_t cmd_id, const V1_0::NanPublishRequest& msg,
startPublishRequest_cb hidl_status_cb) override;
Return<void> stopPublishRequest(uint16_t cmd_id, uint8_t sessionId,
stopPublishRequest_cb hidl_status_cb) override;
Return<void> startSubscribeRequest(uint16_t cmd_id, const NanSubscribeRequest& msg,
Return<void> startSubscribeRequest(uint16_t cmd_id, const V1_0::NanSubscribeRequest& msg,
startSubscribeRequest_cb hidl_status_cb) override;
Return<void> stopSubscribeRequest(uint16_t cmd_id, uint8_t sessionId,
stopSubscribeRequest_cb hidl_status_cb) override;
@ -72,10 +74,11 @@ class WifiNanIface : public V1_6::IWifiNanIface {
createDataInterfaceRequest_cb hidl_status_cb) override;
Return<void> deleteDataInterfaceRequest(uint16_t cmd_id, const hidl_string& iface_name,
deleteDataInterfaceRequest_cb hidl_status_cb) override;
Return<void> initiateDataPathRequest(uint16_t cmd_id, const NanInitiateDataPathRequest& msg,
Return<void> initiateDataPathRequest(uint16_t cmd_id,
const V1_0::NanInitiateDataPathRequest& msg,
initiateDataPathRequest_cb hidl_status_cb) override;
Return<void> respondToDataPathIndicationRequest(
uint16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg,
uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg,
respondToDataPathIndicationRequest_cb hidl_status_cb) override;
Return<void> terminateDataPathRequest(uint16_t cmd_id, uint32_t ndpInstanceId,
terminateDataPathRequest_cb hidl_status_cb) override;
@ -98,14 +101,28 @@ class WifiNanIface : public V1_6::IWifiNanIface {
registerEventCallback_1_5_cb hidl_status_cb) override;
Return<void> enableRequest_1_5(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1,
const V1_5::NanConfigRequestSupplemental& msg2,
enableRequest_1_4_cb hidl_status_cb) override;
enableRequest_1_5_cb hidl_status_cb) override;
Return<void> configRequest_1_5(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1,
const V1_5::NanConfigRequestSupplemental& msg2,
configRequest_1_4_cb hidl_status_cb) override;
configRequest_1_5_cb hidl_status_cb) override;
Return<void> getCapabilitiesRequest_1_5(uint16_t cmd_id,
getCapabilitiesRequest_cb hidl_status_cb) override;
Return<void> registerEventCallback_1_6(const sp<V1_6::IWifiNanIfaceEventCallback>& callback,
registerEventCallback_1_6_cb hidl_status_cb) override;
Return<void> initiateDataPathRequest_1_6(
uint16_t cmd_id, const V1_6::NanInitiateDataPathRequest& msg,
initiateDataPathRequest_1_6_cb hidl_status_cb) override;
Return<void> respondToDataPathIndicationRequest_1_6(
uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg,
respondToDataPathIndicationRequest_1_6_cb hidl_status_cb) override;
Return<void> enableRequest_1_6(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1,
const V1_6::NanConfigRequestSupplemental& msg2,
enableRequest_1_6_cb hidl_status_cb) override;
Return<void> configRequest_1_6(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1,
const V1_6::NanConfigRequestSupplemental& msg2,
configRequest_1_6_cb hidl_status_cb) override;
Return<void> startPublishRequest_1_6(uint16_t cmd_id, const V1_6::NanPublishRequest& msg,
startPublishRequest_cb hidl_status_cb) override;
private:
// Corresponding worker functions for the HIDL methods.
@ -116,18 +133,18 @@ class WifiNanIface : public V1_6::IWifiNanIface {
WifiStatus enableRequestInternal(uint16_t cmd_id, const V1_0::NanEnableRequest& msg);
WifiStatus configRequestInternal(uint16_t cmd_id, const V1_0::NanConfigRequest& msg);
WifiStatus disableRequestInternal(uint16_t cmd_id);
WifiStatus startPublishRequestInternal(uint16_t cmd_id, const NanPublishRequest& msg);
WifiStatus startPublishRequestInternal(uint16_t cmd_id, const V1_0::NanPublishRequest& msg);
WifiStatus stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId);
WifiStatus startSubscribeRequestInternal(uint16_t cmd_id, const NanSubscribeRequest& msg);
WifiStatus startSubscribeRequestInternal(uint16_t cmd_id, const V1_0::NanSubscribeRequest& msg);
WifiStatus stopSubscribeRequestInternal(uint16_t cmd_id, uint8_t sessionId);
WifiStatus transmitFollowupRequestInternal(uint16_t cmd_id,
const NanTransmitFollowupRequest& msg);
WifiStatus createDataInterfaceRequestInternal(uint16_t cmd_id, const std::string& iface_name);
WifiStatus deleteDataInterfaceRequestInternal(uint16_t cmd_id, const std::string& iface_name);
WifiStatus initiateDataPathRequestInternal(uint16_t cmd_id,
const NanInitiateDataPathRequest& msg);
const V1_0::NanInitiateDataPathRequest& msg);
WifiStatus respondToDataPathIndicationRequestInternal(
uint16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg);
uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg);
WifiStatus terminateDataPathRequestInternal(uint16_t cmd_id, uint32_t ndpInstanceId);
WifiStatus registerEventCallback_1_2Internal(
@ -150,6 +167,16 @@ class WifiNanIface : public V1_6::IWifiNanIface {
WifiStatus registerEventCallback_1_6Internal(
const sp<V1_6::IWifiNanIfaceEventCallback>& callback);
WifiStatus enableRequest_1_6Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1,
const V1_6::NanConfigRequestSupplemental& msg2);
WifiStatus configRequest_1_6Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg,
const V1_6::NanConfigRequestSupplemental& msg2);
WifiStatus startPublishRequest_1_6Internal(uint16_t cmd_id, const V1_6::NanPublishRequest& msg);
WifiStatus initiateDataPathRequest_1_6Internal(uint16_t cmd_id,
const V1_6::NanInitiateDataPathRequest& msg);
WifiStatus respondToDataPathIndicationRequest_1_6Internal(
uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg);
// all 1_0 and descendant callbacks
std::set<sp<V1_0::IWifiNanIfaceEventCallback>> getEventCallbacks();
// all 1_2 and descendant callbacks

View file

@ -17,7 +17,18 @@
package android.hardware.wifi@1.6;
import @1.0::MacAddress;
import @1.0::NanCipherSuiteType;
import @1.0::NanDataPathChannelCfg;
import @1.0::NanDataPathConfirmInd;
import @1.0::NanDataPathSecurityConfig;
import @1.0::NanDataPathSecurityType;
import @1.0::NanDiscoveryCommonConfig;
import @1.0::NanInitiateDataPathRequest;
import @1.0::NanMatchAlg;
import @1.0::NanRangingIndication;
import @1.0::NanRespondToDataPathIndicationRequest;
import @1.0::NanPublishType;
import @1.0::NanTxType;
import @1.0::Rssi;
import @1.0::RttBw;
import @1.0::RttPeerType;
@ -34,6 +45,7 @@ import @1.0::WifiInformationElement;
import @1.0::WifiRateNss;
import @1.4::RttPreamble;
import @1.4::WifiRatePreamble;
import @1.5::NanConfigRequestSupplemental;
import @1.5::StaLinkLayerIfaceContentionTimeStats;
import @1.5::WifiIfaceMode;
@ -78,22 +90,25 @@ enum WifiRatePreamble : @1.4::WifiRatePreamble {
* Channel information.
*/
struct WifiChannelInfo {
/**
* Channel width (20, 40, 80, 80+80, 160, 320).
*/
WifiChannelWidthInMhz width;
/**
* Primary 20 MHz channel.
*/
WifiChannelInMhz centerFreq;
/**
* Center frequency (MHz) first segment.
*/
WifiChannelInMhz centerFreq0;
/**
* Center frequency (MHz) second segment.
*/
WifiChannelInMhz centerFreq1;
/**
* Channel width (20, 40, 80, 80+80, 160, 320).
*/
WifiChannelWidthInMhz width;
/**
* Primary 20 MHz channel.
*/
WifiChannelInMhz centerFreq;
/**
* Center frequency (MHz) first segment.
*/
WifiChannelInMhz centerFreq0;
/**
* Center frequency (MHz) second segment.
*/
WifiChannelInMhz centerFreq1;
};
/**
@ -211,14 +226,16 @@ struct RttResponder {
};
struct WifiChannelStats {
/**
* Channel information.
*/
/**
* Channel information.
*/
WifiChannelInfo channel;
/**
* Total time for which the radio is awake on this channel.
*/
uint32_t onTimeInMs;
/**
* Total time for which CCA is held busy on this channel.
*/
@ -280,12 +297,14 @@ struct StaPeerInfo {
* Station count: The total number of stations currently associated with the peer.
*/
uint16_t staCount;
/**
* Channel utilization: The percentage of time (normalized to 255, i.e., x% corresponds to
* (int) x * 255 / 100) that the medium is sensed as busy measured by either physical or
* virtual carrier sense (CS) mechanism.
*/
uint16_t chanUtil;
/**
* Per rate statistics
*/
@ -386,23 +405,27 @@ struct WifiRateInfo {
* Per rate statistics. The rate is characterized by the combination of preamble, number of spatial
* streams, transmission bandwidth, and modulation and coding scheme (MCS).
*/
struct StaRateStat{
struct StaRateStat {
/**
* Wifi rate information: preamble, number of spatial streams, bandwidth, MCS, etc.
*/
WifiRateInfo rateInfo;
/**
* Number of successfully transmitted data packets (ACK received)
*/
uint32_t txMpdu;
/**
* Number of received data packets
*/
uint32_t rxMpdu;
/**
* Number of data packet losses (no ACK)
*/
uint32_t mpduLost;
/**
* Number of data packet retries
*/
@ -551,10 +574,12 @@ struct NanDataPathChannelInfo {
* Channel frequency in MHz.
*/
WifiChannelInMhz channelFreq;
/**
* Channel bandwidth in MHz.
*/
WifiChannelWidthInMhz channelBandwidth;
/**
* Number of spatial streams used in the channel.
*/
@ -571,6 +596,7 @@ struct NanDataPathConfirmInd {
* Baseline information as defined in HAL 1.0.
*/
@1.0::NanDataPathConfirmInd V1_0;
/**
* The channel(s) on which the NDP is scheduled to operate.
* Updates to the operational channels are provided using the |eventDataPathScheduleUpdate|
@ -591,10 +617,12 @@ struct NanDataPathScheduleUpdateInd {
* The discovery address (NMI) of the peer to which the NDP is connected.
*/
MacAddress peerDiscoveryAddress;
/**
* The updated channel(s) information.
*/
vec<NanDataPathChannelInfo> channelInfo;
/**
* The list of NDPs to which this update applies.
*/
@ -668,3 +696,569 @@ struct RttCapabilities {
*/
uint8_t mcVersion;
};
/**
* Cipher suite flags.
*/
enum NanCipherSuiteType : @1.0::NanCipherSuiteType {
/**
* NCS-PK-128
*/
PUBLIC_KEY_128_MASK = 1 << 2,
/**
* NCS-PK-256
*/
PUBLIC_KEY_256_MASK = 1 << 3,
};
/**
* NAN configuration request parameters added in the 1.2 HAL. These are supplemental to previous
* versions.
*/
struct NanConfigRequestSupplemental {
/**
* Baseline information as defined in HAL 1.5.
*/
@1.5::NanConfigRequestSupplemental V1_5;
/**
* Controls NAN instant communication mode operate on which channel
*/
uint32_t instantModeChannel;
};
/**
* Configuration of NAN data-path security.
*/
struct NanDataPathSecurityConfig {
/**
* Security configuration of the data-path (NDP). Security is enabled if not equal to
* |NanDataPathSecurityType.OPEN|.
* NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Security Required
*/
NanDataPathSecurityType securityType;
/**
* Cipher type for data-paths. If |securityType| is |NanDataPathSecurityType.OPEN| then must
* be set to |NanCipherSuiteType.NONE|, otherwise a non-|NanCipherSuiteType.NONE| cipher suite
* must be specified.
*/
NanCipherSuiteType cipherType;
/**
* Optional Pairwise Master Key (PMK). Must be specified (and is only used) if |securityType| is
* set to |NanDataPathSecurityType.PMK|.
* Ref: IEEE 802.11i
*/
uint8_t[32] pmk;
/**
* Optional Passphrase. Must be specified (and is only used) if |securityType| is set to
* |NanDataPathSecurityType.PASSPHRASE|.
* Min length: |MIN_PASSPHRASE_LENGTH|
* Max length: |MAX_PASSPHRASE_LENGTH|
* NAN Spec: Appendix: Mapping passphrase to PMK for NCS-SK Cipher Suites
*/
vec<uint8_t> passphrase;
/**
* Security Context Identifier attribute contains PMKID shall be included in NDP setup and
* response messages. Security Context Identifier, Identifies the Security Context. When
* security is enabled This field contains the 16 octet PMKID identifying the PMK used for
* setting up the Secure Data Path.
*/
uint8_t[16] scid;
};
/**
* Response to a data-path request from a peer.
*/
struct NanRespondToDataPathIndicationRequest {
/**
* Accept (true) or reject (false) the request.
* NAN Spec: Data Path Attributes / NDP Attribute / Type and Status
*/
bool acceptRequest;
/**
* ID of the data-path (NDP) for which we're responding - obtained as part of the request in
* |IWifiNanIfaceEventCallback.eventDataPathRequest|.
*/
uint32_t ndpInstanceId;
/**
* NAN data interface name on which this data-path session is to be started.
* This must be an interface created using |IWifiNanIface.createDataInterfaceRequest|.
*/
string ifaceName;
/**
* Security configuration of the requested data-path.
*/
NanDataPathSecurityConfig securityConfig;
/**
* Arbitrary information communicated to the peer as part of the data-path setup process - there
* is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is
* with no parsing.
* Max length: |NanCapabilities.maxAppInfoLen|.
* NAN Spec: Data Path Attributes / NDP Attribute / NDP Specific Info
*/
vec<uint8_t> appInfo;
/**
* A service name to be used with |passphrase| to construct a Pairwise Master Key (PMK) for the
* data-path. Only relevant when a data-path is requested which is not associated with a NAN
* discovery session - e.g. using out-of-band discovery.
* Constraints: same as |NanDiscoveryCommonConfig.serviceName|
* NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites
*/
vec<uint8_t> serviceNameOutOfBand;
};
/**
* Data Path Initiator requesting a data-path.
*/
struct NanInitiateDataPathRequest {
/**
* ID of the peer. Obtained as part of an earlier |IWifiNanIfaceEventCallback.eventMatch| or
* |IWifiNanIfaceEventCallback.eventFollowupReceived|.
*/
uint32_t peerId;
/**
* NAN management interface MAC address of the peer. Obtained as part of an earlier
* |IWifiNanIfaceEventCallback.eventMatch| or |IWifiNanIfaceEventCallback.eventFollowupReceived|.
*/
MacAddress peerDiscMacAddr;
/**
* Config flag for channel request.
*/
NanDataPathChannelCfg channelRequestType;
/**
* Channel frequency in MHz to start data-path. Not relevant if |channelRequestType| is
* |NanDataPathChannelCfg.CHANNEL_NOT_REQUESTED|.
*/
WifiChannelInMhz channel;
/**
* NAN data interface name on which this data-path session is to be initiated.
* This must be an interface created using |IWifiNanIface.createDataInterfaceRequest|.
*/
string ifaceName;
/**
* Security configuration of the requested data-path.
*/
NanDataPathSecurityConfig securityConfig;
/**
* Arbitrary information communicated to the peer as part of the data-path setup process - there
* is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is
* with no parsing.
* Max length: |NanCapabilities.maxAppInfoLen|.
* NAN Spec: Data Path Attributes / NDP Attribute / NDP Specific Info
*/
vec<uint8_t> appInfo;
/**
* A service name to be used with |passphrase| to construct a Pairwise Master Key (PMK) for the
* data-path. Only relevant when a data-path is requested which is not associated with a NAN
* discovery session - e.g. using out-of-band discovery.
* Constraints: same as |NanDiscoveryCommonConfig.serviceName|
* NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites
*/
vec<uint8_t> serviceNameOutOfBand;
};
/**
* Configurations of NAN discovery sessions: common to publish and subscribe discovery.
*/
struct NanDiscoveryCommonConfig {
/**
* The ID of the discovery session being configured. A value of 0 specifies a request to create
* a new discovery session. The new discovery session ID is returned with
* |IWifiNanIfaceEventCallback.notifyStartPublishResponse| or
* |IWifiNanIfaceEventCallback.notifyStartSubscribeResponse|.
* NAN Spec: Service Descriptor Attribute (SDA) / Instance ID
*/
uint8_t sessionId;
/**
* The lifetime of the discovery session in seconds. A value of 0 means run forever or until
* canceled using |IWifiIface.stopPublishRequest| or |IWifiIface.stopSubscribeRequest|.
*/
uint16_t ttlSec;
/**
* Indicates the interval between two Discovery Windows in which the device supporting the
* service is awake to transmit or receive the Service Discovery frames. Valid values of Awake
* DW Interval are: 1, 2, 4, 8 and 16. A value of 0 will default to 1. Does not override
* |NanBandSpecificConfig.discoveryWindowIntervalVal| configurations if those are specified.
*/
uint16_t discoveryWindowPeriod;
/**
* The lifetime of the discovery session in number of transmitted SDF discovery packets. A value
* of 0 means forever or until canceled using |IWifiIface.stopPublishRequest| or
* |IWifiIface.stopSubscribeRequest|.
*/
uint8_t discoveryCount;
/**
* UTF-8 encoded string identifying the service.
* Max length: |NanCapabilities.maxServiceNameLen|.
* NAN Spec: The only acceptable single-byte UTF-8 symbols for a Service Name are alphanumeric
* values (A-Z, a-z, 0-9), the hyphen ('-'), and the period ('.'). All valid multi-byte UTF-8
* characters are acceptable in a Service Name.
*/
vec<uint8_t> serviceName;
/**
* Specifies how often to trigger |IWifiNanIfaceEventCallback.eventMatch| when continuously
* discovering the same discovery session (with no changes).
*/
NanMatchAlg discoveryMatchIndicator;
/**
* Arbitrary information communicated in discovery packets - there is no semantic meaning to these
* bytes. They are passed-through from publisher to subscriber as-is with no parsing.
* Max length: |NanCapabilities.maxServiceSpecificInfoLen|.
* NAN Spec: Service Descriptor Attribute (SDA) / Service Info
*/
vec<uint8_t> serviceSpecificInfo;
/**
* Arbitrary information communicated in discovery packets - there is no semantic meaning to these
* bytes. They are passed-through from publisher to subscriber as-is with no parsing.
* Max length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|.
* Spec: Service Descriptor Extension Attribute (SDEA) / Service Info
*/
vec<uint8_t> extendedServiceSpecificInfo;
/**
* Ordered sequence of <length, value> pairs (|length| uses 1 byte and contains the number of
* bytes in the |value| field) which specify further match criteria (beyond the service name).
* The match behavior is specified in details in the NAN spec.
* Publisher: used in SOLICITED or SOLICITED_UNSOLICITED sessions.
* Subscriber: used in ACTIVE or PASSIVE sessions.
* Max length: |NanCapabilities.maxMatchFilterLen|.
* NAN Spec: matching_filter_rx
*/
vec<uint8_t> rxMatchFilter;
/**
* Ordered sequence of <length, value> pairs (|length| uses 1 byte and contains the number of
* bytes in the |value| field) which specify further match criteria (beyond the service name).
* The match behavior is specified in details in the NAN spec.
* Publisher: used if provided.
* Subscriber: used (if provided) only in ACTIVE sessions.
* Max length: |NanCapabilities.maxMatchFilterLen|.
* NAN Spec: matching_filter_tx and Service Descriptor Attribute (SDA) / Matching Filter
*/
vec<uint8_t> txMatchFilter;
/**
* Specifies whether or not the discovery session uses the
* |NanBandSpecificConfig.rssiCloseProximity| value (configured in enable/configure requests) to
* filter out matched discovered peers.
* NAN Spec: Service Descriptor Attribute / Service Control / Discovery Range Limited.
*/
bool useRssiThreshold;
/**
* Controls whether or not the |IWifiNanIfaceEventCallback.eventPublishTerminated| (for publish
* discovery sessions) or |IWifiNanIfaceEventCallback.eventSubscribeTerminated| (for subscribe
* discovery sessions) will be delivered.
*/
bool disableDiscoveryTerminationIndication;
/**
* Controls whether or not the |IWifiNanIfaceEventCallback.eventMatchExpired| will be delivered.
*/
bool disableMatchExpirationIndication;
/**
* Controls whether or not the |IWifiNanIfaceEventCallback.eventFollowupReceived| will be
* delivered.
*/
bool disableFollowupReceivedIndication;
/**
* Security configuration of data-paths created in the context of this discovery session. Security
* parameters can be overridden during the actual construction of the data-path - allowing
* individual data-paths to have unique PMKs or Passphrases.
*/
NanDataPathSecurityConfig securityConfig;
/**
* Specifies whether or not there is a ranging requirement in this discovery session.
* Ranging is only performed if all other match criteria with the peer are met. Ranging must
* be performed if both peers in the discovery session (publisher and subscriber) set this
* flag to true. Otherwise, if either peer sets this flag to false, ranging must not be performed
* and must not impact discovery decisions.
* Note: specifying that ranging is required also implies that this device must automatically
* accept ranging requests from peers.
* NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Ranging Require.
*/
bool rangingRequired;
/**
* Interval in msec between two ranging measurements. Only relevant if |rangingRequired| is true.
* If the Awake DW interval specified either in |discoveryWindowPeriod| or in
* |NanBandSpecificConfig.discoveryWindowIntervalVal| is larger than the ranging interval then
* priority is given to Awake DW interval.
*/
uint32_t rangingIntervalMsec;
/**
* The type of ranging feedback to be provided by discovery session matches
* |IWifiNanIfaceEventCallback.eventMatch|. Only relevant if |rangingRequired| is true.
*/
bitfield<NanRangingIndication> configRangingIndications;
/**
* The ingress and egress distance in cm. If ranging is enabled (|rangingEnabled| is true) then
* |configRangingIndications| is used to determine whether ingress and/or egress (or neither)
* are used to determine whether a match has occurred.
* NAN Spec: Service Discovery Extension Attribute (SDEA) / Ingress & Egress Range Limit
*/
uint16_t distanceIngressCm;
uint16_t distanceEgressCm;
};
/**
* Publish request: specifies a publish discovery operation.
*/
struct NanPublishRequest {
/**
* Common configuration of discovery sessions.
*/
NanDiscoveryCommonConfig baseConfigs;
/**
* The type of the publish discovery session.
*/
NanPublishType publishType;
/**
* For publishType of |NanPublishType.SOLICITED| or |NanPublishType.UNSOLICITED_SOLICITED|
* specifies the type of transmission used for responding to the probing subscribe discovery
* peer.
*/
NanTxType txType;
/**
* Specifies whether data-path requests |IWifiNanIfaceEventCallback.eventDataPathRequest| (in
* the context of this discovery session) are automatically accepted (if true) - in which case
* the Responder must not call the |IWifiNanIface.respondToDataPathIndicationRequest| method and
* the device must automatically accept the data-path request and complete the negotiation.
*/
bool autoAcceptDataPathRequests;
};
/**
* Match indication structure
*/
struct NanMatchInd {
/**
* Publish or subscribe discovery session ID of an existing discovery session.
* NAN Spec: Service Descriptor Attribute (SDA) / Instance ID
*/
uint8_t discoverySessionId;
/**
* A unique ID of the peer. Can be subsequently used in |IWifiNanIface.transmitFollowupRequest| or
* to set up a data-path.
*/
uint32_t peerId;
/**
* The NAN Discovery (management) MAC address of the peer.
*/
MacAddress addr;
/**
* The arbitrary information contained in the |NanDiscoveryCommonConfig.serviceSpecificInfo| of
* the peer's discovery session configuration.
* Max length: |NanCapabilities.maxServiceSpecificInfoLen|.
* NAN Spec: Service Descriptor Attribute (SDA) / Service Info
*/
vec<uint8_t> serviceSpecificInfo;
/**
* Arbitrary information communicated in discovery packets - there is no semantic meaning to these
* bytes. They are passed-through from publisher to subscriber as-is with no parsing.
* Max length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|.
* Spec: Service Descriptor Extension Attribute (SDEA) / Service Info
*/
vec<uint8_t> extendedServiceSpecificInfo;
/**
* The match filter from the discovery packet (publish or subscribe) which caused service
* discovery. Matches the |NanDiscoveryCommonConfig.txMatchFilter| of the peer's Unsolicited
* publish message or of the local device's Active subscribe message.
* Max length: |NanCapabilities.maxMatchFilterLen|.
* NAN Spec: Service Descriptor Attribute (SDA) / Matching Filter
*/
vec<uint8_t> matchFilter;
/**
* Indicates the type of discovery: true if match occurred on a Beacon frame, false if the match
* occurred on a Service Discovery Frames (SDF).
*/
bool matchOccuredInBeaconFlag;
/**
* Flag to indicate firmware is out of resource and that it can no longer track this Service Name.
* Indicates that while |IWifiNanIfaceEventCallback.eventMatch| will be received, the
* |NanDiscoveryCommonConfig.discoveryMatchIndicator| configuration will not be honored.
*/
bool outOfResourceFlag;
/**
* If RSSI filtering was enabled using |NanDiscoveryCommonConfig.useRssiThreshold| in discovery
* session setup then this field contains the received RSSI value. It will contain 0 if RSSI
* filtering was not enabled.
* RSSI values are returned without sign, e.g. -70dBm will be returned as 70.
*/
uint8_t rssiValue;
/**
* Cipher type for data-paths constructed in the context of this discovery session. Valid if
* |peerRequiresSecurityEnabledInNdp| is true.
*/
NanCipherSuiteType peerCipherType;
/**
* Indicates whether or not the peer requires security enabled in any data-path (NDP) constructed
* in the context of this discovery session. The |cipherType| specifies the cipher type for such
* data-paths.
* NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Security Required
*/
bool peerRequiresSecurityEnabledInNdp;
/**
* Indicates whether or not the peer requires (and hence allows) ranging in the context of this
* discovery session.
* Note that ranging is only performed if all other match criteria with the peer are met.
* NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Ranging Require.
*/
bool peerRequiresRanging;
/**
* Ranging indication supersedes the NanMatchAlg specification.
* Ex: If NanMatchAlg is MATCH_ONCE, but ranging indications is continuous then continuous
* match notifications will be received (with ranging information).
* Ranging indication data is provided if Ranging required is enabled in the discovery
* specification and:
* 1) continuous ranging specified.
* 2) ingress/egress specified and:
* - notify once for ingress >= ingress_distance and egress <= egress_distance,
* - same for ingress_egress_both
* If the Awake DW intervals are larger than the ranging intervals then priority is given to the
* device DW intervals.
*
* If ranging was required and executed contains the distance to the peer in MM. The
* |rangingIndicationType| field specifies the event which triggered ranging.
*/
uint32_t rangingMeasurementInMm;
/**
* The ranging event(s) which triggered the ranging. E.g. can indicate that continuous ranging was
* requested, or else that an ingress event occurred.
*/
bitfield<NanRangingIndication> rangingIndicationType;
/**
* Security Context Identifier attribute contains PMKID shall be included in NDP setup and
* response messages. Security Context Identifier, Identifies the Security Context. For NAN
* Shared Key Cipher Suite, this field contains the 16 octet PMKID identifying the PMK used for
* setting up the Secure Data Path.
*/
vec<uint8_t> scid;
};
/**
* NDP Capabilities response.
*/
struct NanCapabilities {
/**
* Maximum number of clusters which the device can join concurrently.
*/
uint32_t maxConcurrentClusters;
/**
* Maximum number of concurrent publish discovery sessions.
*/
uint32_t maxPublishes;
/**
* Maximum number of concurrent subscribe discovery sessions.
*/
uint32_t maxSubscribes;
/**
* Maximum length (in bytes) of service name.
*/
uint32_t maxServiceNameLen;
/**
* Maximum length (in bytes) of individual match filters.
*/
uint32_t maxMatchFilterLen;
/**
* Maximum length (in bytes) of aggregate match filters across all active sessions.
*/
uint32_t maxTotalMatchFilterLen;
/**
* Maximum length (in bytes) of the service specific info field.
*/
uint32_t maxServiceSpecificInfoLen;
/**
* Maximum length (in bytes) of the extended service specific info field.
*/
uint32_t maxExtendedServiceSpecificInfoLen;
/**
* Maximum number of data interfaces (NDI) which can be created concurrently on the device.
*/
uint32_t maxNdiInterfaces;
/**
* Maximum number of data paths (NDP) which can be created concurrently on the device, across all
* data interfaces (NDI).
*/
uint32_t maxNdpSessions;
/**
* Maximum length (in bytes) of application info field (used in data-path negotiations).
*/
uint32_t maxAppInfoLen;
/**
* Maximum number of transmitted followup messages which can be queued by the firmware.
*/
uint32_t maxQueuedTransmitFollowupMsgs;
/**
* Maximum number MAC interface addresses which can be specified to a subscribe discovery session.
*/
uint32_t maxSubscribeInterfaceAddresses;
/**
* The set of supported Cipher suites. The |NanCipherSuiteType| bit fields are used.
*/
bitfield<NanCipherSuiteType> supportedCipherSuites;
/**
* Flag to indicate id instant communication mode is supported.
*/
bool instantCommunicationModeSupportFlag;
};