#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 <iwlib.h>
#include <wireless.h>
#include <dbus/dbus.h>
#include <wlancond.h>
#include "common.h"
Go to the source code of this file.
Defines | |
#define | DBUS_API_SUBJECT_TO_CHANGE |
#define | CLEAR 1 |
#define | SET 2 |
#define | ETOOMANYREGISTRARS -500 |
Functions | |
void | init_dbus_handlers (DBusConnection *connection) |
void | destroy_dbus_handlers (DBusConnection *connection) |
int | socket_open (void) |
void | init_iwreq (struct iwreq *req) |
gboolean | ask_scan_results (int ifindex) |
void | set_wlan_state (int new_state, int send_signal, force_t force) |
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 (unsigned char *ap_mac_addr, unsigned char *ap_wpa_ie, int ap_wpa_ie_len, char *ssid, int ssid_len, unsigned int authentication_type) |
gboolean | get_wpa_mode (void) |
int | set_interface_state (int sock, int dir, short flags) |
void | clear_wpa_keys (unsigned char *bssid) |
void | clean_roam_cache (void) |
guint | get_mode (void) |
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, int sock) |
guint | get_encryption_info (void) |
void | remove_connect_timer (void) |
int | disassociate_eap (void) |
int | wpa_mic_failure_event (dbus_bool_t key_type, dbus_bool_t is_fatal) |
int | get_we_device_name (void) |
unsigned char * | find_pmkid_from_pmk_cache (unsigned char *mac) |
DBusHandlerResult | wlancond_req_handler (DBusConnection *connection, DBusMessage *message, void *user_data) |
int | associate (struct scan_results_t *scan_results) |
gboolean | remove_from_roam_cache (unsigned char *bssid) |
struct scan_results_t * | find_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 | associate_supplicant (void) |
int | set_bssid (unsigned char *bssid) |
int | set_essid (char *essid, int essid_len) |
int | find_connection_and_associate (GSList *scan_results, gboolean update_roam_cache, gboolean create_new_adhoc) |
int | scan_results_ioctl (int ifindex, GSList **scan_results_save) |
void | set_wlan_signal (gboolean high_or_low) |
gboolean | decrease_signal_in_roam_cache (unsigned char *bssid) |
int | mlme_command (guchar *addr, guint16 cmd, guint16 reason_code) |
void | schedule_scan (guint seconds) |
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.
gboolean ask_scan_results | ( | int | ifindex | ) |
Scan results request.
ifindex | Interface index. |
Definition at line 2360 of file dbus-handler.c.
References clean_roam_cache(), clean_scan_results(), connect_from_scan_results(), get_scan_state(), get_wlan_state(), network_compare(), scan_results_ioctl(), send_dbus_scan_results(), set_interface_state(), set_scan_state(), set_wlan_state(), and socket_open().
Referenced by print_event_token().
int associate | ( | struct scan_results_t * | scan_results | ) |
Associate function to associate to selected access point.
scan_results | Scan results. |
Definition at line 1541 of file dbus-handler.c.
References clear_wpa_keys(), get_wpa_mode(), set_bssid(), set_encryption_method(), set_essid(), set_freq(), set_wep_keys(), update_algorithms(), wlan_connect_timer_cb(), and wpa_ie_push().
Referenced by find_connection_and_associate().
int associate_supplicant | ( | void | ) |
Associate EAP D-BUS request.
Definition at line 2983 of file dbus-handler.c.
Referenced by handle_wap_event().
int clean_dbus_handler | ( | void | ) |
Helper function for cleaning handler.
Definition at line 205 of file dbus-handler.c.
void clean_roam_cache | ( | void | ) |
Clean roaming cache.
Definition at line 1061 of file dbus-handler.c.
References clean_scan_results().
Referenced by ask_scan_results(), find_connection(), and set_wlan_state().
void clear_wpa_keys | ( | unsigned char * | bssid | ) |
Clear WPA keys.
bssid | optional BSSID which keys to remove. |
Definition at line 1240 of file dbus-handler.c.
References init_iwreq(), and socket_open().
Referenced by associate(), clear_wpa_mode(), disassociate_request(), and handle_wap_event().
void clear_wpa_mode | ( | void | ) |
Clear WPA mode related stuff.
Definition at line 1068 of file dbus-handler.c.
References clear_wpa_keys().
Referenced by set_wlan_state().
gboolean decrease_signal_in_roam_cache | ( | unsigned char * | bssid | ) |
Give penalty to failed AP.
bssid | BSSID. |
Definition at line 1841 of file dbus-handler.c.
Referenced by handle_wap_event().
void destroy_dbus_handlers | ( | DBusConnection * | connection | ) |
Free memory allocated to handlers
connection | D-Bus connection |
connection | DBUS connection. |
Definition at line 3183 of file dbus-handler.c.
Referenced by main().
int disassociate_eap | ( | void | ) |
Disassociate EAP D-BUS request.
Definition at line 3050 of file dbus-handler.c.
References disassociate_cb().
Referenced by handle_wap_event().
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 1990 of file dbus-handler.c.
References add_to_roam_cache(), check_capabilities(), clean_roam_cache(), and is_ap_in_black_list().
Referenced by find_connection_and_associate().
int find_connection_and_associate | ( | GSList * | scan_results, | |
gboolean | update_roam_cache, | |||
gboolean | create_new_adhoc | |||
) |
Find connection and associate.
scan_results | Scan results. |
Definition at line 2103 of file dbus-handler.c.
References associate(), find_adhoc_channel(), and find_connection().
Referenced by connect_from_scan_results(), handle_wap_event(), settings_and_connect_request(), and wlan_connect_timer_cb().
unsigned char* find_pmkid_from_pmk_cache | ( | unsigned char * | mac | ) |
Find entry from PMKSA cache.
mac | MAC address to identify the entry. |
Definition at line 1150 of file dbus-handler.c.
Referenced by generate_wpa2_ie().
guint get_encryption_info | ( | void | ) |
Get encryption info.
Definition at line 173 of file dbus-handler.c.
Referenced by handle_wap_event().
guint get_mode | ( | void | ) |
Helper function for getting the wlan mode.
Definition at line 802 of file dbus-handler.c.
Referenced by icd_check_signal_dbus(), and status_request().
guint get_scan_state | ( | void | ) |
Helper function for getting the scan state.
Definition at line 794 of file dbus-handler.c.
Referenced by ask_scan_results(), handle_wap_event(), print_event_token(), scan(), and scan_request().
int get_we_device_name | ( | void | ) |
Find the name of the wireless device, needed in all ioctl calls. Save the result so that we don't need to find it in every ioctl call.
Definition at line 926 of file dbus-handler.c.
References set_we_name(), and socket_open().
Referenced by main().
guint get_wlan_state | ( | void | ) |
Helper function for getting the wlan state.
Definition at line 761 of file dbus-handler.c.
Referenced by ask_scan_results(), connect_from_scan_results(), connection_status_request(), disassociate_request(), handle_custom_event(), handle_wap_event(), icd_check_signal_dbus(), init_if(), rescan(), scan_request(), set_powersave_request(), set_wlan_state(), status_request(), wlan_connect_timer_cb(), wlan_if_down_cb(), and wlan_scan_cb().
gboolean get_wpa_mode | ( | void | ) |
Check if WPA mode is in use.
Definition at line 1088 of file dbus-handler.c.
Referenced by associate(), disassociate_request(), and handle_wap_event().
int init_dbus_handler | ( | void | ) |
Helper function for initializing handler structs
Definition at line 193 of file dbus-handler.c.
References get_own_mac().
Referenced by main().
void init_dbus_handlers | ( | DBusConnection * | connection | ) |
Bind functions to corresponding D-Bus messages
connection | D-Bus connection |
connection | DBUS connection. |
Definition at line 3160 of file dbus-handler.c.
Referenced by main().
void init_iwreq | ( | struct iwreq * | req | ) |
Helper function for initializing the iwreq.
Definition at line 93 of file dbus-handler.c.
Referenced by clear_wpa_keys(), mlme_command(), scan(), scan_results_ioctl(), set_bssid(), set_encryption_method_helper(), set_essid(), set_freq(), set_mode(), set_power_state(), set_tx_power(), set_wep_keys(), set_wpa_ie(), and status_request().
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 486 of file dbus-handler.c.
References init_iwreq(), and socket_open().
Referenced by disassociate_request(), handle_mic_failure(), and set_wlan_state().
gboolean remove_from_roam_cache | ( | unsigned char * | bssid | ) |
Remove from roam cache.
bssid | BSSID to remove. |
Definition at line 1814 of file dbus-handler.c.
Referenced by wlan_connect_timer_cb().
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 1169 of file dbus-handler.c.
References get_scan_state(), init_iwreq(), set_scan_state(), socket_open(), and wlan_scan_cb().
Referenced by disassociate_request(), handle_wap_event(), rescan(), scan_request(), settings_and_connect_request(), and wlan_connect_timer_cb().
int scan_results_ioctl | ( | int | ifindex, | |
GSList ** | scan_results_save | |||
) |
Get scan results from mac80211.
ifindex | Interface index. | |
scan_results_save | Scan results to save. |
Definition at line 2223 of file dbus-handler.c.
References get_interface_data(), init_iwreq(), print_event_token(), save_scan_results(), and socket_open().
Referenced by ask_scan_results(), and settings_and_connect_request().
void schedule_scan | ( | guint | seconds | ) |
Schedule scan.
seconds | Delay scan for this many seconds. |
Definition at line 1927 of file dbus-handler.c.
Referenced by handle_custom_event(), and reschedule_scan().
int set_bssid | ( | unsigned char * | bssid | ) |
Helper function for setting the BSSID.
bssid | BSSID. |
Definition at line 635 of file dbus-handler.c.
References init_iwreq(), and socket_open().
Referenced by associate(), handle_wap_event(), and set_wlan_state().
int set_essid | ( | char * | essid, | |
int | essid_len | |||
) |
Helper function for setting the ESSID.
essid | ESSID. | |
essid_len | ESSID length. |
Definition at line 612 of file dbus-handler.c.
References init_iwreq(), and socket_open().
Referenced by associate(), handle_wap_event(), and set_wlan_state().
int set_interface_state | ( | int | sock, | |
int | dir, | |||
short | flags | |||
) |
Set interface state.
socket | socket. | |
dir | direction. | |
flags | settings flags. |
Definition at line 944 of file dbus-handler.c.
Referenced by ask_scan_results(), init_if(), and set_wlan_state().
gboolean set_power_state | ( | guint | new_state, | |
int | sock | |||
) |
Set WLAN power state.
state | New power state. | |
sock | socket. |
Definition at line 813 of file dbus-handler.c.
References get_gconf_int(), and init_iwreq().
Referenced by icd_check_signal_dbus(), init_if(), set_powersave_request(), and settings_and_connect_request().
void set_scan_state | ( | guint | new_state | ) |
Helper function for setting new scan state.
new_state | New scan state. |
Definition at line 770 of file dbus-handler.c.
References send_dbus_scan_results().
Referenced by ask_scan_results(), disconnect_request(), scan(), set_wlan_state(), settings_and_connect_request(), and wlan_scan_cb().
void set_wlan_state | ( | int | new_state, | |
int | send_signal, | |||
force_t | force | |||
) |
Helper function for setting new wlan state
new_state | New state for WLAN. | |
send_signal | Should signal be sent. | |
force | If shutdown is forced or not. |
Definition at line 660 of file dbus-handler.c.
References clean_roam_cache(), clear_wpa_mode(), disconnected_signal(), get_wlan_state(), mlme_command(), set_bssid(), set_essid(), set_interface_state(), set_scan_state(), socket_open(), and wlan_if_down_cb().
Referenced by ask_scan_results(), connect_from_scan_results(), disassociate_request(), disconnect_request(), handle_mic_failure(), handle_wap_event(), icd_check_signal_dbus(), init_if(), main(), mode_change(), print_event_token(), scan_request(), set_powersave_request(), settings_and_connect_request(), wlan_connect_timer_cb(), wlan_if_down_cb(), wlan_scan_cb(), and wpa_ie_push_cb().
int socket_open | ( | void | ) |
Helper function for socket opening.
Definition at line 78 of file dbus-handler.c.
Referenced by ask_scan_results(), clear_wpa_keys(), get_interface_data(), get_own_mac(), get_we_device_name(), icd_check_signal_dbus(), mlme_command(), scan(), scan_request(), scan_results_ioctl(), set_bssid(), set_encryption_method_helper(), set_essid(), set_freq(), set_mode(), set_powersave_request(), set_wep_keys(), set_wlan_state(), set_wpa_ie(), settings_and_connect_request(), and status_request().
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 163 of file dbus-handler.c.
Referenced by generate_wpa2_ie(), and generate_wpa_ie().
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 3105 of file dbus-handler.c.
References icd_check_signal_dbus().
int wpa_ie_push | ( | unsigned char * | ap_mac_addr, | |
unsigned char * | ap_wpa_ie, | |||
int | ap_wpa_ie_len, | |||
char * | ssid, | |||
int | ssid_len, | |||
unsigned int | authentication_type | |||
) |
WPA IE D-BUS push.
ap_mac_addr | Access point MAC address. | |
ap_wpa_ie | Pointer to access point WPA IE. | |
ap_wpa_ie_len | Access point WPA IE length. | |
authentication_type | authentication type. |
Definition at line 2882 of file dbus-handler.c.
References wpa_ie_push_cb().
Referenced by associate().
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 2939 of file dbus-handler.c.
Referenced by handle_mic_failure().