Data Structures | Defines | Typedefs | Enumerations | Functions | Variables

dbus-handler.h File Reference

#include <sys/types.h>
#include <sys/socket.h>
#include <linux/types.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/if_ether.h>
#include <dbus/dbus.h>
#include <wlancond.h>
#include "libnl-handler.h"
#include "common.h"
Include dependency graph for dbus-handler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  scan_cb_data

Defines

#define DBUS_API_SUBJECT_TO_CHANGE
#define CLEAR   1
#define SET   2
#define ETOOMANYREGISTRARS   -500
#define ETOOWEAKAP   -2
#define ENEEDEXTRASCAN   -3
#define ESUPPLICANT   -5
#define EWRONGSSID   -7

Typedefs

typedef struct scan_cb_data scan_cb_data

Enumerations

enum  { SCAN_NORMAL = 0, SCAN_SPLIT }

Functions

void init_dbus_handlers (DBusConnection *connection)
void destroy_dbus_handlers (DBusConnection *connection)
int socket_open (void)
gboolean ask_scan_results (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)
int init_dbus_handler (void)
int clean_dbus_handler (void)
void clear_wpa_mode (void)
int wpa_ie_push (char *ap_mac_addr)
gboolean get_wpa_mode (void)
int set_interface_state (int sock, int dir, short flags)
void clean_roam_cache (void)
guint get_mode (void)
gboolean set_real_power_state (guint new_state, int sock)
int scan (gchar *ssid, int ssid_len, gboolean add_timer)
void update_own_ie (unsigned char *wpa_ie, guint wpa_ie_len)
gboolean set_power_state (guint state)
guint get_encryption_info (void)
void remove_connect_timer (void)
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)
void set_call_type (const char *type)
int context_parser (DBusMessageIter *actit)
int wpa_mic_failure_event (dbus_bool_t key_type, dbus_bool_t is_fatal)
void save_device_interface (void)
gboolean remove_from_pmksa_cache (unsigned char *mac)
int find_pmkid_from_pmk_cache (unsigned char *mac, unsigned char **pmkid)
DBusHandlerResult wlancond_req_handler (DBusConnection *connection, DBusMessage *message, void *user_data)
int associate (struct scan_results_t *scan_results)
gboolean remove_from_roam_cache (roam_cache_key_t *const key)
struct scan_results_tfind_connection (GSList *scan_list, struct connect_params_t *conn, gboolean update_roam_cache)
void remove_roam_scan_timer (void)
void remove_scan_timer (void)
int set_bssid (unsigned char *bssid)
int set_essid (char *essid, int essid_len)
void clear_essid_and_bssid (void)
int find_connection_and_associate (GSList *scan_results, gboolean update_roam_cache, gboolean create_new_adhoc, gboolean autoconnect)
int scan_results_ioctl (int ifindex, GSList **scan_results_save, char *ssid, guint ssid_len)
void set_wlan_signal (gboolean high_or_low)
gboolean decrease_signal_in_roam_cache (roam_cache_key_t *const key)
int mlme_command (guchar *addr, guint16 cmd, guint16 reason_code)
void schedule_scan (guint seconds)
gboolean scan_retries_left (void)
void connected_signal (char *bssid)
gint run_calibration (void)
void kill_supplicant (void)
gboolean get_inactivity_status (void)
gboolean get_setting_bool (const gchar *path, gboolean *error)
gboolean can_adjust_psm (void)
struct scan_results_tcopy_scan_results (struct scan_results_t *results)
gboolean set_tx_power (guint power)

Variables

struct wlan_status_t wlan_status

Detailed Description

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

Author:
Janne Ylalehto <janne.ylalehto@nokia.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.h.


Typedef Documentation

typedef struct scan_cb_data scan_cb_data

scan callback data


Function Documentation

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:

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:

void connected_signal ( char *  bssid  ) 

Send connected signal.

Parameters:
scan_results Scan results to be sent.

Definition at line 217 of file dbus-signal.c.

References get_encryption_info(), and wlan_status.

Referenced by handle_netlink_wap_event().

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

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  ) 

Free memory allocated to handlers

Parameters:
connection D-Bus connection

Destroy D-BUS handlers.

Parameters:
connection DBUS connection.

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

Referenced by main().

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:

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

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

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  ) 

Bind functions to corresponding D-Bus messages

Parameters:
connection D-Bus connection

Create bindings for D-BUS handlers.

Parameters:
connection DBUS connection.

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

Referenced by main().

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:

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

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:

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

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:

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

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

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


Variable Documentation

WLAN status and state is here

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