ICd2 D-Bus API implementation
[ICd internal functions]


Classes

struct  icd_dbus_api_listeners
struct  icd_dbus_api_scan_helper
struct  icd_dbus_api_foreach_data
struct  icd_dbus_api_statistics_data
struct  icd_dbus_api_addrinfo_data

Typedefs

typedef gboolean(*) icd_dbus_api_foreach_send_fn (struct icd_iap *iap, struct icd_dbus_api_foreach_data *foreach_data)

Functions

static void icd_dbus_api_scan_result (enum icd_scan_status status, const struct icd_scan_srv_provider *srv_provider, const struct icd_scan_cache *cache_entry, gpointer user_data)
static gboolean icd_dbus_api_scan_append (gchar *network_type, struct icd_dbus_api_scan_helper *scan_start)
static gboolean icd_dbus_api_scan_all_types (struct icd_network_module *module, gpointer user_data)
static gboolean icd_dbus_api_scan_sender_exists (GSList *sender_list, const gchar *sender)
static struct icd_dbus_api_listeners ** icd_dbus_api_listeners_get (void)
static DBusHandlerResult icd_dbus_api_scan_req (DBusConnection *conn, DBusMessage *msg, void *user_data)
static DBusHandlerResult icd_dbus_api_scan_cancel (DBusConnection *conn, DBusMessage *msg, void *user_data)
static gboolean icd_dbus_api_send_connect_sig (enum icd_connect_status status, const gchar *sender, struct icd_iap *iap)
void icd_dbus_api_send_ack (GSList *tracklist, struct icd_iap *iap)
void icd_dbus_api_send_nack (GSList *tracklist, struct icd_iap *iap)
static DBusHandlerResult icd_dbus_api_connect_req (DBusConnection *conn, DBusMessage *msg, void *user_data)
static DBusHandlerResult icd_dbus_api_select_req (DBusConnection *conn, DBusMessage *msg, void *user_data)
static gboolean icd_dbus_api_disconnect_last (struct icd_iap *iap, gpointer user_data)
static DBusHandlerResult icd_dbus_api_disconnect_req (DBusConnection *conn, DBusMessage *msg, void *user_data)
gboolean icd_dbus_api_update_state (struct icd_iap *iap, const gchar *destination, const enum icd_connection_state state)
gboolean icd_dbus_api_update_search (const gchar *network_type, const gchar *destination, const enum icd_connection_state state)
static gboolean icd_dbus_api_foreach_iap_all (struct icd_iap *iap, gpointer user_data)
static gboolean icd_dbus_api_foreach_iap_req (struct DBusMessage *msg, struct icd_dbus_api_foreach_data *foreach_data)
static enum icd_connection_state icd_dbus_api_state_get (struct icd_iap *iap)
static gboolean icd_dbus_api_state_send (struct icd_iap *iap, struct icd_dbus_api_foreach_data *foreach_data)
static gboolean icd_dbus_api_state_scan_send (const gchar *network_type, struct icd_dbus_api_foreach_data *foreach_data)
static gboolean icd_dbus_api_state_scanning (struct icd_network_module *module, gpointer user_data)
static DBusHandlerResult icd_dbus_api_state_req (DBusConnection *conn, DBusMessage *msg, void *user_data)
static void icd_dbus_api_statistics_data_free (struct icd_dbus_api_statistics_data *stats)
static void icd_dbus_api_statistics_ip_cb (const gpointer ip_stats_cb_token, const gchar *network_type, const guint network_attrs, const gchar *network_id, guint time_active, guint rx_bytes, guint tx_bytes)
static void icd_dbus_api_statistics_link_post_cb (const gpointer link_post_stats_cb_token, const gchar *network_type, const guint network_attrs, const gchar *network_id, guint time_active, guint rx_bytes, guint tx_bytes)
static void icd_dbus_api_statistics_link_cb (const gpointer link_stats_cb_token, const gchar *network_type, const guint network_attrs, const gchar *network_id, guint time_active, gint signal, gchar *station_id, gint dB, guint rx_bytes, guint tx_bytes)
static gboolean icd_dbus_api_statistics_send (struct icd_iap *iap, struct icd_dbus_api_foreach_data *foreach_data)
static DBusHandlerResult icd_dbus_api_statistics_req (DBusConnection *conn, DBusMessage *msg, void *user_data)
static void icd_dbus_api_addrinfo_cb (const gpointer addr_info_cb_token, const gchar *network_type, const guint network_attrs, const gchar *network_id, gchar *ip_address, gchar *ip_netmask, gchar *ip_gateway, gchar *ip_dns1, gchar *ip_dns2, gchar *ip_dns3)
static gboolean icd_dbus_api_addrinfo_send (struct icd_iap *iap, struct icd_dbus_api_foreach_data *foreach_data)
static DBusHandlerResult icd_dbus_api_addrinfo_req (DBusConnection *conn, DBusMessage *msg, void *user_data)
static DBusObjectPathMessageFunction icd_dbus_api_find_handler (DBusMessage *message, struct icd_dbus_mcall_table *table)
static DBusHandlerResult icd_dbus_api_request (DBusConnection *connection, DBusMessage *message, void *user_data)
gboolean icd_dbus_api_app_exit (const gchar *dbus_dest)
void icd_dbus_api_deinit (void)
gboolean icd_dbus_api_init (void)

Variables

icd_dbus_mcall_table icd_dbus_api_mcalls []
icd_dbus_sig_table icd_dbus_api_signals []

Typedef Documentation

typedef gboolean(*) icd_dbus_api_foreach_send_fn(struct icd_iap *iap, struct icd_dbus_api_foreach_data *foreach_data)

Template for the D-Bus data sending function

Parameters:
iap the IAP
foreach_data foreach data structure
Returns:
TRUE on success, FALSE on error


Function Documentation

static void icd_dbus_api_addrinfo_cb ( const gpointer  addr_info_cb_token,
const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id,
gchar *  ip_address,
gchar *  ip_netmask,
gchar *  ip_gateway,
gchar *  ip_dns1,
gchar *  ip_dns2,
gchar *  ip_dns3 
) [static]

Receive IP address configuration information based on network type, attributes and id.

Parameters:
addr_info_cb_token token passed to the request function
network_type network type
network_attrs attributes, such as type of network_id, security, etc.
network_id IAP name or local id, e.g. SSID
private a reference to the icd_nw_api private memeber
ip_address IP address string or NULL if no such value
ip_netmask IP netmask string which or NULL if no such value
ip_gateway IP gateway string which or NULL if no such value
ip_dns1 DNS server IP address string or NULL if no such value
ip_dns2 DNS server IP address string or NULL if no such value
ip_dns3 DNS server IP address string or NULL if no such value
Returns:
TRUE if some of the values are returned, FALSE if no values assigned

static DBusHandlerResult icd_dbus_api_addrinfo_req ( DBusConnection *  conn,
DBusMessage *  msg,
void *  user_data 
) [static]

Handle addrinfo requests

Parameters:
conn D-Bus connection
msg D-Bus message
user_data dbus client data

static gboolean icd_dbus_api_addrinfo_send ( struct icd_iap iap,
struct icd_dbus_api_foreach_data foreach_data 
) [static]

Function for sending address info data to listeners

Parameters:
iap the IAP
foreach_data foreach data structure
Returns:
TRUE on successful signal sending, FALSE on error

gboolean icd_dbus_api_app_exit ( const gchar *  dbus_dest  ) 

Notify ICd2 D-Bus API when an app goes away

Parameters:
dbus_dest D-Bus sender id
TRUE if D-Bus sender was removed, FALSE otherwise

static DBusHandlerResult icd_dbus_api_connect_req ( DBusConnection *  conn,
DBusMessage *  msg,
void *  user_data 
) [static]

Handle connect requests

Parameters:
conn D-Bus connection
msg D-Bus message
user_data dbus client data

Todo:
OSSO_IAP_ASK merging should be done somewhere else

void icd_dbus_api_deinit ( void   ) 

Unregister ICD2_DBUS_API

static gboolean icd_dbus_api_disconnect_last ( struct icd_iap iap,
gpointer  user_data 
) [static]

Stop iterating at the first IAP

Parameters:
iap the IAP struct
user_data user data
Returns:
FALSE

static DBusHandlerResult icd_dbus_api_disconnect_req ( DBusConnection *  conn,
DBusMessage *  msg,
void *  user_data 
) [static]

Handle disconnect requests

Parameters:
conn D-Bus connection
msg D-Bus message
user_data dbus client data

static DBusObjectPathMessageFunction icd_dbus_api_find_handler ( DBusMessage *  message,
struct icd_dbus_mcall_table table 
) [static]

Find the handler function for the method call

Parameters:
message D-Bus message
table method call table
Returns:
function that handles this method call or NULL

static gboolean icd_dbus_api_foreach_iap_all ( struct icd_iap iap,
gpointer  user_data 
) [static]

Iterator function calling the given send function

Parameters:
iap the IAP
user_data foreach data
TRUE to go through all IAPs

gboolean icd_dbus_api_init ( void   ) 

Register ICD2_DBUS_API

Returns:
TRUE on success, FALSE on failure

static struct icd_dbus_api_listeners** icd_dbus_api_listeners_get ( void   )  [static]

Get the dbus api data structure

Returns:
the dbus api data structure

static DBusHandlerResult icd_dbus_api_request ( DBusConnection *  connection,
DBusMessage *  message,
void *  user_data 
) [static]

Receive registered method calls and find a handler for them

Parameters:
connection D-Bus connection
message D-Bus message
user_data dbus api data structure

static gboolean icd_dbus_api_scan_all_types ( struct icd_network_module module,
gpointer  user_data 
) [static]

Start scan for each each given network module

Parameters:
module network module
user_data scan helper structure

static gboolean icd_dbus_api_scan_append ( gchar *  network_type,
struct icd_dbus_api_scan_helper scan_start 
) [static]

Append a the network type of the successfully started network scan to the iterator position

Parameters:
network_type network type to start scan for
str_iter scan helper structure
Returns:
TRUE on success, FALSE if the scan was not started

Todo:
UI designer does not want to have the "scanning" icon blinking in this case

static DBusHandlerResult icd_dbus_api_scan_cancel ( DBusConnection *  conn,
DBusMessage *  msg,
void *  user_data 
) [static]

Handle cancelling of scans

Parameters:
conn D-Bus connection
msg D-Bus message
user_data not used

static DBusHandlerResult icd_dbus_api_scan_req ( DBusConnection *  conn,
DBusMessage *  msg,
void *  user_data 
) [static]

Handle scan requests

Parameters:
conn D-Bus connection
msg D-Bus message
user_data dbus client data

static void icd_dbus_api_scan_result ( enum icd_scan_status  status,
const struct icd_scan_srv_provider srv_provider,
const struct icd_scan_cache cache_entry,
gpointer  user_data 
) [static]

Receive scan results and send them via D-Bus

Parameters:
status status of this network
srv_provider service provider entry; guaranteed to exist only for the lifetime of this callback function
cache_entry scan results; guaranteed to exist only for the lifetime of this callback function
user_data D-Bus app that requested the scan

static gboolean icd_dbus_api_scan_sender_exists ( GSList *  sender_list,
const gchar *  sender 
) [static]

Check wheter a sender already exists in the sender list

Parameters:
sender_list list to examine
sender sender to look for
Returns:
TRUE if found, FALSE otherwise

static DBusHandlerResult icd_dbus_api_select_req ( DBusConnection *  conn,
DBusMessage *  msg,
void *  user_data 
) [static]

Handle select connection requests

Parameters:
conn D-Bus connection
msg D-Bus message
user_data dbus client data

void icd_dbus_api_send_ack ( GSList *  tracklist,
struct icd_iap iap 
)

Send an ACK on successful connection creation to D-Bus applications

Parameters:
tracklist the list of tracked applications
iap IAP that got connected

static gboolean icd_dbus_api_send_connect_sig ( enum icd_connect_status  status,
const gchar *  sender,
struct icd_iap iap 
) [static]

Create and send an (N)ACK to a listener

Parameters:
status status
sender D-Bus sender id
iap IAP in question or NULL if none
Returns:
TRUE if signal is sent, FALSE otherwise

void icd_dbus_api_send_nack ( GSList *  tracklist,
struct icd_iap iap 
)

Send a NACK on disconnect or unsuccessful connection creation to D-Bus applications; free tracking info

Parameters:
tracklist the list of tracked applications
iap if non-NULL send ICD_CONNECTION_DISCONNECTED; if NULL send ICD_CONNECTION_NOT_CONNECTED

static enum icd_connection_state icd_dbus_api_state_get ( struct icd_iap iap  )  [static]

Get the state sent to D-Bus applications as a function of the IAP state

Parameters:
iap the IAP
Returns:
the state to send to the D-Bus application although not yet those marked *_INTERNAL_*

static DBusHandlerResult icd_dbus_api_state_req ( DBusConnection *  conn,
DBusMessage *  msg,
void *  user_data 
) [static]

Handle state requests

Parameters:
conn D-Bus connection
msg D-Bus message
user_data dbus client data

static gboolean icd_dbus_api_state_scan_send ( const gchar *  network_type,
struct icd_dbus_api_foreach_data foreach_data 
) [static]

Send network scan status

Parameters:
network_type network type
foreach_data foreach data structure

static gboolean icd_dbus_api_state_scanning ( struct icd_network_module module,
gpointer  user_data 
) [static]

Network module callback function for scanning status

Parameters:
module the network module
user_data foreach data structure
Returns:
TRUE

static gboolean icd_dbus_api_state_send ( struct icd_iap iap,
struct icd_dbus_api_foreach_data foreach_data 
) [static]

Function for sending state data to listeners

Parameters:
iap the IAP
foreach_data foreach data structure
Returns:
TRUE on successful signal sending, FALSE on error

static void icd_dbus_api_statistics_data_free ( struct icd_dbus_api_statistics_data stats  )  [static]

Free a statistics data structure

Parameters:
stats the statistics data structure

static void icd_dbus_api_statistics_ip_cb ( const gpointer  ip_stats_cb_token,
const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id,
guint  time_active,
guint  rx_bytes,
guint  tx_bytes 
) [static]

Receive ip statistics based on network type, attributes and id. Values are set to zero or NULL if statistics are not available or applicable

Parameters:
ip_stats_cb_token token passed to the request function
network_type network type
network_attrs attributes, such as type of network_id, security, etc.
network_id network id
time_active time active, if applicable
signal signal level
station_id base station id, e.g. WLAN access point MAC address
dB raw signal strength; depends on the type of network
rx_bytes bytes received on the link, if applicable
tx_bytes bytes sent on the link, if applicable
private a reference to the icd_nw_api private memeber

static void icd_dbus_api_statistics_link_cb ( const gpointer  link_stats_cb_token,
const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id,
guint  time_active,
gint  signal,
gchar *  station_id,
gint  dB,
guint  rx_bytes,
guint  tx_bytes 
) [static]

Receive link statistics based on network type, attributes and id. Values are set to zero or NULL if statistics are not available or applicable

Parameters:
link_stats_cb_token token passed to the request function
network_type network type
network_attrs attributes, such as type of network_id, security, etc.
network_id network id
time_active time active, if applicable
signal signal level
station_id base station id, e.g. WLAN access point MAC address
dB raw signal strength; depends on the type of network
rx_bytes bytes received on the link, if applicable
tx_bytes bytes sent on the link, if applicable
private a reference to the icd_nw_api private memeber

static void icd_dbus_api_statistics_link_post_cb ( const gpointer  link_post_stats_cb_token,
const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id,
guint  time_active,
guint  rx_bytes,
guint  tx_bytes 
) [static]

Receive link post up statistics based on network type, attributes and id. Values are set to zero or NULL if statistics are not available or applicable

Parameters:
link_post_stats_cb_token token passed to the request function
network_type network type
network_attrs attributes, such as type of network_id, security, etc.
network_id network id
time_active time active, if applicable
rx_bytes bytes received on the link, if applicable
tx_bytes bytes sent on the link, if applicable
private a reference to the icd_nw_api private memeber

static DBusHandlerResult icd_dbus_api_statistics_req ( DBusConnection *  conn,
DBusMessage *  msg,
void *  user_data 
) [static]

Handle statistics requests

Parameters:
conn D-Bus connection
msg D-Bus message
user_data dbus client data

static gboolean icd_dbus_api_statistics_send ( struct icd_iap iap,
struct icd_dbus_api_foreach_data foreach_data 
) [static]

Function for sending statistics data to listeners

Parameters:
iap the IAP
foreach_data foreach data structure
Returns:
TRUE on successful signal sending, FALSE on error

gboolean icd_dbus_api_update_search ( const gchar *  network_type,
const gchar *  destination,
const enum icd_connection_state  state 
)

Send network type search start/stop

Parameters:
iap the network type
destination D-Bus destination or NULL if broadcasted to all
state the state to send

gboolean icd_dbus_api_update_state ( struct icd_iap iap,
const gchar *  destination,
const enum icd_connection_state  state 
)

Send IAP state change signal

Parameters:
iap the IAP or NULL if no state
destination D-Bus destination or NULL if broadcasted to all
state the state to send


Variable Documentation

struct icd_dbus_mcall_table icd_dbus_api_mcalls[]

Initial value:

 {
  {ICD_DBUS_API_SCAN_REQ, "u", "as", icd_dbus_api_scan_req},
  {ICD_DBUS_API_SCAN_REQ, "uas", "as", icd_dbus_api_scan_req},
  {ICD_DBUS_API_SCAN_CANCEL, "", "", icd_dbus_api_scan_cancel},
  {ICD_DBUS_API_CONNECT_REQ, "u", "", icd_dbus_api_connect_req},
  {ICD_DBUS_API_CONNECT_REQ, "ua(sussuay)", "", icd_dbus_api_connect_req},
  {ICD_DBUS_API_SELECT_REQ, "u", "", icd_dbus_api_select_req},
  {ICD_DBUS_API_DISCONNECT_REQ, "usussuay", "", icd_dbus_api_disconnect_req},
  {ICD_DBUS_API_DISCONNECT_REQ, "u", "", icd_dbus_api_disconnect_req},
  {ICD_DBUS_API_STATE_REQ, "sussus", "u", icd_dbus_api_state_req},
  {ICD_DBUS_API_STATE_REQ, "", "u", icd_dbus_api_state_req},
  {ICD_DBUS_API_STATISTICS_REQ, "sussus", "u", icd_dbus_api_statistics_req},
  {ICD_DBUS_API_STATISTICS_REQ, "", "u", icd_dbus_api_statistics_req},
  {ICD_DBUS_API_ADDRINFO_REQ, "sussus", "u", icd_dbus_api_addrinfo_req},
  {ICD_DBUS_API_ADDRINFO_REQ, "", "u", icd_dbus_api_addrinfo_req},

  {NULL}
}
method calls provided

struct icd_dbus_sig_table icd_dbus_api_signals[]

Initial value:

 {
  {ICD_DBUS_API_SCAN_SIG, "uussusissuayiisi"},
  {ICD_DBUS_API_CONNECT_SIG, "sussuayu"},
  {ICD_DBUS_API_STATE_SIG, "sussuaysu"},
  {ICD_DBUS_API_STATE_SIG, "u"},
  {ICD_DBUS_API_STATE_SIG, "su"},
  {ICD_DBUS_API_STATISTICS_SIG, "sussuayuiuu"},
  {ICD_DBUS_API_ADDRINFO_SIG, "sussuaya(sssssss)"},

  {NULL}
}
signals sent


Generated on Tue Feb 24 16:21:36 2009 for ICd2 by  doxygen 1.5.1