Data Structures | Defines | Typedefs | Functions | Variables

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 <libnetfilter_log/libnetfilter_log.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 "wapi.h"
#include <dbus/dbus.h>
Include dependency graph for dbus-signal.c:

Go to the source code of this file.

Data Structures

struct  rt_link_mode

Defines

#define DBUS_API_SUBJECT_TO_CHANGE
#define NFLOG_PACKET_SIZE   512
#define WLAN_IPTABLES   "/etc/network/wlan_iptables.sh"
#define ENABLE_IPTABLES   "/proc/net/nf_condition/enable_throughput"

Typedefs

typedef struct rt_link_mode rt_link_mode

Functions

void print_mac (guint priority, const char *message, guchar *mac)
void clean_scan_results_item (gpointer data, gpointer user_data)
void clean_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)
void connected_signal (char *bssid)
gboolean roam_scanning (void)
gboolean is_connected_state (void)
static void handle_message (struct nlmsghdr *hdr)
static void handle_netlink_event (int fd)
static int init_wi (struct sockaddr_nl *rth)
static gboolean _monitor_cb (GIOChannel *chan, GIOCondition cond, gpointer data)
static gboolean _monitor_nflog_cb (GIOChannel *chan, GIOCondition cond, gpointer data)
static int nflog_cb (struct nflog_g_handle *gh, struct nfgenmsg *nfmsg, struct nflog_data *nfa, void *data)
static int init_nflog (void)
static void set_iptables_state (unsigned int state)
void remove_iptables (void)
int set_iptables (void)
gboolean monitor_wi (void)
int netlink_send_linkmode (int lmode)
static void monitor_full_ps_cb (ConnSettingsType type, const char *id, const char *key, ConnSettingsValue *value, void *user_data)
gboolean monitor_iap_keys ()

Variables

struct wlan_status_t wlan_status
static int netlink_socket = -1
static struct nflog_handle * nf_handle

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-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 private pointer.
Returns:
status.

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

References handle_netlink_event().

Referenced by monitor_wi().

Here is the call graph for this function:

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

Callback function for NFLOG events.

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

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

References nf_handle.

Referenced by init_nflog().

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 99 of file dbus-signal.c.

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

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:

void disconnected_signal ( void   ) 

Send disconnected signal.

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

References wlan_status.

Referenced by handle_netlink_wap_event(), and set_wlan_state().

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 279 of file dbus-signal.c.

References clean_dbus_handler(), is_connected_state(), run_calibration(), set_wlan_state(), and wlan_status.

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 347 of file dbus-signal.c.

References handle_message().

Referenced by _monitor_cb().

Here is the call graph for this function:

static int init_nflog ( void   )  [static]

Starts monitoring of NFLOG events.

Returns:
status.

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

References _monitor_nflog_cb(), and nf_handle.

Referenced by monitor_wi().

Here is the call graph for this function:

static int init_wi ( struct sockaddr_nl *  rth  )  [static]

Initialize wireless interface

Parameters:
rth private struct.
Returns:
status.

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

References netlink_socket.

Referenced by monitor_wi().

gboolean is_connected_state ( void   ) 

Get connected state.

Returns:
TRUE if connected, FALSE otherwise.

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

References get_wlan_state().

Referenced by handle_message(), handle_netlink_wap_event(), and mode_change().

Here is the call graph for this function:

static void monitor_full_ps_cb ( ConnSettingsType  type,
const char *  id,
const char *  key,
ConnSettingsValue *  value,
void *  user_data 
) [static]

Callback function for power save flag change.

Parameters:
type notifying GConfClient.
id connection id.
key GConfEntry.
value ConnSettingsValue.
userData user data for call back.

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

References set_power_state(), and wlan_status.

Referenced by monitor_iap_keys().

Here is the call graph for this function:

gboolean monitor_iap_keys ( void   ) 

Starts monitoring the power save flag change.

Returns:
status.

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

References get_setting_bool(), monitor_full_ps_cb(), and wlan_status.

Referenced by main().

Here is the call graph for this function:

gboolean monitor_wi ( void   ) 

Starts monitoring of wireless events.

Returns:
status.

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

References _monitor_cb(), init_nflog(), init_wi(), and netlink_socket.

Referenced by main().

Here is the call graph for this function:

int netlink_send_linkmode ( int  lmode  ) 

Sends the link mode signal to the kernel.

Parameters:
lmode mode status.
Returns:
status.

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

References netlink_socket, and wlan_status.

Referenced by associate(), eap_check_signal_dbus(), and handle_netlink_wap_event().

void remove_iptables ( void   ) 

Set iptables inactive.

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

References set_iptables_state().

Referenced by set_wlan_state().

Here is the call graph for this function:

gboolean roam_scanning ( void   ) 

Check if we have scanned in last WLANCOND_MIN_ROAM_SCAN_INTERVAL.

Returns:
TRUE if we have scanned, FALSE otherwise.

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

References wlan_status.

Referenced by process_cqm_event().

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.
number_of_results number of scan results.

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

Referenced by ask_scan_results(), and set_scan_state().

int set_iptables ( void   ) 

Load iptables and set them active.

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

References set_iptables_state(), and wlan_status.

Referenced by handle_netlink_wap_event().

Here is the call graph for this function:

static void set_iptables_state ( unsigned int  state  )  [static]

Set IPTABLES state.

Parameters:
state New state.

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

References wlan_status.

Referenced by remove_iptables(), and set_iptables().


Variable Documentation

int netlink_socket = -1 [static]

Netlink socket is global

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

Referenced by init_wi(), monitor_wi(), and netlink_send_linkmode().

struct nflog_handle* nf_handle [static]

NFLOG handle

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

Referenced by _monitor_nflog_cb(), and init_nflog().

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