ICd network API handling
[ICd internal functions]


Classes

struct  pid_notify
struct  icd_network_module

Defines

#define ICD_NW_API_PREFIX   "libicd_network_"
#define ICD_NW_INIT   "icd_nw_init"

Typedefs

typedef gboolean(* icd_network_api_foreach_module_fn )(struct icd_network_module *module, gpointer user_data)

Functions

static struct icd_network_moduleicd_network_api_find_module (gchar *module_name)
gboolean icd_network_api_has_type (struct icd_network_module *module, const gchar *type)
struct icd_network_moduleicd_network_api_foreach_module (struct icd_context *icd_ctx, icd_network_api_foreach_module_fn foreach_fn, gpointer user_data)
static gboolean icd_network_api_foreach_module_pid (struct icd_network_module *module, gpointer user_data)
gboolean icd_network_api_notify_pid (struct icd_context *icd_ctx, const pid_t pid, const gint exit_value)
static void icd_network_api_watch_pid (const pid_t pid, gpointer watch_cb_token)
static void icd_network_api_close (enum icd_nw_status status, const gchar *err_str, const gchar *network_type, const guint network_attrs, const gchar *network_id)
static void icd_network_api_renew (enum icd_nw_layer renew_layer, const gchar *network_type, const guint network_attrs, const gchar *network_id)
static void icd_network_api_status_update (gchar *network_type, guint network_attrs, gchar *network_id)
static gboolean icd_network_api_init_cb (const gchar *module_name, void *handle, gpointer init_function, gpointer data)
gboolean icd_network_api_load_modules (struct icd_context *icd_ctx)
void icd_network_api_unload_modules (struct icd_context *icd_ctx)

Variables

const gchar * icd_iap_state_names [ICD_IAP_MAX_STATES]

Define Documentation

#define ICD_NW_API_PREFIX   "libicd_network_"

prefix for the ICd network API modules

Referenced by icd_network_api_load_modules().

#define ICD_NW_INIT   "icd_nw_init"

name of the ICd network API init function

Referenced by icd_network_api_load_modules().


Typedef Documentation

typedef gboolean(* icd_network_api_foreach_module_fn)(struct icd_network_module *module, gpointer user_data)

Network api callback for going through every network module

Parameters:
module the network module
user_data user data passed to icd_network_api_foreach_module
Returns:
if TRUE the callback will be called again with the next module; if FALSE iteration is stopped


Function Documentation

static void icd_network_api_close ( enum icd_nw_status  status,
const gchar *  err_str,
const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id 
) [static]

Function for closing down a connection by request of a network module

Parameters:
status reason for closing; ICD_NW_RESTART if the IAP needs to be restarted, success or error will both close the network connection
err_str NULL if the network was disconnected normally or any ICD_DBUS_ERROR_* from osso-ic-dbus.h on error
network_type the type of the IAP returned
network_attrs attributes, such as type of network_id, security, etc.
network_id IAP name or local id, e.g. SSID

References icd_iap_disconnect(), icd_iap_find(), icd_iap_restart(), ICD_IAP_STATE_CONNECTED_DOWN, ICD_IAP_STATE_IP_DOWN, ICD_IAP_STATE_IP_RESTART_SCRIPTS, ICD_IAP_STATE_LINK_DOWN, ICD_IAP_STATE_LINK_PRE_DOWN, ICD_IAP_STATE_LINK_PRE_RESTART_SCRIPTS, ICD_IAP_STATE_LINK_RESTART_SCRIPTS, icd_iap_state_names, ICD_IAP_STATE_SCRIPT_POST_DOWN, ICD_IAP_STATE_SRV_DOWN, ICD_NW_ERROR, ICD_NW_LAYER_ALL, ICD_NW_LAYER_IP, ICD_NW_LAYER_LINK, ICD_NW_LAYER_LINK_POST, ICD_NW_RESTART, ICD_NW_RESTART_IP, ICD_NW_RESTART_LINK, ICD_NW_RESTART_LINK_POST, icd_status_disconnect(), ILOG_INFO, ILOG_WARN, and icd_iap::state.

Referenced by icd_network_api_init_cb().

static struct icd_network_module* icd_network_api_find_module ( gchar *  module_name  )  [static, read]

Find a network module by its name

Parameters:
module_name module name
Returns:
the module structure or NULL if not found

References icd_context_get(), icd_ctx, icd_network_module::name, and icd_context::nw_module_list.

Referenced by icd_network_api_load_modules().

struct icd_network_module * icd_network_api_foreach_module ( struct icd_context icd_ctx,
icd_network_api_foreach_module_fn  foreach_fn,
gpointer  user_data 
) [read]

Todo:
make icd_scan use the module iteration function
Iterate over all network modules
Parameters:
icd_ctx icd context
foreach_fn the function to call for each module
user_data user data to pass to the function
Returns:
a pointer to the module if the iteration function returns FALSE; NULL otherwise

References ILOG_ERR, ILOG_WARN, and icd_context::nw_module_list.

Referenced by icd_dbus_api_scan_req(), icd_dbus_api_state_req(), icd_network_api_notify_pid(), and icd_scan_cache_remove_iap().

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

Find the network module that is watching a child process exit

Parameters:
module the network module to examine
user_data the pid notify structure
Returns:
TRUE to continue searching, FALSE to exit iteration and return a pointer to the module

References icd_nw_api::child_exit, pid_notify::exit_value, ILOG_INFO, ILOG_WARN, icd_network_module::name, icd_network_module::nw, pid_notify::pid, icd_network_module::pid_list, and icd_nw_api::private.

Referenced by icd_network_api_notify_pid().

gboolean icd_network_api_has_type ( struct icd_network_module module,
const gchar *  type 
)

Function for checking wheter a modules supports a given type

Parameters:
module the module
type the type to check for
Returns:
TRUE if the module supports the given type, FALSE otherwise

References icd_context_get(), icd_ctx, ILOG_CRIT, and icd_context::type_to_module.

Referenced by icd_scan_results_request().

static gboolean icd_network_api_init_cb ( const gchar *  module_name,
void *  handle,
gpointer  init_function,
gpointer  data 
) [static]

gboolean icd_network_api_load_modules ( struct icd_context icd_ctx  ) 

Load all network API modules

Parameters:
icd_ctx icd context
Returns:
the status from icd_plugin_load_all

References icd_network_api_find_module(), icd_network_api_init_cb(), icd_network_modules_get(), ICD_NW_API_PREFIX, ICD_NW_INIT, icd_plugin_load_all(), ILOG_CRIT, ILOG_DEBUG, ILOG_ERR, icd_network_module::network_types, and icd_context::type_to_module.

Referenced by main().

gboolean icd_network_api_notify_pid ( struct icd_context icd_ctx,
const pid_t  pid,
const gint  exit_value 
)

Notify a network module that its child process has exited

Parameters:
icd_ctx the context
pid the process id
exit_value exit value
Returns:
TRUE if the process id was in use by the network api; FALSE if not

References pid_notify::exit_value, icd_network_api_foreach_module(), icd_network_api_foreach_module_pid(), and pid_notify::pid.

Referenced by icd_exec_signal_cb().

static void icd_network_api_renew ( enum icd_nw_layer  renew_layer,
const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id 
) [static]

Request a network module layer to be renewed

Parameters:
renew_layer the network module layer to renew
network_type network type
network_attrs network_attrs
network_id network_id

Todo:
when saving, the dialog might try to save a name for a failed iap...

References icd_iap_find(), icd_iap_renew(), icd_iap_restart(), ICD_IAP_STATE_CONNECTED, ICD_IAP_STATE_DISCONNECTED, ICD_IAP_STATE_IP_UP, ICD_IAP_STATE_LINK_POST_UP, ICD_IAP_STATE_LINK_UP, icd_iap_state_names, ICD_IAP_STATE_SAVING, ICD_IAP_STATE_SCRIPT_POST_UP, ICD_IAP_STATE_SCRIPT_PRE_UP, ICD_IAP_STATE_SRV_UP, ICD_NW_LAYER_IP, ICD_NW_LAYER_LINK, ICD_NW_LAYER_LINK_POST, ICD_NW_LAYER_SERVICE, ILOG_DEBUG, ILOG_WARN, and icd_iap::state.

Referenced by icd_network_api_init_cb().

static void icd_network_api_status_update ( gchar *  network_type,
guint  network_attrs,
gchar *  network_id 
) [static]

Status of the network has changed while the network has been connected

Parameters:
network_type the type of the IAP returned
network_attrs attributes, such as type of network_id, security, etc.
network_id IAP name or local id, e.g. SSID

References icd_iap_find(), ICD_IAP_STATE_CONNECTED, icd_status_connected(), ILOG_INFO, ILOG_WARN, and icd_iap::state.

Referenced by icd_network_api_init_cb().

void icd_network_api_unload_modules ( struct icd_context icd_ctx  ) 

static void icd_network_api_watch_pid ( const pid_t  pid,
gpointer  watch_cb_token 
) [static]

Set ICd to watch a child pid

Parameters:
pid process id
watch_cb_token the watch callback token given on initialization

References ILOG_CRIT, ILOG_DEBUG, icd_network_module::name, and icd_network_module::pid_list.

Referenced by icd_network_api_init_cb().


Variable Documentation

const gchar* icd_iap_state_names[ICD_IAP_MAX_STATES]


Generated on Thu Mar 11 09:04:50 2010 for ICd2 by  doxygen 1.5.6