本文整理汇总了C++中wpa_supplicant_req_scan函数的典型用法代码示例。如果您正苦于以下问题:C++ wpa_supplicant_req_scan函数的具体用法?C++ wpa_supplicant_req_scan怎么用?C++ wpa_supplicant_req_scan使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpa_supplicant_req_scan函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wpa_supplicant_ctrl_iface_enable_network
static int wpa_supplicant_ctrl_iface_enable_network(
struct wpa_supplicant *wpa_s, char *cmd)
{
int id;
struct wpa_ssid *ssid;
/* cmd: "<network id>" */
id = atoi(cmd);
wpa_printf(MSG_DEBUG, "CTRL_IFACE: ENABLE_NETWORK id=%d", id);
ssid = wpa_config_get_network(wpa_s->conf, id);
if (ssid == NULL) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find network "
"id=%d", id);
return -1;
}
if (wpa_s->current_ssid == NULL && ssid->disabled) {
/*
* Try to reassociate since there is no current configuration
* and a new network was made available. */
wpa_s->reassociate = 1;
#ifdef ANDROID
wpa_supplicant_req_scan(wpa_s, 2, 0);
#else
wpa_supplicant_req_scan(wpa_s, 0, 0);
#endif
}
ssid->disabled = 0;
return 0;
}
示例2: request_scan
static void request_scan(struct wpa_supplicant *wpa_s)
{
wpa_s->scan_req = 2;
if (wpa_supplicant_req_sched_scan(wpa_s))
wpa_supplicant_req_scan(wpa_s, wpa_s->scan_interval, 0);
}
示例3: hs20_start_osu_scan
void hs20_start_osu_scan(struct wpa_supplicant *wpa_s)
{
wpa_s->num_osu_scans++;
wpa_s->scan_req = MANUAL_SCAN_REQ;
wpa_s->scan_res_handler = hs20_osu_scan_res_handler;
wpa_supplicant_req_scan(wpa_s, 0, 0);
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_hardware_intel_wlan_hostap_wcs,代码行数:7,代码来源:hs20_supplicant.c
示例4: wpa_supplicant_ctrl_iface_select_network
static int wpa_supplicant_ctrl_iface_select_network(
struct wpa_supplicant *wpa_s, char *cmd)
{
int id;
struct wpa_ssid *ssid;
/* cmd: "<network id>" or "any" */
if (os_strcmp(cmd, "any") == 0) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: SELECT_NETWORK any");
ssid = wpa_s->conf->ssid;
while (ssid) {
ssid->disabled = 0;
ssid = ssid->next;
}
wpa_s->reassociate = 1;
wpa_supplicant_req_scan(wpa_s, 0, 0);
return 0;
}
id = atoi(cmd);
wpa_printf(MSG_DEBUG, "CTRL_IFACE: SELECT_NETWORK id=%d", id);
ssid = wpa_config_get_network(wpa_s->conf, id);
if (ssid == NULL) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find network "
"id=%d", id);
return -1;
}
if (ssid != wpa_s->current_ssid && wpa_s->current_ssid)
wpa_supplicant_disassociate(wpa_s, REASON_DEAUTH_LEAVING);
/* Mark all other networks disabled and trigger reassociation */
ssid = wpa_s->conf->ssid;
while (ssid) {
ssid->disabled = id != ssid->id;
ssid = ssid->next;
}
wpa_s->reassociate = 1;
wpa_s->prev_scan_ssid = BROADCAST_SSID_SCAN;
wpa_supplicant_req_scan(wpa_s, 0, 0);
return 0;
}
示例5: wpa_supplicant_assoc_try
static void wpa_supplicant_assoc_try(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid)
{
while (ssid) {
if (!ssid->disabled)
break;
ssid = ssid->next;
}
/* ap_scan=2 mode - try to associate with each SSID. */
if (ssid == NULL) {
wpa_dbg(wpa_s, MSG_DEBUG, "wpa_supplicant_assoc_try: Reached "
"end of scan list - go back to beginning");
wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
wpa_supplicant_req_scan(wpa_s, 0, 0);
return;
}
if (ssid->next) {
/* Continue from the next SSID on the next attempt. */
wpa_s->prev_scan_ssid = ssid;
} else {
/* Start from the beginning of the SSID list. */
wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
}
wpa_supplicant_associate(wpa_s, NULL, ssid);
}
示例6: wpa_supplicant_event_disassoc
static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s)
{
const u8 *bssid;
if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
/*
* At least Host AP driver and a Prism3 card seemed to be
* generating streams of disconnected events when configuring
* IBSS for WPA-None. Ignore them for now.
*/
wpa_printf(MSG_DEBUG, "Disconnect event - ignore in "
"IBSS/WPA-None mode");
return;
}
if (wpa_s->wpa_state == WPA_4WAY_HANDSHAKE &&
wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - "
"pre-shared key may be incorrect");
}
if (wpa_s->wpa_state >= WPA_ASSOCIATED)
wpa_supplicant_req_scan(wpa_s, 0, 100000);
bssid = wpa_s->bssid;
if (is_zero_ether_addr(bssid))
bssid = wpa_s->pending_bssid;
wpa_blacklist_add(wpa_s, bssid);
wpa_sm_notify_disassoc(wpa_s->wpa);
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "- Disconnect event - "
"remove keys");
if (wpa_supplicant_dynamic_keys(wpa_s)) {
wpa_s->keys_cleared = 0;
wpa_clear_keys(wpa_s, wpa_s->bssid);
}
wpa_supplicant_mark_disassoc(wpa_s);
}
示例7: wpas_dbus_iface_scan
/**
* wpas_dbus_iface_scan - Request a wireless scan on an interface
* @message: Pointer to incoming dbus message
* @wpa_s: wpa_supplicant structure for a network interface
* Returns: a dbus message containing a UINT32 indicating success (1) or
* failure (0)
*
* Handler function for "scan" method call of a network device. Requests
* that wpa_supplicant perform a wireless scan as soon as possible
* on a particular wireless interface.
*/
DBusMessage * wpas_dbus_iface_scan(DBusMessage *message,
struct wpa_supplicant *wpa_s)
{
wpa_s->scan_req = 2;
wpa_supplicant_req_scan(wpa_s, 0, 0);
return wpas_dbus_new_success_reply(message);
}
示例8: wpa_supplicant_event_disassoc
static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
u16 reason_code)
{
const u8 *bssid;
int authenticating;
u8 prev_pending_bssid[ETH_ALEN];
authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING;
os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN);
if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
/*
* At least Host AP driver and a Prism3 card seemed to be
* generating streams of disconnected events when configuring
* IBSS for WPA-None. Ignore them for now.
*/
wpa_printf(MSG_DEBUG, "Disconnect event - ignore in "
"IBSS/WPA-None mode");
return;
}
if (wpa_s->wpa_state == WPA_4WAY_HANDSHAKE &&
wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - "
"pre-shared key may be incorrect");
}
if (wpa_s->wpa_state >= WPA_ASSOCIATED)
wpa_supplicant_req_scan(wpa_s, 0, 100000);
bssid = wpa_s->bssid;
if (is_zero_ether_addr(bssid))
bssid = wpa_s->pending_bssid;
wpas_connection_failed(wpa_s, bssid);
wpa_sm_notify_disassoc(wpa_s->wpa);
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" MACSTR
" reason=%d",
MAC2STR(bssid), reason_code);
if (wpa_supplicant_dynamic_keys(wpa_s)) {
wpa_printf(MSG_DEBUG, "Disconnect event - remove keys");
wpa_s->keys_cleared = 0;
wpa_clear_keys(wpa_s, wpa_s->bssid);
}
if (wpa_s->wpa_state == WPA_DISCONNECTED) {
wpa_s->disconnect_count++;
if (!eloop_is_timeout_registered(wpa_disconnect_spam_handle, wpa_s, NULL)) {
eloop_register_timeout(6, 0, wpa_disconnect_spam_handle, wpa_s, NULL);
wpa_printf(MSG_DEBUG, "%s: scheduled DISCONNECT spam handler", __FUNCTION__);
}
}
wpa_supplicant_mark_disassoc(wpa_s);
bgscan_deinit(wpa_s);
wpa_s->bgscan_ssid = NULL;
if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME))
sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid);
}
示例9: wpa_supplicant_event_disassoc
static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
u16 reason_code)
{
const u8 *bssid;
#ifdef CONFIG_SME
int authenticating;
u8 prev_pending_bssid[ETH_ALEN];
authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING;
os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN);
#endif /* CONFIG_SME */
if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
/*
* At least Host AP driver and a Prism3 card seemed to be
* generating streams of disconnected events when configuring
* IBSS for WPA-None. Ignore them for now.
*/
wpa_printf(MSG_DEBUG, "Disconnect event - ignore in "
"IBSS/WPA-None mode");
return;
}
if (wpa_s->wpa_state == WPA_4WAY_HANDSHAKE &&
wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - "
"pre-shared key may be incorrect");
}
if (!wpa_s->auto_reconnect_disabled ||
wpa_s->key_mgmt == WPA_KEY_MGMT_WPS) {
wpa_printf(MSG_DEBUG, "WPA: Auto connect enabled: try to "
"reconnect (wps=%d)",
wpa_s->key_mgmt == WPA_KEY_MGMT_WPS);
if (wpa_s->wpa_state >= WPA_ASSOCIATING)
wpa_supplicant_req_scan(wpa_s, 0, 100000);
} else {
wpa_printf(MSG_DEBUG, "WPA: Auto connect disabled: do not try "
"to re-connect");
wpa_s->reassociate = 0;
wpa_s->disconnected = 1;
}
bssid = wpa_s->bssid;
if (is_zero_ether_addr(bssid))
bssid = wpa_s->pending_bssid;
wpa_blacklist_add(wpa_s, bssid);
wpa_sm_notify_disassoc(wpa_s->wpa);
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_DISCONNECTED "bssid=" MACSTR
" reason=%d",
MAC2STR(bssid), reason_code);
if (wpa_supplicant_dynamic_keys(wpa_s)) {
wpa_printf(MSG_DEBUG, "Disconnect event - remove keys");
wpa_s->keys_cleared = 0;
wpa_clear_keys(wpa_s, wpa_s->bssid);
}
wpa_supplicant_mark_disassoc(wpa_s);
}
示例10: wpa_supplicant_ctrl_iface_enable_network
static int wpa_supplicant_ctrl_iface_enable_network(
struct wpa_supplicant *wpa_s, char *cmd)
{
int id;
struct wpa_ssid *ssid;
/* cmd: "<network id>" or "all" */
if (os_strcmp(cmd, "all") == 0) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: ENABLE_NETWORK all");
ssid = wpa_s->conf->ssid;
while (ssid) {
if (ssid == wpa_s->current_ssid && ssid->disabled)
wpa_s->reassociate = 1;
ssid->disabled = 0;
ssid = ssid->next;
}
if (wpa_s->reassociate)
wpa_supplicant_req_scan(wpa_s, 0, 0);
return 0;
}
id = atoi(cmd);
wpa_printf(MSG_DEBUG, "CTRL_IFACE: ENABLE_NETWORK id=%d", id);
ssid = wpa_config_get_network(wpa_s->conf, id);
if (ssid == NULL) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find network "
"id=%d", id);
return -1;
}
if (wpa_s->current_ssid == NULL && ssid->disabled) {
/*
* Try to reassociate since there is no current configuration
* and a new network was made available. */
wpa_s->reassociate = 1;
wpa_supplicant_req_scan(wpa_s, 0, 0);
}
ssid->disabled = 0;
return 0;
}
示例11: wpa_supplicant_timeout
/* ARGSUSED */
static void
wpa_supplicant_timeout(void *eloop_ctx, void *timeout_ctx)
{
struct wpa_supplicant *wpa_s = eloop_ctx;
wpa_printf(MSG_INFO, "Authentication with " MACSTR " timed out.",
MAC2STR(wpa_s->bssid));
wpa_s->reassociate = 1;
wpa_supplicant_req_scan(wpa_s, 0, 0);
}
示例12: wpa_supplicant_stop_countermeasures
static void wpa_supplicant_stop_countermeasures(void *eloop_ctx,
void *sock_ctx)
{
struct wpa_supplicant *wpa_s = eloop_ctx;
if (wpa_s->countermeasures) {
wpa_s->countermeasures = 0;
wpa_drv_set_countermeasures(wpa_s, 0);
wpa_msg(wpa_s, MSG_INFO, "WPA: TKIP countermeasures stopped");
wpa_supplicant_req_scan(wpa_s, 0, 0);
}
}
示例13: interworking_select
int interworking_select(struct wpa_supplicant *wpa_s, int auto_select)
{
interworking_stop_fetch_anqp(wpa_s);
wpa_s->network_select = 1;
wpa_s->auto_select = !!auto_select;
wpa_printf(MSG_DEBUG, "Interworking: Start scan for network "
"selection");
wpa_s->scan_res_handler = interworking_scan_res_handler;
wpa_s->scan_req = 2;
wpa_supplicant_req_scan(wpa_s, 0, 0);
return 0;
}
示例14: wpa_supplicant_req_new_scan
static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,
int timeout_sec, int timeout_usec)
{
if (!wpa_supplicant_enabled_networks(wpa_s->conf)) {
/*
* No networks are enabled; short-circuit request so
* we don't wait timeout seconds before transitioning
* to INACTIVE state.
*/
wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
return;
}
wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec);
}
示例15: wpa_event_handler
/*
* wpa_event_handler - report a driver event for wpa_supplicant
* @wpa_s: pointer to wpa_supplicant data; this is the @ctx variable registered
* with wpa_driver_events_init()
* @event: event type (defined above)
*
* Driver wrapper code should call this function whenever an event is received
* from the driver.
*/
void
wpa_event_handler(void *cookie, wpa_event_type event)
{
struct wpa_supplicant *wpa_s = cookie;
uint8_t bssid[IEEE80211_ADDR_LEN];
switch (event) {
case EVENT_ASSOC:
wpa_s->wpa_state = WPA_ASSOCIATED;
wpa_printf(MSG_DEBUG, "\nAssociation event - clear replay "
"counter\n");
(void) memset(wpa_s->rx_replay_counter, 0,
WPA_REPLAY_COUNTER_LEN);
wpa_s->rx_replay_counter_set = 0;
wpa_s->renew_snonce = 1;
if (wpa_s->driver->get_bssid(wpa_s->linkid,
(char *)bssid) >= 0 &&
memcmp(bssid, wpa_s->bssid, IEEE80211_ADDR_LEN) != 0) {
wpa_printf(MSG_DEBUG, "Associated to a new BSS: "
"BSSID=" MACSTR, MAC2STR(bssid));
(void) memcpy(wpa_s->bssid, bssid, IEEE80211_ADDR_LEN);
if (wpa_s->key_mgmt != WPA_KEY_MGMT_NONE)
wpa_clear_keys(wpa_s, bssid);
}
wpa_s->eapol_received = 0;
if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE) {
wpa_supplicant_cancel_auth_timeout(wpa_s);
} else {
/* Timeout for receiving the first EAPOL packet */
wpa_supplicant_req_auth_timeout(wpa_s, 10, 0);
}
break;
case EVENT_DISASSOC:
if (wpa_s->wpa_state >= WPA_ASSOCIATED)
wpa_supplicant_req_scan(wpa_s, 0, 100000);
wpa_supplicant_mark_disassoc(wpa_s);
wpa_printf(MSG_DEBUG, "Disconnect event - remove keys");
if (wpa_s->key_mgmt != WPA_KEY_MGMT_NONE)
wpa_clear_keys(wpa_s, wpa_s->bssid);
break;
case EVENT_SCAN_RESULTS:
wpa_supplicant_scan_results(wpa_s);
break;
default:
wpa_printf(MSG_INFO, "Unknown event %d", event);
break;
}
}