#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
#include <errno.h>
#include <net/if.h>
#include <net/ethernet.h>
#include <linux/socket.h>
#include <sys/ioctl.h>
#include <osso-ic-dbus.h>
#include <syslog.h>
#include <dbus/dbus.h>
#include <eap-dbus.h>
#include <wlancond-dbus.h>
#include <mce/mode-names.h>
#include "log.h"
#include "dbus.h"
#include "dbus-helper.h"
#include "dbus-handler.h"
#include "common.h"
#include "wpa.h"
#include "wps.h"
#include "wapi.h"
Go to the source code of this file.
Data Structures | |
struct | method_handler_t |
Defines | |
#define | DBUS_API_SUBJECT_TO_CHANGE |
#define | WLANCOND_SHUTDOWN_DELAY 12 |
#define | WLANCOND_CONNECT_TIMEOUT 14 |
#define | WLANCOND_SCAN_TIMEOUT 8 |
#define | WLANCOND_RESCAN_DELAY 1 |
#define | WLANCOND_GPRS_TIMEOUT 2 |
#define | CALIBRATION_APPLICATION "/usr/bin/wl1271-cal" |
#define | WLAN_PREFIX_STR "wlan" |
#define | KILL_SUPPLICANT "/usr/bin/killall" |
#define | SUPPLICANT_NAME "eapd.real" |
#define | MAX_SCAN_COUNT 3 |
Typedefs | |
typedef DBusHandlerResult(* | handler_func )(DBusMessage *message, DBusConnection *connection) |
Functions | |
void | wlancond_print (guint priority, const char *debug,...) |
int | socket_open (void) |
static int | get_own_mac (void) |
static gint | get_setting_int (const gchar *path) |
gboolean | get_setting_bool (const gchar *path, gboolean *error) |
void | init_logging (void) |
void | update_own_ie (unsigned char *wpa_ie, guint wpa_ie_len) |
guint | get_encryption_info (void) |
int | clean_dbus_handler (void) |
void | mode_change (dbus_uint32_t radio_mode) |
static DBusHandlerResult | icd_check_signal_dbus (DBusMessage *message) |
static DBusHandlerResult | eap_check_signal_dbus (DBusMessage *message) |
gint | run_calibration (void) |
void | kill_supplicant (void) |
static void | remove_wlan_gprs_timer (void) |
static gboolean | wlan_gprs_cb (void *data) |
static DBusHandlerResult | gprs_datacounters_signal (DBusMessage *message) |
static DBusHandlerResult | csd_check_signal_dbus (DBusMessage *message) |
static gboolean | check_country_timeout (void) |
static gint | handle_country (void) |
int | init_dbus_handler (void) |
static gboolean | in_flight_mode (void) |
void | set_wlan_signal (gboolean high_or_low) |
void | remove_roam_scan_timer (void) |
void | remove_connect_timer (void) |
static void | remove_wlan_if_timer (void) |
void | remove_scan_timer (void) |
static void | remove_rescan_timer (void) |
gboolean | scan_retries_left (void) |
static gboolean | no_connection_and_scan_retries_left (void) |
static gboolean | wlan_connect_timer_cb (void *data) |
static gboolean | wlan_scan_cb (void *data) |
static gboolean | wlan_if_down_cb (void *data) |
int | mlme_command (guchar *addr, guint16 cmd, guint16 reason_code) |
static int | set_mode (guint32 mode) |
static void | remove_timers (void) |
static void | remove_connection_time_filters (void) |
void | set_wlan_state (int new_state, int send_signal, gboolean delay_shutdown) |
guint | get_wlan_state (void) |
void | set_scan_state (guint new_state) |
guint | get_scan_state (void) |
guint | get_mode (void) |
static void | set_network_latency (int latency) |
gboolean | can_adjust_psm (void) |
static gint | compare_scan_entry (gconstpointer a, gconstpointer b) |
static gboolean | is_uapsd_supported (unsigned char *mac) |
gboolean | set_power_state (guint new_state) |
static int | init_if (int sock) |
void | save_device_interface (void) |
int | set_interface_state (int sock, int dir, short flags) |
gboolean | set_tx_power (guint power) |
static int | update_algorithms (guint32 encryption, struct scan_results_t *scan_results) |
void | clean_roam_cache (void) |
void | clear_wpa_mode (void) |
gboolean | get_wpa_mode (void) |
static gint | compare_pmk_entry (gconstpointer a, gconstpointer b) |
static void | add_to_pmksa_cache (unsigned char *pmkid, unsigned char *mac) |
gboolean | remove_from_pmksa_cache (unsigned char *mac) |
int | find_pmkid_from_pmk_cache (unsigned char *mac, unsigned char **pmkid) |
static void | rescan_destroy_cb (gpointer data) |
static gboolean | rescan (void *data) |
int | scan (gchar *ssid, int ssid_len, gboolean add_timer) |
static void | init_conn_params (struct connect_params_t *conn_params) |
static void | add_connection_time_filters (void) |
static int | check_connect_arguments (struct connect_params_t *conn, char *ssid, unsigned char **key) |
static DBusHandlerResult | settings_and_connect_request (DBusMessage *message, DBusConnection *connection) |
int | associate (struct scan_results_t *scan_results) |
static DBusHandlerResult | scan_request (DBusMessage *message, DBusConnection *connection) |
static int | network_compare (gconstpointer a, gconstpointer b) |
static void | add_to_roam_cache (struct scan_results_t *scan_results) |
struct scan_results_t * | copy_scan_results (struct scan_results_t *results) |
gboolean | remove_from_roam_cache (roam_cache_key_t *const key) |
gboolean | decrease_signal_in_roam_cache (roam_cache_key_t *const key) |
static int | check_group_cipher (guint32 c1, guint32 c2) |
static int | check_ciphers (guint32 c1, guint32 c2) |
static gboolean | wlan_roam_scan_cb (void *data) |
void | schedule_scan (guint seconds) |
static void | reschedule_scan (void) |
static gboolean | check_capabilities (struct scan_results_t *scan_results, struct connect_params_t *conn) |
static gboolean | better_than_current_best (struct scan_results_t *current_best, struct scan_results_t *candidate) |
struct scan_results_t * | find_connection (GSList *ap_list, struct connect_params_t *conn, gboolean update_roam_cache) |
static dbus_uint32_t | find_adhoc_channel (GSList *ap_list) |
static gboolean | check_if_duplicate_entry (GSList *scan_results, GSList *entry) |
int | find_connection_and_associate (GSList *scan_results, gboolean update_roam_cache, gboolean create_new_adhoc, gboolean autoconnect) |
static void | registrar_error_signal (void) |
static void | connect_from_scan_results (GSList *scan_results) |
gboolean | ask_scan_results (void) |
void | nl80211_scan_ready (void) |
static DBusHandlerResult | disconnect_request (DBusMessage *message, DBusConnection *connection) |
static DBusHandlerResult | disassociate_request (DBusMessage *message, DBusConnection *connection) |
static DBusHandlerResult | status_request (DBusMessage *message, DBusConnection *connection) |
static DBusHandlerResult | interface_request (DBusMessage *message, DBusConnection *connection) |
static DBusHandlerResult | connection_status_request (DBusMessage *message, DBusConnection *connection) |
static DBusHandlerResult | set_pmksa_request (DBusMessage *message, DBusConnection *connection) |
static DBusHandlerResult | set_powersave_request (DBusMessage *message, DBusConnection *connection) |
int | wpa_ie_push (char *ap_mac_addr) |
int | wpa_mic_failure_event (dbus_bool_t key_type, dbus_bool_t is_fatal) |
static void | disassociate_cb (DBusPendingCall *pending, void *user_data) |
int | disassociate_eap (void) |
int | check_pmksa_cache (unsigned char *own_mac, int own_mac_len, unsigned char *bssid, int bssid_len, uint32_t authentication_type, uint32_t pairwise_key_cipher_suite, uint32_t group_key_cipher_suite, int *status) |
static void | write_file (const char *file, guint value) |
static void | set_scan_params (guint scan_mode) |
void | set_call_type (const char *type) |
int | context_parser (DBusMessageIter *actit) |
static DBusHandlerResult | handle_policy_actions (DBusMessage *msg) |
DBusHandlerResult | wlancond_req_handler (DBusConnection *connection, DBusMessage *message, void *user_data) |
void | init_dbus_handlers (DBusConnection *connection) |
void | destroy_dbus_handlers (DBusConnection *connection) |
Variables | |
static char * | scan_name_cache = NULL |
static char * | connect_name_cache = NULL |
static int | wlan_socket = -1 |
struct wlan_status_t | wlan_status |
static gboolean | _flight_mode = FALSE |
static gboolean | power_down_after_scan = FALSE |
static dbus_bool_t | saved_inactivity = FALSE |
static guint | wlan_if_down_timer_id = 0 |
static guint | wlan_connect_timer_id = 0 |
static guint | wlan_gprs_timer_id = 0 |
gint | debug_level = 0 |
static method_handler_t | handlers [] |
static DBusObjectPathVTable | wlancond_req_vtable |
Copyright (C) 2004-2010 Nokia Corporation. All rights reserved.
Portions of this file are Copyright (c) 1997-2002 Jean Tourrilhes <jt@hpl.hp.com>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Definition in file dbus-handler.c.
#define KILL_SUPPLICANT "/usr/bin/killall" |
Kill supplicant.
Definition at line 487 of file dbus-handler.c.
#define MAX_SCAN_COUNT 3 |
Helper function for rescanning from a timer.
data | Optional scanning data. |
Definition at line 1653 of file dbus-handler.c.
static void add_to_pmksa_cache | ( | unsigned char * | pmkid, | |
unsigned char * | mac | |||
) | [static] |
Add PMKID to PMKSA cache.
pmkid | PMKID to add. | |
mac | MAC address associated to PMKID. |
Definition at line 1531 of file dbus-handler.c.
References wlan_status.
Referenced by set_pmksa_request().
static void add_to_roam_cache | ( | struct scan_results_t * | scan_results | ) | [static] |
Add scan results to roam cache.
scan_results | Scan results to add. |
Definition at line 2306 of file dbus-handler.c.
References copy_scan_results(), and wlan_status.
Referenced by find_connection().
gboolean ask_scan_results | ( | void | ) |
Scan results request.
ifindex | Interface index. |
Definition at line 2862 of file dbus-handler.c.
References clean_roam_cache(), clean_scan_results(), connect_from_scan_results(), get_scan_state(), get_wlan_state(), network_compare(), nl80211_send_get_scan_results(), scan_name_cache, send_dbus_scan_results(), set_interface_state(), set_scan_state(), set_wlan_state(), socket_open(), and wlan_status.
Referenced by nl80211_scan_ready().
int associate | ( | struct scan_results_t * | scan_results | ) |
Associate function to associate to selected access point.
scan_results | Scan results. |
Definition at line 2067 of file dbus-handler.c.
References disassociate_eap(), generate_wapi_ie(), get_wlan_state(), get_wpa_mode(), mlme_command(), netlink_send_linkmode(), nl80211_connect(), set_wlan_state(), update_algorithms(), wlan_connect_timer_cb(), and wlan_status.
Referenced by find_connection_and_associate().
static gboolean better_than_current_best | ( | struct scan_results_t * | current_best, | |
struct scan_results_t * | candidate | |||
) | [static] |
Compare current best AP to the candidate AP.
current_best | Scan results for the current best AP. | |
candidate | Scan results for the candidate AP. |
Definition at line 2547 of file dbus-handler.c.
Referenced by find_connection().
static gboolean check_capabilities | ( | struct scan_results_t * | scan_results, | |
struct connect_params_t * | conn | |||
) | [static] |
Check capabilities from scan results.
scan_results | Scan results. | |
conn | Connection paramters. |
Definition at line 2522 of file dbus-handler.c.
References check_ciphers().
Referenced by find_connection().
static int check_ciphers | ( | guint32 | c1, | |
guint32 | c2 | |||
) | [static] |
Compare ciphers.
c1 | Cipher 1. | |
c2 | Cipher 2. |
Definition at line 2433 of file dbus-handler.c.
References check_group_cipher().
Referenced by check_capabilities().
static int check_connect_arguments | ( | struct connect_params_t * | conn, | |
char * | ssid, | |||
unsigned char ** | key | |||
) | [static] |
Helper function for checking settings_and_connect DBUS parameters.
conn | Connection parameters. | |
ssid | SSID. | |
key | Encryption keys. |
Definition at line 1774 of file dbus-handler.c.
References wlan_status.
Referenced by settings_and_connect_request().
static gboolean check_country_timeout | ( | void | ) | [static] |
Check if previous country code can be used.
Definition at line 612 of file dbus-handler.c.
References wlan_status.
Referenced by handle_country().
static int check_group_cipher | ( | guint32 | c1, | |
guint32 | c2 | |||
) | [static] |
Compare group ciphers.
c1 | Cipher 1. | |
c2 | Cipher 2. |
Definition at line 2408 of file dbus-handler.c.
Referenced by check_ciphers().
static gboolean check_if_duplicate_entry | ( | GSList * | scan_results, | |
GSList * | entry | |||
) | [static] |
Check if the selected scan result is from the same AP as one of the previous results.
scan_results | List of scanned APs. | |
entry | AP scan result list entry. |
Definition at line 2696 of file dbus-handler.c.
Referenced by find_connection_and_associate().
int check_pmksa_cache | ( | unsigned char * | own_mac, | |
int | own_mac_len, | |||
unsigned char * | bssid, | |||
int | bssid_len, | |||
uint32_t | authentication_type, | |||
uint32_t | pairwise_key_cipher_suite, | |||
uint32_t | group_key_cipher_suite, | |||
int * | status | |||
) |
Checks the PMKSA cache status from the EAP daemon.
own_mac | Our own mac address. | |
own_mac_len | The length of the address(usually ETH_ALEN) | |
bssid | The mac address of the access point. | |
bssid_len | The length of the address(usually ETH_ALEN) | |
authentication_type | The authentication type used. | |
pairwise_key_cipher_suite | The cipher suite to be used | |
group_key_cipher_suite | The cipher suite to be used | |
status | TRUE if the key exists in the cache. On errors this value won't be set. |
Definition at line 3481 of file dbus-handler.c.
Referenced by find_pmkid_from_pmk_cache().
int clean_dbus_handler | ( | void | ) |
Helper function for cleaning handler.
Definition at line 275 of file dbus-handler.c.
References wlan_socket.
Referenced by handle_message().
void clean_roam_cache | ( | void | ) |
Clean roaming cache.
Definition at line 1482 of file dbus-handler.c.
References clean_scan_results(), and wlan_status.
Referenced by ask_scan_results(), find_connection(), and set_wlan_state().
void clear_wpa_mode | ( | void | ) |
Clear WPA mode related stuff.
Definition at line 1490 of file dbus-handler.c.
References update_own_ie(), and wlan_status.
Referenced by set_wlan_state().
static void connect_from_scan_results | ( | GSList * | scan_results | ) | [static] |
Connects based on scan results.
scan_results | List of scan results. |
Definition at line 2816 of file dbus-handler.c.
References clean_scan_results(), find_connection_and_associate(), get_wlan_state(), no_connection_and_scan_retries_left(), registrar_error_signal(), reschedule_scan(), set_wlan_state(), and wlan_status.
Referenced by ask_scan_results().
static DBusHandlerResult connection_status_request | ( | DBusMessage * | message, | |
DBusConnection * | connection | |||
) | [static] |
Connection status D_BUS request.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 3132 of file dbus-handler.c.
References get_wlan_state().
int context_parser | ( | DBusMessageIter * | actit | ) |
Parses the context from the policy actions method params. This sets the call type according to the call_audio_type variable.
actit | Dbus message iterator to the context. |
Definition at line 3651 of file dbus-handler.c.
References set_call_type().
Referenced by handle_policy_actions().
struct scan_results_t* copy_scan_results | ( | struct scan_results_t * | results | ) | [read] |
Make a copy of scan results.
results | Scan results to copy. |
Definition at line 2340 of file dbus-handler.c.
Referenced by add_to_roam_cache().
static DBusHandlerResult csd_check_signal_dbus | ( | DBusMessage * | message | ) | [static] |
Check CSD DBUS signal.
message | DBUS message. |
Definition at line 545 of file dbus-handler.c.
References wlan_status.
Referenced by wlancond_req_handler().
gboolean decrease_signal_in_roam_cache | ( | roam_cache_key_t *const | key | ) |
Give penalty to failed AP.
bssid | BSSID. |
Definition at line 2383 of file dbus-handler.c.
References wlan_status.
Referenced by handle_netlink_wap_event().
void destroy_dbus_handlers | ( | DBusConnection * | connection | ) |
Destroy D-BUS handlers.
connection | DBUS connection. |
Definition at line 3915 of file dbus-handler.c.
Referenced by main().
static void disassociate_cb | ( | DBusPendingCall * | pending, | |
void * | user_data | |||
) | [static] |
Disassociate callback.
pending | Pending DBUS message. | |
user_data | Callback data. |
Definition at line 3412 of file dbus-handler.c.
Referenced by disassociate_eap().
int disassociate_eap | ( | void | ) |
Disassociate EAP D-BUS request.
Definition at line 3438 of file dbus-handler.c.
References disassociate_cb().
Referenced by associate(), and handle_netlink_wap_event().
static DBusHandlerResult disassociate_request | ( | DBusMessage * | message, | |
DBusConnection * | connection | |||
) | [static] |
Disassociate WLAN D-BUS request.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 2969 of file dbus-handler.c.
References get_wlan_state(), mlme_command(), scan(), set_wlan_state(), and wlan_status.
static DBusHandlerResult disconnect_request | ( | DBusMessage * | message, | |
DBusConnection * | connection | |||
) | [static] |
Disconnect WLAN and remove kernel module D-BUS request.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 2951 of file dbus-handler.c.
References set_wlan_state().
static DBusHandlerResult eap_check_signal_dbus | ( | DBusMessage * | message | ) | [static] |
Check EAP DBUS authentication signal.
message | DBUS message. |
Definition at line 432 of file dbus-handler.c.
References get_wlan_state(), netlink_send_linkmode(), set_power_state(), and wlan_status.
Referenced by wlancond_req_handler().
static dbus_uint32_t find_adhoc_channel | ( | GSList * | ap_list | ) | [static] |
Select Adhoc channel.
ap_list | List of scanned APs. |
Definition at line 2659 of file dbus-handler.c.
Referenced by find_connection_and_associate().
struct scan_results_t* find_connection | ( | GSList * | ap_list, | |
struct connect_params_t * | conn, | |||
gboolean | update_roam_cache | |||
) | [read] |
Find connection.
ap_list | List of access points. | |
conn | Connection parameters. | |
update_roam_cache | Update roaming cache or not. |
Definition at line 2576 of file dbus-handler.c.
References add_to_roam_cache(), better_than_current_best(), check_capabilities(), clean_roam_cache(), is_ap_in_black_list(), and wlan_status.
Referenced by find_connection_and_associate().
int find_connection_and_associate | ( | GSList * | scan_results, | |
gboolean | update_roam_cache, | |||
gboolean | create_new_adhoc, | |||
gboolean | autoconnect | |||
) |
Find connection and associate.
scan_results | Scan results. |
Definition at line 2725 of file dbus-handler.c.
References associate(), check_if_duplicate_entry(), find_adhoc_channel(), find_connection(), and wlan_status.
Referenced by connect_from_scan_results(), handle_netlink_wap_event(), settings_and_connect_request(), and wlan_connect_timer_cb().
int find_pmkid_from_pmk_cache | ( | unsigned char * | mac, | |
unsigned char ** | pmkid | |||
) |
Find entry from PMKSA cache.
mac | MAC address to identify the entry. | |
pmkid | This pointer will be set to point the pmkid. This won't be set on errors. |
Definition at line 1604 of file dbus-handler.c.
References check_pmksa_cache(), remove_from_pmksa_cache(), and wlan_status.
Referenced by generate_wapi_ie(), and generate_wpa2_ie().
guint get_encryption_info | ( | void | ) |
Get encryption info.
Definition at line 253 of file dbus-handler.c.
References wlan_status.
Referenced by connected_signal().
guint get_mode | ( | void | ) |
Helper function for getting the wlan mode.
Definition at line 1113 of file dbus-handler.c.
References wlan_status.
Referenced by icd_check_signal_dbus(), nl80211_connect(), nl80211_set_cqm(), and status_request().
guint get_scan_state | ( | void | ) |
Helper function for getting the scan state.
Definition at line 1105 of file dbus-handler.c.
References wlan_status.
Referenced by ask_scan_results(), handle_netlink_wap_event(), nl80211_scan_ready(), scan(), and scan_request().
gboolean get_setting_bool | ( | const gchar * | path, | |
gboolean * | error | |||
) |
Helper function for getting boolean value from the settings.
path | Setting path to search for user specified value. | |
error | Variable to hold possible error. |
Definition at line 193 of file dbus-handler.c.
References wlan_status.
Referenced by init_dbus_handler(), and monitor_iap_keys().
static gint get_setting_int | ( | const gchar * | path | ) | [static] |
Helper function for getting integer value from settings.
path | Setting path to search for user specified value. |
Definition at line 167 of file dbus-handler.c.
References wlan_status.
Referenced by init_logging().
guint get_wlan_state | ( | void | ) |
Helper function for getting the wlan state.
Definition at line 1070 of file dbus-handler.c.
References wlan_status.
Referenced by ask_scan_results(), associate(), connect_from_scan_results(), connection_status_request(), disassociate_request(), eap_check_signal_dbus(), handle_netlink_wap_event(), icd_check_signal_dbus(), init_if(), is_connected_state(), print_netlink_event_token(), process_cqm_event(), scan_request(), set_powersave_request(), set_wlan_state(), settings_and_connect_request(), status_request(), wlan_connect_timer_cb(), and wlan_if_down_cb().
gboolean get_wpa_mode | ( | void | ) |
Check if WPA or WAPI mode is in use.
Definition at line 1506 of file dbus-handler.c.
References wlan_status.
Referenced by associate(), handle_netlink_wap_event(), nl80211_connect(), and set_wlan_state().
static DBusHandlerResult gprs_datacounters_signal | ( | DBusMessage * | message | ) | [static] |
Handle GPRS DataCounters DBUS signal.
message | DBUS message. |
Definition at line 523 of file dbus-handler.c.
References set_tx_power(), wlan_gprs_cb(), and wlan_status.
Referenced by wlancond_req_handler().
static gint handle_country | ( | void | ) | [static] |
Handles WLAN country.
Definition at line 632 of file dbus-handler.c.
References check_country_timeout(), run_calibration(), and wlan_status.
Referenced by init_dbus_handler(), and init_if().
static DBusHandlerResult handle_policy_actions | ( | DBusMessage * | msg | ) | [static] |
Handles policy actions method call.
msg | DBUS message. |
Definition at line 3716 of file dbus-handler.c.
References context_parser().
Referenced by wlancond_req_handler().
static DBusHandlerResult icd_check_signal_dbus | ( | DBusMessage * | message | ) | [static] |
Helper function for mode change DBUS handling.
message | DBUS message. Check ICD DBUS signal. | |
message | DBUS message. |
Definition at line 384 of file dbus-handler.c.
References get_mode(), get_wlan_state(), set_power_state(), set_wlan_state(), and wlan_status.
Referenced by wlancond_req_handler().
int init_dbus_handler | ( | void | ) |
Helper function for initializing handler structs
Definition at line 668 of file dbus-handler.c.
References get_setting_bool(), handle_country(), and wlan_status.
Referenced by main().
void init_dbus_handlers | ( | DBusConnection * | connection | ) |
Create bindings for D-BUS handlers.
connection | DBUS connection. |
Definition at line 3894 of file dbus-handler.c.
Referenced by main().
static int init_if | ( | int | sock | ) | [static] |
Initialize the WLAN interface.
sock | socket. |
Definition at line 1258 of file dbus-handler.c.
References get_wlan_state(), handle_country(), set_interface_state(), set_power_state(), set_wlan_state(), and wlan_status.
Referenced by scan_request(), and settings_and_connect_request().
void init_logging | ( | void | ) |
Initialize logging.
Definition at line 219 of file dbus-handler.c.
References debug_level, get_setting_int(), and wlan_status.
Referenced by main().
static DBusHandlerResult interface_request | ( | DBusMessage * | message, | |
DBusConnection * | connection | |||
) | [static] |
Interface D_BUS request.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 3110 of file dbus-handler.c.
References wlan_status.
static gboolean is_uapsd_supported | ( | unsigned char * | mac | ) | [static] |
Check if given AP supports U-APSD.
mac | MAC address. |
Definition at line 1170 of file dbus-handler.c.
References wlan_status.
Referenced by set_power_state().
int mlme_command | ( | guchar * | addr, | |
guint16 | cmd, | |||
guint16 | reason_code | |||
) |
MLME command.
addr | Access point MAC address. | |
cmd | Command. | |
reason_code | Reason for leaving. |
Definition at line 869 of file dbus-handler.c.
References nl80211_leave_adhoc(), nl80211_mlme_command(), and wlan_status.
Referenced by associate(), disassociate_request(), handle_mic_failure(), handle_netlink_wap_event(), set_wlan_state(), settings_and_connect_request(), and wlan_connect_timer_cb().
void mode_change | ( | dbus_uint32_t | radio_mode | ) |
Helper function for mode change.
radio_mode | New mode. |
Definition at line 287 of file dbus-handler.c.
References is_connected_state(), and set_wlan_state().
Referenced by main().
static int network_compare | ( | gconstpointer | a, | |
gconstpointer | b | |||
) | [static] |
Network compare.
a | Pointer to scan_result 1. | |
b | Pointer to scan result 2. |
Definition at line 2262 of file dbus-handler.c.
References wlan_status.
Referenced by ask_scan_results().
void nl80211_scan_ready | ( | void | ) |
Handles scan results ready netlink event
Definition at line 2927 of file dbus-handler.c.
References ask_scan_results(), get_scan_state(), and set_wlan_state().
Referenced by print_netlink_event_token().
static gboolean no_connection_and_scan_retries_left | ( | void | ) | [static] |
Check how many scans are left before giving up.
Definition at line 763 of file dbus-handler.c.
References wlan_status.
Referenced by connect_from_scan_results().
static void registrar_error_signal | ( | void | ) | [static] |
Send WPS too many registrars signal.
Definition at line 2799 of file dbus-handler.c.
Referenced by connect_from_scan_results().
gboolean remove_from_pmksa_cache | ( | unsigned char * | mac | ) |
Removes an entry with the given mac address from the PMKSA cache.
mac | The mac address to be removed. |
Definition at line 1578 of file dbus-handler.c.
References wlan_status.
Referenced by find_pmkid_from_pmk_cache().
gboolean remove_from_roam_cache | ( | roam_cache_key_t *const | key | ) |
Remove from roam cache.
bssid | BSSID to remove. |
Definition at line 2355 of file dbus-handler.c.
References wlan_status.
Referenced by wlan_connect_timer_cb().
static void remove_timers | ( | void | ) | [static] |
static void reschedule_scan | ( | void | ) | [static] |
Reschedule scan.
Definition at line 2494 of file dbus-handler.c.
References schedule_scan(), and wlan_status.
Referenced by connect_from_scan_results().
gint run_calibration | ( | void | ) |
Runs calibration data to WLAN firmware.
Definition at line 468 of file dbus-handler.c.
Referenced by handle_country(), and handle_message().
void save_device_interface | ( | void | ) |
Save the name of the wireless device.
Definition at line 1289 of file dbus-handler.c.
References wlan_status.
Referenced by main().
int scan | ( | gchar * | ssid, | |
int | ssid_len, | |||
gboolean | add_timer | |||
) |
Helper function for scanning.
ssid | SSID to scan. | |
ssid_len | SSID length. |
Definition at line 1688 of file dbus-handler.c.
References get_scan_state(), nl80211_scan(), set_scan_state(), set_wlan_state(), wlan_scan_cb(), and wlan_status.
Referenced by disassociate_request(), handle_netlink_wap_event(), scan_request(), settings_and_connect_request(), and wlan_connect_timer_cb().
static DBusHandlerResult scan_request | ( | DBusMessage * | message, | |
DBusConnection * | connection | |||
) | [static] |
Scan D-BUS request.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 2151 of file dbus-handler.c.
References get_scan_state(), get_wlan_state(), init_if(), scan(), scan_name_cache, set_tx_power(), set_wlan_state(), and socket_open().
gboolean scan_retries_left | ( | void | ) |
Check how many scans are left before giving up.
Definition at line 741 of file dbus-handler.c.
References wlan_status.
Referenced by handle_netlink_wap_event(), and wlan_connect_timer_cb().
void schedule_scan | ( | guint | seconds | ) |
Schedule scan.
seconds | Delay scan for this many seconds. |
Definition at line 2481 of file dbus-handler.c.
References wlan_status.
Referenced by process_cqm_event(), and reschedule_scan().
void set_call_type | ( | const char * | type | ) |
Sets the call type. This might also change the power save mode.
type | The call type as a string. |
Definition at line 3604 of file dbus-handler.c.
References set_power_state(), set_scan_params(), set_tx_power(), and wlan_status.
Referenced by context_parser().
int set_interface_state | ( | int | sock, | |
int | dir, | |||
short | flags | |||
) |
Set interface state.
socket | socket. | |
dir | direction. | |
flags | settings flags. |
Definition at line 1304 of file dbus-handler.c.
References wlan_status.
Referenced by ask_scan_results(), init_if(), and set_wlan_state().
static int set_mode | ( | guint32 | mode | ) | [static] |
Helper function for setting the operating mode.
mode | operating mode. |
Definition at line 903 of file dbus-handler.c.
References nl80211_set_cqm(), nl80211_set_op_mode(), and wlan_status.
Referenced by settings_and_connect_request().
static void set_network_latency | ( | int | latency | ) | [static] |
Set network latency.
latency | New latency. |
Definition at line 1122 of file dbus-handler.c.
References wlan_status.
Referenced by set_power_state().
static DBusHandlerResult set_pmksa_request | ( | DBusMessage * | message, | |
DBusConnection * | connection | |||
) | [static] |
Set pmksa D-BUS request.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 3163 of file dbus-handler.c.
References add_to_pmksa_cache().
gboolean set_power_state | ( | guint | new_state | ) |
Request WLAN power state.
state | New power state. |
Definition at line 1198 of file dbus-handler.c.
References is_uapsd_supported(), nl80211_set_power_save(), set_network_latency(), and wlan_status.
Referenced by eap_check_signal_dbus(), icd_check_signal_dbus(), init_if(), monitor_full_ps_cb(), set_call_type(), set_powersave_request(), set_wlan_state(), and settings_and_connect_request().
static DBusHandlerResult set_powersave_request | ( | DBusMessage * | message, | |
DBusConnection * | connection | |||
) | [static] |
Set powersave D-BUS request.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 3224 of file dbus-handler.c.
References connect_name_cache, get_wlan_state(), set_power_state(), set_wlan_state(), and wlan_status.
static void set_scan_params | ( | guint | scan_mode | ) | [static] |
Sets the scan mode.
scan_mode | The scan mode. |
Definition at line 3578 of file dbus-handler.c.
References write_file().
Referenced by set_call_type().
void set_scan_state | ( | guint | new_state | ) |
Helper function for setting new scan state.
new_state | New scan state. |
Definition at line 1079 of file dbus-handler.c.
References scan_name_cache, send_dbus_scan_results(), and wlan_status.
Referenced by ask_scan_results(), scan(), set_wlan_state(), and settings_and_connect_request().
gboolean set_tx_power | ( | guint | power | ) |
Set tx power level.
power | Power level. | |
sock | socket. |
Definition at line 1350 of file dbus-handler.c.
References nl80211_set_tx_power(), and wlan_status.
Referenced by gprs_datacounters_signal(), scan_request(), set_call_type(), settings_and_connect_request(), and wlan_gprs_cb().
void set_wlan_state | ( | int | new_state, | |
int | send_signal, | |||
gboolean | delay_shutdown | |||
) |
Helper function for setting new wlan state
new_state | New state for WLAN. | |
send_signal | Should signal be sent. | |
delay_shutdown | Whether to delay shutdown or not. |
Definition at line 969 of file dbus-handler.c.
References clean_roam_cache(), clear_wpa_mode(), disconnected_signal(), get_wlan_state(), get_wpa_mode(), mlme_command(), remove_iptables(), remove_timers(), set_interface_state(), set_power_state(), set_scan_state(), socket_open(), wlan_if_down_cb(), wlan_if_down_timer_id, and wlan_status.
Referenced by ask_scan_results(), associate(), connect_from_scan_results(), disassociate_request(), disconnect_request(), handle_message(), handle_mic_failure(), handle_netlink_wap_event(), icd_check_signal_dbus(), init_if(), main(), mode_change(), nl80211_scan_ready(), scan(), scan_request(), set_powersave_request(), settings_and_connect_request(), status_request(), wlan_connect_timer_cb(), wlan_if_down_cb(), and wlan_scan_cb().
static DBusHandlerResult settings_and_connect_request | ( | DBusMessage * | message, | |
DBusConnection * | connection | |||
) | [static] |
Settings and connect D-BUS request.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 1868 of file dbus-handler.c.
References check_connect_arguments(), clean_scan_results(), connect_name_cache, find_connection_and_associate(), get_wlan_state(), init_if(), mlme_command(), nl80211_send_get_scan_results(), nl80211_set_channel(), scan(), set_mode(), set_power_state(), set_scan_state(), set_tx_power(), set_wlan_state(), socket_open(), and wlan_status.
int socket_open | ( | void | ) |
Helper function for socket opening.
Definition at line 130 of file dbus-handler.c.
References wlan_socket.
Referenced by ask_scan_results(), scan_request(), set_wlan_state(), and settings_and_connect_request().
static DBusHandlerResult status_request | ( | DBusMessage * | message, | |
DBusConnection * | connection | |||
) | [static] |
Status D_BUS request.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 3002 of file dbus-handler.c.
References get_mode(), get_wlan_state(), nl80211_get_signal_info(), set_wlan_state(), and wlan_status.
static int update_algorithms | ( | guint32 | encryption, | |
struct scan_results_t * | scan_results | |||
) | [static] |
Updates algorithms to internal status.
encryption | Encryption settings. | |
scan_results | Scan results. |
Definition at line 1382 of file dbus-handler.c.
References wlan_status.
Referenced by associate().
void update_own_ie | ( | unsigned char * | wpa_ie, | |
guint | wpa_ie_len | |||
) |
Update our Information Element.
wpa_ie | WPA Information Element. | |
wpa_ie_len | WPA Information Element length. |
Definition at line 242 of file dbus-handler.c.
References wlan_status.
Referenced by clear_wpa_mode(), generate_wapi_ie(), generate_wpa2_ie(), and generate_wpa_ie().
static gboolean wlan_connect_timer_cb | ( | void * | data | ) | [static] |
WLAN connect timer callback.
data | User data. |
Definition at line 776 of file dbus-handler.c.
References find_connection_and_associate(), get_wlan_state(), mlme_command(), remove_from_roam_cache(), scan(), scan_retries_left(), set_wlan_state(), and wlan_status.
Referenced by associate().
static gboolean wlan_gprs_cb | ( | void * | data | ) | [static] |
WLAN GPRS timer callback.
data | User data. |
Definition at line 507 of file dbus-handler.c.
References set_tx_power(), and wlan_status.
Referenced by gprs_datacounters_signal().
static gboolean wlan_if_down_cb | ( | void * | data | ) | [static] |
WLAN interface down callback.
data | User data. |
Definition at line 847 of file dbus-handler.c.
References get_wlan_state(), set_wlan_state(), and wlan_if_down_timer_id.
Referenced by set_wlan_state().
static gboolean wlan_scan_cb | ( | void * | data | ) | [static] |
WLAN scan callback.
data | User data. |
Definition at line 831 of file dbus-handler.c.
References set_wlan_state(), and wlan_status.
Referenced by scan().
void wlancond_print | ( | guint | priority, | |
const char * | debug, | |||
... | ||||
) |
Wlancond debug printing function.
Definition at line 91 of file dbus-handler.c.
References debug_level.
DBusHandlerResult wlancond_req_handler | ( | DBusConnection * | connection, | |
DBusMessage * | message, | |||
void * | user_data | |||
) |
Generic handler for D-Bus requests.
message | DBUS message. | |
connection | DBUS connection. |
Definition at line 3821 of file dbus-handler.c.
References csd_check_signal_dbus(), eap_check_signal_dbus(), gprs_datacounters_signal(), handle_policy_actions(), and icd_check_signal_dbus().
int wpa_ie_push | ( | char * | ap_mac_addr | ) |
WPA IE D-BUS push.
ap_mac_addr | Access point MAC address. |
Definition at line 3281 of file dbus-handler.c.
References wlan_status.
Referenced by handle_netlink_wap_event().
int wpa_mic_failure_event | ( | dbus_bool_t | key_type, | |
dbus_bool_t | is_fatal | |||
) |
WPA MIC failure event D-BUS request.
key_type | Key type, Unicast/Broadcast key. | |
is_fatal | Error is fatal if true. |
Definition at line 3366 of file dbus-handler.c.
Referenced by handle_mic_failure().
static void write_file | ( | const char * | file, | |
guint | value | |||
) | [static] |
Write scan sysfs file.
file | File to be written. | |
value | Value to be written. |
Definition at line 3560 of file dbus-handler.c.
Referenced by set_scan_params().
char* connect_name_cache = NULL [static] |
Saved DBUS connect name
Definition at line 67 of file dbus-handler.c.
Referenced by set_powersave_request(), and settings_and_connect_request().
gint debug_level = 0 |
Debug level
Definition at line 85 of file dbus-handler.c.
Referenced by init_logging(), signal_debug(), and wlancond_print().
method_handler_t handlers[] [static] |
{ { WLANCOND_REQ_INTERFACE, WLANCOND_SETTINGS_AND_CONNECT_REQ, settings_and_connect_request}, { WLANCOND_REQ_INTERFACE, WLANCOND_SCAN_REQ, scan_request}, { WLANCOND_REQ_INTERFACE, WLANCOND_STATUS_REQ, status_request}, { WLANCOND_REQ_INTERFACE, WLANCOND_INTERFACE_REQ, interface_request}, { WLANCOND_REQ_INTERFACE, WLANCOND_CONNECTION_STATUS_REQ, connection_status_request}, { WLANCOND_REQ_INTERFACE, WLANCOND_SET_PMKSA_REQ, set_pmksa_request}, { WLANCOND_REQ_INTERFACE, WLANCOND_SET_POWERSAVE_REQ, set_powersave_request}, { WLANCOND_REQ_INTERFACE, WLANCOND_DISCONNECT_REQ, disconnect_request}, { WLANCOND_REQ_INTERFACE, WLANCOND_DISASSOCIATE_REQ, disassociate_request}, { NULL } }
Definition at line 3798 of file dbus-handler.c.
char* scan_name_cache = NULL [static] |
Saved DBUS scan name
Definition at line 65 of file dbus-handler.c.
Referenced by ask_scan_results(), scan_request(), and set_scan_state().
guint wlan_if_down_timer_id = 0 [static] |
Timer IDs
Definition at line 80 of file dbus-handler.c.
Referenced by set_wlan_state(), and wlan_if_down_cb().
int wlan_socket = -1 [static] |
Socket is global
Definition at line 70 of file dbus-handler.c.
Referenced by clean_dbus_handler(), and socket_open().
struct wlan_status_t wlan_status |
WLAN status and state is here
Definition at line 73 of file dbus-handler.c.
Referenced by add_to_pmksa_cache(), add_to_roam_cache(), ask_scan_results(), associate(), check_connect_arguments(), check_country_timeout(), clean_roam_cache(), clear_wpa_mode(), connect_from_scan_results(), connected_signal(), csd_check_signal_dbus(), decrease_signal_in_roam_cache(), disassociate_request(), disconnected_signal(), eap_check_signal_dbus(), find_connection(), find_connection_and_associate(), find_pmkid_from_pmk_cache(), get_encryption_info(), get_mode(), get_scan_state(), get_setting_bool(), get_setting_int(), get_wlan_state(), get_wpa_mode(), gprs_datacounters_signal(), handle_country(), handle_message(), handle_netlink_wap_event(), icd_check_signal_dbus(), init_dbus_handler(), init_if(), init_logging(), interface_request(), is_uapsd_supported(), main(), mlme_command(), monitor_full_ps_cb(), monitor_iap_keys(), netlink_send_linkmode(), network_compare(), nl80211_set_cqm(), no_connection_and_scan_retries_left(), phy_info_handler(), print_netlink_event_token(), remove_from_pmksa_cache(), remove_from_roam_cache(), reschedule_scan(), roam_scanning(), save_caps(), save_device_interface(), scan(), scan_retries_left(), schedule_scan(), set_call_type(), set_interface_state(), set_iptables(), set_iptables_state(), set_mode(), set_network_latency(), set_power_state(), set_powersave_request(), set_scan_state(), set_tx_power(), set_wlan_state(), settings_and_connect_request(), status_request(), update_algorithms(), update_own_ie(), wlan_connect_timer_cb(), wlan_gprs_cb(), wlan_scan_cb(), and wpa_ie_push().
DBusObjectPathVTable wlancond_req_vtable [static] |
{ .message_function = wlancond_req_handler, .unregister_function = NULL }
Definition at line 3884 of file dbus-handler.c.