Data Structures | Defines | Typedefs | Functions | Variables

dbus-handler.c File Reference

#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"
Include dependency graph for dbus-handler.c:

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_tcopy_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_tfind_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

Detailed Description

Copyright (C) 2004-2010 Nokia Corporation. All rights reserved.

Author:
Janne Ylälehto <janne.ylalehto@nokia.com>

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 Documentation

#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.

Parameters:
data Optional scanning data.
Returns:
status.

Definition at line 1653 of file dbus-handler.c.


Function Documentation

static void add_to_pmksa_cache ( unsigned char *  pmkid,
unsigned char *  mac 
) [static]

Add PMKID to PMKSA cache.

Parameters:
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.

Parameters:
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().

Here is the call graph for this function:

gboolean ask_scan_results ( void   ) 

Scan results request.

Parameters:
ifindex Interface index.
Returns:
status.

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().

Here is the call graph for this function:

int associate ( struct scan_results_t scan_results  ) 

Associate function to associate to selected access point.

Parameters:
scan_results Scan results.
Returns:
status.

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().

Here is the call graph for this function:

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.

Parameters:
current_best Scan results for the current best AP.
candidate Scan results for the candidate AP.
Returns:
TRUE if better than the current best 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.

Parameters:
scan_results Scan results.
conn Connection paramters.
Returns:
status.

Definition at line 2522 of file dbus-handler.c.

References check_ciphers().

Referenced by find_connection().

Here is the call graph for this function:

static int check_ciphers ( guint32  c1,
guint32  c2 
) [static]

Compare ciphers.

Parameters:
c1 Cipher 1.
c2 Cipher 2.
Returns:
1 if matches.

Definition at line 2433 of file dbus-handler.c.

References check_group_cipher().

Referenced by check_capabilities().

Here is the call graph for this function:

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.

Parameters:
conn Connection parameters.
ssid SSID.
key Encryption keys.
Returns:
status.

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.

Returns:
TRUE if previous 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.

Parameters:
c1 Cipher 1.
c2 Cipher 2.
Returns:
1 if matches.

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.

Parameters:
scan_results List of scanned APs.
entry AP scan result list entry.
Returns:
TRUE if duplicate.

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.

Parameters:
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.
Returns:
0 on success, non-zero on errors.

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

static void connect_from_scan_results ( GSList *  scan_results  )  [static]

Connects based on scan results.

Parameters:
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().

Here is the call graph for this function:

static DBusHandlerResult connection_status_request ( DBusMessage *  message,
DBusConnection *  connection 
) [static]

Connection status D_BUS request.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

Definition at line 3132 of file dbus-handler.c.

References get_wlan_state().

Here is the call graph for this function:

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.

Parameters:
actit Dbus message iterator to the context.
Returns:
TRUE on success, FALSE otherwise.

Definition at line 3651 of file dbus-handler.c.

References set_call_type().

Referenced by handle_policy_actions().

Here is the call graph for this function:

struct scan_results_t* copy_scan_results ( struct scan_results_t results  )  [read]

Make a copy of scan results.

Parameters:
results Scan results to copy.
Returns:
Copied results.

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.

Parameters:
message DBUS message.
Returns:
DBusHandlerResult.

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.

Parameters:
bssid BSSID.
Returns:
status.

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.

Parameters:
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.

Parameters:
pending Pending DBUS message.
user_data Callback data.
Returns:
status

Definition at line 3412 of file dbus-handler.c.

Referenced by disassociate_eap().

int disassociate_eap ( void   ) 

Disassociate EAP D-BUS request.

Returns:
status.

Definition at line 3438 of file dbus-handler.c.

References disassociate_cb().

Referenced by associate(), and handle_netlink_wap_event().

Here is the call graph for this function:

static DBusHandlerResult disassociate_request ( DBusMessage *  message,
DBusConnection *  connection 
) [static]

Disassociate WLAN D-BUS request.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

Definition at line 2969 of file dbus-handler.c.

References get_wlan_state(), mlme_command(), scan(), set_wlan_state(), and wlan_status.

Here is the call graph for this function:

static DBusHandlerResult disconnect_request ( DBusMessage *  message,
DBusConnection *  connection 
) [static]

Disconnect WLAN and remove kernel module D-BUS request.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

Definition at line 2951 of file dbus-handler.c.

References set_wlan_state().

Here is the call graph for this function:

static DBusHandlerResult eap_check_signal_dbus ( DBusMessage *  message  )  [static]

Check EAP DBUS authentication signal.

Parameters:
message DBUS message.
Returns:
DBusHandlerResult.

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().

Here is the call graph for this function:

static dbus_uint32_t find_adhoc_channel ( GSList *  ap_list  )  [static]

Select Adhoc channel.

Parameters:
ap_list List of scanned APs.
Returns:
selected channel.

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.

Parameters:
ap_list List of access points.
conn Connection parameters.
update_roam_cache Update roaming cache or not.
Returns:
scan_results_t Returns best connection if found.

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().

Here is the call graph for this function:

int find_connection_and_associate ( GSList *  scan_results,
gboolean  update_roam_cache,
gboolean  create_new_adhoc,
gboolean  autoconnect 
)

Find connection and associate.

Parameters:
scan_results Scan results.
Returns:
status.

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().

Here is the call graph for this function:

int find_pmkid_from_pmk_cache ( unsigned char *  mac,
unsigned char **  pmkid 
)

Find entry from PMKSA cache.

Parameters:
mac MAC address to identify the entry.
pmkid This pointer will be set to point the pmkid. This won't be set on errors.
Returns:
Zero on success, non-zero 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().

Here is the call graph for this function:

guint get_encryption_info ( void   ) 

Get encryption info.

Returns:
status.

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.

Returns:
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.

Returns:
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.

Parameters:
path Setting path to search for user specified value.
error Variable to hold possible error.
Returns:
value Boolean value.

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.

Parameters:
path Setting path to search for user specified value.
Returns:
settings integer.

Definition at line 167 of file dbus-handler.c.

References wlan_status.

Referenced by init_logging().

guint get_wlan_state ( void   ) 
gboolean get_wpa_mode ( void   ) 

Check if WPA or WAPI mode is in use.

Returns:
TRUE if 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.

Parameters:
message DBUS message.
Returns:
DBusHandlerResult.

Definition at line 523 of file dbus-handler.c.

References set_tx_power(), wlan_gprs_cb(), and wlan_status.

Referenced by wlancond_req_handler().

Here is the call graph for this function:

static gint handle_country ( void   )  [static]

Handles WLAN country.

Returns:
status.

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().

Here is the call graph for this function:

static DBusHandlerResult handle_policy_actions ( DBusMessage *  msg  )  [static]

Handles policy actions method call.

Parameters:
msg DBUS message.
Returns:
result.

Definition at line 3716 of file dbus-handler.c.

References context_parser().

Referenced by wlancond_req_handler().

Here is the call graph for this function:

static DBusHandlerResult icd_check_signal_dbus ( DBusMessage *  message  )  [static]

Helper function for mode change DBUS handling.

Parameters:
message DBUS message. Check ICD DBUS signal.
message DBUS message.
Returns:
DBusHandlerResult.

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void init_dbus_handlers ( DBusConnection *  connection  ) 

Create bindings for D-BUS handlers.

Parameters:
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.

Parameters:
sock socket.
Returns:
previous state.

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

static DBusHandlerResult interface_request ( DBusMessage *  message,
DBusConnection *  connection 
) [static]

Interface D_BUS request.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

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.

Parameters:
mac MAC address.
Returns:
TRUE if U-APSD supported.

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.

Parameters:
addr Access point MAC address.
cmd Command.
reason_code Reason for leaving.
Returns:
status.

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().

Here is the call graph for this function:

void mode_change ( dbus_uint32_t  radio_mode  ) 

Helper function for mode change.

Parameters:
radio_mode New mode.

Definition at line 287 of file dbus-handler.c.

References is_connected_state(), and set_wlan_state().

Referenced by main().

Here is the call graph for this function:

static int network_compare ( gconstpointer  a,
gconstpointer  b 
) [static]

Network compare.

Parameters:
a Pointer to scan_result 1.
b Pointer to scan result 2.
Returns:
0 if a=b, -1 if a is better than b and 1 if b is better than a.

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().

Here is the call graph for this function:

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.

Parameters:
mac The mac address to be removed.
Returns:
status True if the entry was actually 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.

Parameters:
bssid BSSID to remove.
Returns:
status.

Definition at line 2355 of file dbus-handler.c.

References wlan_status.

Referenced by wlan_connect_timer_cb().

static void remove_timers ( void   )  [static]

Remove all timers.

Definition at line 930 of file dbus-handler.c.

Referenced by set_wlan_state().

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().

Here is the call graph for this function:

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.

Parameters:
ssid SSID to scan.
ssid_len SSID length.
Returns:
status.

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().

Here is the call graph for this function:

static DBusHandlerResult scan_request ( DBusMessage *  message,
DBusConnection *  connection 
) [static]

Scan D-BUS request.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

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().

Here is the call graph for this function:

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.

Parameters:
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.

Parameters:
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().

Here is the call graph for this function:

int set_interface_state ( int  sock,
int  dir,
short  flags 
)

Set interface state.

Parameters:
socket socket.
dir direction.
flags settings flags.
Returns:
status.

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.

Parameters:
mode operating mode.
Returns:
status.

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().

Here is the call graph for this function:

static void set_network_latency ( int  latency  )  [static]

Set network latency.

Parameters:
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.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

Definition at line 3163 of file dbus-handler.c.

References add_to_pmksa_cache().

Here is the call graph for this function:

gboolean set_power_state ( guint  new_state  ) 

Request WLAN power state.

Parameters:
state New power state.
Returns:
status.

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().

Here is the call graph for this function:

static DBusHandlerResult set_powersave_request ( DBusMessage *  message,
DBusConnection *  connection 
) [static]

Set powersave D-BUS request.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

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.

Here is the call graph for this function:

static void set_scan_params ( guint  scan_mode  )  [static]

Sets the scan mode.

Parameters:
scan_mode The scan mode.

Definition at line 3578 of file dbus-handler.c.

References write_file().

Referenced by set_call_type().

Here is the call graph for this function:

void set_scan_state ( guint  new_state  ) 

Helper function for setting new scan state.

Parameters:
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().

Here is the call graph for this function:

gboolean set_tx_power ( guint  power  ) 

Set tx power level.

Parameters:
power Power level.
sock socket.
Returns:
status.

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().

Here is the call graph for this function:

void set_wlan_state ( int  new_state,
int  send_signal,
gboolean  delay_shutdown 
)
static DBusHandlerResult settings_and_connect_request ( DBusMessage *  message,
DBusConnection *  connection 
) [static]

Settings and connect D-BUS request.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

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.

Here is the call graph for this function:

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.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

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.

Here is the call graph for this function:

static int update_algorithms ( guint32  encryption,
struct scan_results_t scan_results 
) [static]

Updates algorithms to internal status.

Parameters:
encryption Encryption settings.
scan_results Scan results.
Returns:
status.

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.

Parameters:
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.

Parameters:
data User data.
Returns:
status.

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().

Here is the call graph for this function:

static gboolean wlan_gprs_cb ( void *  data  )  [static]

WLAN GPRS timer callback.

Parameters:
data User data.
Returns:
status.

Definition at line 507 of file dbus-handler.c.

References set_tx_power(), and wlan_status.

Referenced by gprs_datacounters_signal().

Here is the call graph for this function:

static gboolean wlan_if_down_cb ( void *  data  )  [static]

WLAN interface down callback.

Parameters:
data User data.
Returns:
status.

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().

Here is the call graph for this function:

static gboolean wlan_scan_cb ( void *  data  )  [static]

WLAN scan callback.

Parameters:
data User data.
Returns:
status.

Definition at line 831 of file dbus-handler.c.

References set_wlan_state(), and wlan_status.

Referenced by scan().

Here is the call graph for this function:

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.

Parameters:
message DBUS message.
connection DBUS connection.
Returns:
status.

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().

Here is the call graph for this function:

int wpa_ie_push ( char *  ap_mac_addr  ) 

WPA IE D-BUS push.

Parameters:
ap_mac_addr Access point MAC address.
Returns:
status.

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.

Parameters:
key_type Key type, Unicast/Broadcast key.
is_fatal Error is fatal if true.
Returns:
status.

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.

Parameters:
file File to be written.
value Value to be written.

Definition at line 3560 of file dbus-handler.c.

Referenced by set_scan_params().


Variable Documentation

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]
Initial value:
 {
        { 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().

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]
Initial value:
 {
        .message_function    = wlancond_req_handler,
        .unregister_function = NULL
}

Definition at line 3884 of file dbus-handler.c.