dbus-signal.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/types.h>
#include <wlancond-dbus.h>
#include <eap-dbus.h>
#include "common.h"
#include "daemon.h"
#include "dbus.h"
#include "dbus-handler.h"
#include "log.h"
#include "dbus-helper.h"
#include "wpa.h"
#include <dbus/dbus.h>

Include dependency graph for dbus-signal.c:

Go to the source code of this file.

Data Structures

struct  rtnl_handle

Defines

#define DBUS_API_SUBJECT_TO_CHANGE

Functions

static void handle_custom_event (char *event_pointer, int len, struct scan_results_t *scan_results)
static int handle_wpa_ie_event_binary (unsigned char *p, unsigned int length, struct scan_results_t *scan_results)
void print_mac (const char *message, guchar *mac)
void clean_scan_results_item (gpointer data, gpointer user_data)
void clean_scan_results (GSList **scan_results_save)
GSList * save_scan_results (struct scan_results_t *scan_results, GSList *scan_results_save)
void send_dbus_scan_results (GSList *scan_results_save, const char *sender, dbus_int32_t number_of_results)
void disconnected_signal (void)
static void connected_signal (char *bssid, dbus_int32_t auth_status)
static void handle_wap_event (struct scan_results_t *scan_results, struct iw_event *event, gboolean scan_event)
int print_event_token (struct iw_event *event, struct scan_results_t *scan_results, int ifindex, gboolean scan_event)
static void save_caps (struct scan_results_t *scan_results, struct ap_info_t *ap_info, unsigned char *p, unsigned int length)
static int index2name (int skfd, int ifindex, char *name)
wireless_ifaceget_interface_data (int ifindex)
static int print_event_stream (int ifindex, char *data, int len)
void del_all_interface_data (void)
static void del_interface_data (int ifindex)
static void handle_message (struct nlmsghdr *hdr)
static void handle_netlink_event (int fd)
static int init_wi (struct rtnl_handle *rth)
static gboolean _monitor_cb (GIOChannel *chan, GIOCondition cond, gpointer data)
gboolean monitor_wi (void)

Variables

static struct wireless_ifaceinterface_cache = NULL
wlan_status_t wlan_status


Detailed Description

Copyright (C) 2004-2008 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-signal.c.


Function Documentation

static gboolean _monitor_cb ( GIOChannel *  chan,
GIOCondition  cond,
gpointer  data 
) [static]

Callback function for wireless events.

Parameters:
chan GLIB IO Channel
cond GLIB IO condition
data privat pointer.
Returns:
status.

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

References handle_netlink_event().

Referenced by monitor_wi().

Here is the call graph for this function:

void clean_scan_results ( GSList **  scan_results_save  ) 

Remove saved scan results.

Parameters:
scan_results_save structure where scan results are saved.

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

References clean_scan_results_item().

Referenced by ask_scan_results(), clean_roam_cache(), connect_from_scan_results(), and settings_and_connect_request().

Here is the call graph for this function:

static void connected_signal ( char *  bssid,
dbus_int32_t  auth_status 
) [static]

Send connected signal.

Parameters:
scan_results Scan results to be sent.
auth_status Authentication status.

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

References wlan_status_t::ifname, and wlan_status.

Referenced by handle_wap_event().

void del_all_interface_data ( void   ) 

Deletes all interface data

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

References interface_cache, and wireless_iface::next.

Referenced by clean_data().

static void del_interface_data ( int  ifindex  )  [static]

Delete one interface from the list

Parameters:
ifindex Interface index.

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

References wireless_iface::ifindex, interface_cache, and wireless_iface::next.

Referenced by handle_message().

void disconnected_signal ( void   ) 

Send disconnected signal.

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

References wlan_status_t::ifname, and wlan_status.

Referenced by set_wlan_state().

struct wireless_iface* get_interface_data ( int  ifindex  ) 

Get interface data from cache or live interface.

Parameters:
ifindex Interface index.
Returns:
wireless_iface The wireless interface.

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

References wireless_iface::has_range, wireless_iface::ifindex, wireless_iface::ifname, index2name(), interface_cache, wireless_iface::next, wireless_iface::range, and socket_open().

Referenced by print_event_stream(), and scan_results_ioctl().

Here is the call graph for this function:

static void handle_custom_event ( char *  event_pointer,
int  length,
struct scan_results_t scan_results 
) [static]

Handle custom event.

Parameters:
event_pointer pointer to custom event.
length custom event length.
scan_results pointer to scan results struct.

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

References connect_params_t::bssid, wlan_status_t::conn, get_wlan_state(), handle_mic_failure(), scan(), set_wlan_signal(), connect_params_t::ssid, connect_params_t::ssid_len, wlan_status, WLANCOND_HIGH, and WLANCOND_LOW.

Referenced by print_event_token().

Here is the call graph for this function:

static void handle_message ( struct nlmsghdr *  hdr  )  [static]

Netlink event handling continues, now we know that we have a message

Parameters:
hdr Pointer to message header.

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

References del_interface_data(), and print_event_stream().

Referenced by handle_netlink_event().

Here is the call graph for this function:

static void handle_netlink_event ( int  fd  )  [static]

Start netlink event handling

Parameters:
fd File descriptor.

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

References handle_message().

Referenced by _monitor_cb().

Here is the call graph for this function:

static void handle_wap_event ( struct scan_results_t scan_results,
struct iw_event *  event,
gboolean  scan_event 
) [static]

Handle WAP wireless event.

Parameters:
event extracted token.
scan_results structure where scan results are saved.
Returns:
status.

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

References associate_supplicant(), connect_params_t::authentication_type, connect_params_t::bssid, scan_results_t::bssid, clear_wpa_keys(), wlan_status_t::conn, connected_signal(), decrease_signal_in_roam_cache(), disassociate_eap(), DISCONNECTED_SIGNAL, find_connection_and_associate(), get_encryption_info(), get_scan_state(), get_wlan_state(), get_wpa_mode(), NO_SIGNAL, NULL_BSSID, print_mac(), remove_connect_timer(), wlan_status_t::retry_count, wlan_status_t::roam_cache, scan(), set_bssid(), set_wlan_signal(), set_wlan_state(), connect_params_t::ssid, connect_params_t::ssid_len, wlan_status, and WLANCOND_HIGH.

Referenced by print_event_token().

Here is the call graph for this function:

static int handle_wpa_ie_event_binary ( unsigned char *  p,
unsigned int  length,
struct scan_results_t scan_results 
) [static]

WPA Information element event binary.

Parameters:
p Pointer to event buffer.
length Event buffer length.
scan_results Pointer to scan results structure.

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

References scan_results_t::cap_bits, handle_wps_ie(), parse_rsn_ie(), parse_wpa_ie(), RSN_ELEMENT, save_caps(), and WPA_ELEMENT.

Referenced by print_event_token().

Here is the call graph for this function:

static int index2name ( int  skfd,
int  ifindex,
char *  name 
) [inline, static]

Get name of interface based on interface index.

Parameters:
skfd Socket.
ifindex Interface index.
name Interface name.
Returns:
status.

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

Referenced by get_interface_data().

static int init_wi ( struct rtnl_handle rth  )  [static]

Initialize wireless interface

Parameters:
rth private struct.
Returns:
status.

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

References rtnl_handle::fd, and rtnl_handle::local.

Referenced by monitor_wi().

gboolean monitor_wi ( void   ) 

Starts monitoring of wireless events.

Returns:
status.

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

References _monitor_cb(), rtnl_handle::fd, and init_wi().

Referenced by main().

Here is the call graph for this function:

static int print_event_stream ( int  ifindex,
char *  data,
int  len 
) [static]

Event handling.

Parameters:
ifindex Interface index.
data Data.
len Data length.
Returns:
status.

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

References get_interface_data(), print_event_token(), and wireless_iface::range.

Referenced by handle_message().

Here is the call graph for this function:

int print_event_token ( struct iw_event *  event,
struct scan_results_t scan_results,
int  ifindex,
gboolean  scan_event 
)

Print or save wireless events.

Parameters:
event extracted token.
scan_results structure where scan results are saved.
ifindex Interface index.
Returns:
status.

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

References ask_scan_results(), scan_results_t::cap_bits, scan_results_t::channel, DISCONNECTED_SIGNAL, get_scan_state(), handle_custom_event(), handle_wap_event(), handle_wpa_ie_event_binary(), remove_scan_timer(), scan_results_t::rssi, set_wlan_state(), scan_results_t::ssid, and scan_results_t::ssid_len.

Referenced by print_event_stream(), and scan_results_ioctl().

Here is the call graph for this function:

static void save_caps ( struct scan_results_t scan_results,
struct ap_info_t ap_info,
unsigned char *  p,
unsigned int  length 
) [static]

Save WPA capabilities and print them to log.

Parameters:
scan_results Pointer to scan results structure.
ap_info Pointer to AP information structure.
p Pointer to event buffer.
length Event buffer length.

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

References scan_results_t::cap_bits, ap_info_t::group_cipher, ap_info_t::key_mgmt, ap_info_t::pairwise_cipher, WPA_802_1X, scan_results_t::wpa_ie, scan_results_t::wpa_ie_len, and WPA_PSK.

Referenced by handle_wpa_ie_event_binary().

GSList* save_scan_results ( struct scan_results_t scan_results,
GSList *  scan_results_save 
)

Save scan results to list.

Parameters:
scan_results structure where scan results are.
scan_results_save structure where scan results are saved.

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

Referenced by scan_results_ioctl().

void send_dbus_scan_results ( GSList *  scan_results_save,
const char *  sender,
dbus_int32_t  number_of_results 
)

Send scan results to DBUS.

Parameters:
scan_results_save structure where scan results are saved.
sender The message is sent to this entity.

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

References WLANCOND_MAX_NETWORKS.

Referenced by ask_scan_results(), and set_scan_state().


Generated on Sat Dec 6 22:17:28 2008 for WLAN Connection Daemon by  doxygen 1.5.1