Classes | |
struct | icd_scan_listener |
struct | icd_scan_expire_network_data |
struct | icd_scan_cache_list |
struct | icd_scan_srv_provider |
struct | icd_scan_cache |
struct | icd_scan_cache_timeout |
Typedefs | |
typedef void(* | icd_scan_cb_fn )(enum icd_scan_status status, const struct icd_scan_srv_provider *srv_provider, const struct icd_scan_cache *cache_entry, gpointer user_data) |
Functions | |
static gboolean | string_equal (const gchar *a, const gchar *b) |
void | icd_scan_cache_entry_free (struct icd_scan_cache *cache_entry) |
void | icd_scan_cache_entry_add (struct icd_network_module *module, struct icd_scan_cache_list *scan_cache, struct icd_scan_cache *cache_entry) |
struct icd_scan_cache_list * | icd_scan_cache_list_lookup (struct icd_network_module *module, const gchar *network_id) |
struct icd_scan_cache * | icd_scan_cache_entry_find (struct icd_scan_cache_list *scan_cache_list, const gchar *network_type, const guint network_attrs) |
gboolean | icd_scan_cache_entry_remove (struct icd_scan_cache_list *scan_cache_list, const gchar *network_id, const gchar *network_type, const guint network_attrs) |
static gboolean | icd_scan_cache_rescan (gpointer data) |
static void | icd_scan_status_stop (struct icd_network_module *module) |
static void | icd_scan_status_start (struct icd_network_module *module) |
static gboolean | icd_scan_listener_exist (struct icd_network_module *module) |
static gboolean | icd_scan_listener_send_entry (struct icd_scan_srv_provider *srv_provider, struct icd_scan_cache *cache_entry, struct icd_scan_listener *listener, enum icd_scan_status status) |
static void | icd_scan_listener_send_list (gpointer key, gpointer value, gpointer user_data) |
static gboolean | icd_scan_cache_element_check (gpointer key, gpointer value, gpointer user_data) |
static gboolean | icd_scan_cache_has_elements (struct icd_network_module *module) |
static void | icd_scan_listener_send_cache (struct icd_network_module *module, struct icd_scan_listener *listener) |
static gboolean | icd_scan_listener_add (struct icd_network_module *module, const gchar *type, icd_scan_cb_fn cb, gpointer user_data) |
static void | icd_scan_listener_remove (struct icd_network_module *module, icd_scan_cb_fn cb, gpointer user_data) |
void | icd_scan_listener_notify (struct icd_network_module *module, struct icd_scan_srv_provider *srv_provider, struct icd_scan_cache *cache_entry, enum icd_scan_status status) |
static gboolean | icd_scan_expire_network (gpointer key, gpointer value, gpointer user_data) |
static gboolean | icd_scan_expire_network_for_hash (gpointer key, gpointer value, gpointer user_data) |
static guint | icd_scan_timeout_rescan_add (struct icd_network_module *module, guint seconds) |
static guint | icd_scan_timeout_add (struct icd_network_module *module, GSourceFunc expire_function, guint seconds) |
static void | icd_scan_timeout_free (struct icd_scan_cache_timeout *timeout_data) |
static gboolean | icd_scan_cache_expire (gpointer data) |
static void | icd_scan_cb (enum icd_network_search_status status, gchar *network_name, gchar *network_type, const guint network_attrs, gchar *network_id, enum icd_nw_levels signal, gchar *station_id, gint dB, const gpointer search_cb_token) |
static gboolean | icd_scan_network (struct icd_network_module *module, const gchar *network_type) |
static gboolean | icd_scan_cache_remove_iap_for_module (struct icd_network_module *module, gpointer user_data) |
void | icd_scan_cache_remove_iap (gchar *iap_name) |
gboolean | icd_scan_results_request (const gchar *type, guint scope, icd_scan_cb_fn cb, gpointer user_data) |
gboolean | icd_scan_results_unregister (icd_scan_cb_fn cb, gpointer user_data) |
gboolean | icd_scan_cache_init (struct icd_network_module *module) |
void | icd_scan_cache_remove (struct icd_network_module *module) |
Variables | |
const gchar const * | icd_scan_status_names [] |
+---+ | n | +GHashTable(network_idX)-+ | w |-->|scan_cache_table | | | +------------------------+ | m | | | +->icd_scan_cache_list | o | | | +->GSlist for network_idN | d | | | | u | | +->icd_scan_cache_list | l | | +->GSList for network_id2 | e | | +---+ | ... | +->icd_scan_cache_list +->GSList for network_idN
typedef void(* icd_scan_cb_fn)(enum icd_scan_status status, const struct icd_scan_srv_provider *srv_provider, const struct icd_scan_cache *cache_entry, gpointer user_data) |
Scan callback function for receiving scan results
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 | used data given to the scan callback |
static gboolean icd_scan_cache_element_check | ( | gpointer | key, | |
gpointer | value, | |||
gpointer | user_data | |||
) | [static] |
Check for elements, return immediately on first element found
key | the network_id, not used | |
value | the icd_scan_cache_list | |
user_data | not used |
References icd_scan_cache_list::cache_list, and ILOG_DEBUG.
Referenced by icd_scan_cache_has_elements().
void icd_scan_cache_entry_add | ( | struct icd_network_module * | module, | |
struct icd_scan_cache_list * | scan_cache, | |||
struct icd_scan_cache * | cache_entry | |||
) |
Add an cache entry to the network module
module | network module | |
scan_cache | scan cache list or NULL | |
cache_entry | the entry to add |
References icd_scan_cache_list::cache_list, ILOG_ERR, icd_scan_cache::network_id, and icd_network_module::scan_cache_table.
Referenced by icd_scan_cb(), and icd_srv_provider_identify_cb().
struct icd_scan_cache * icd_scan_cache_entry_find | ( | struct icd_scan_cache_list * | scan_cache_list, | |
const gchar * | network_type, | |||
const guint | network_attrs | |||
) | [read] |
Find a network entry in the scan cache list
scan_cache_list | scan cache list | |
network_type | network type | |
network_attrs | network attrs |
References icd_scan_cache_list::cache_list, icd_scan_cache::network_attrs, icd_scan_cache::network_type, and string_equal().
Referenced by icd_scan_cb(), and icd_srv_provider_identify_cb().
void icd_scan_cache_entry_free | ( | struct icd_scan_cache * | cache_entry | ) |
Free an icd_scan_cache structure
cache_entry | cache entry to free |
References icd_scan_cache::network_id, icd_scan_cache::network_name, icd_scan_cache::network_type, icd_scan_srv_provider::service_id, icd_scan_srv_provider::service_name, icd_scan_srv_provider::service_type, icd_scan_cache::srv_provider_list, and icd_scan_cache::station_id.
Referenced by icd_scan_cache_entry_remove(), icd_scan_cache_remove_iap_for_module(), and icd_scan_expire_network().
gboolean icd_scan_cache_entry_remove | ( | struct icd_scan_cache_list * | scan_cache_list, | |
const gchar * | network_id, | |||
const gchar * | network_type, | |||
const guint | network_attrs | |||
) |
Remove scan cache from scan list, the removed entry does not call listener.
cache_list | the icd_scan_cache_list struct | |
network_id | network identifier | |
network_type | the network type | |
network_attrs | network attributes |
cache_list | the icd_scan_cache_list struct | |
network_id | network identifier | |
network_type | the network type | |
network_attrs | network attributes |
References icd_scan_cache_list::cache_list, icd_scan_cache_entry_free(), ILOG_DEBUG, ILOG_ERR, icd_scan_cache::network_attrs, icd_scan_cache::network_type, and string_equal().
Referenced by icd_iap_free().
static gboolean icd_scan_cache_expire | ( | gpointer | data | ) | [static] |
Cache expiry function
data | scan cache timeout data |
References icd_scan_expire_network_data::expire, icd_scan_expire_network_for_hash(), icd_scan_timeout_free(), ILOG_DEBUG, icd_scan_expire_network_data::module, icd_scan_cache_timeout::module, icd_network_module::name, icd_network_module::nw, icd_network_module::scan_cache_table, icd_network_module::scan_progress, and icd_nw_api::search_lifetime.
Referenced by icd_scan_cb().
static gboolean icd_scan_cache_has_elements | ( | struct icd_network_module * | module | ) | [static] |
Check wheter a scan cache has any elements
module | network module |
References icd_scan_cache_element_check(), and icd_network_module::scan_cache_table.
Referenced by icd_scan_listener_send_cache(), and icd_scan_results_request().
gboolean icd_scan_cache_init | ( | struct icd_network_module * | module | ) |
Set up the scan cache for a network module
module | network module |
References ILOG_ERR, and icd_network_module::scan_cache_table.
Referenced by icd_network_api_init_cb().
struct icd_scan_cache_list * icd_scan_cache_list_lookup | ( | struct icd_network_module * | module, | |
const gchar * | network_id | |||
) | [read] |
Get the scan cache list associated with the network id
module | network module | |
network_id | network id |
References icd_network_module::scan_cache_table.
Referenced by icd_iap_free(), icd_scan_cache_remove_iap_for_module(), icd_scan_cb(), and icd_srv_provider_identify_cb().
void icd_scan_cache_remove | ( | struct icd_network_module * | module | ) |
Tear down the scan cache and its hash table
module | the netowork module |
References icd_scan_expire_network_data::expire, icd_scan_expire_network_for_hash(), icd_scan_listener_remove(), icd_scan_cache_timeout::id, ILOG_ERR, icd_scan_expire_network_data::module, icd_network_module::scan_cache_table, icd_network_module::scan_timeout_list, and icd_network_module::scan_timeout_rescan.
Referenced by icd_network_api_unload_modules().
void icd_scan_cache_remove_iap | ( | gchar * | iap_name | ) |
Function that removes all the IAPs from cache that match name.
iap_name | IAP name |
References icd_context_get(), icd_ctx, icd_network_api_foreach_module(), and icd_scan_cache_remove_iap_for_module().
Referenced by icd_gconf_notify().
static gboolean icd_scan_cache_remove_iap_for_module | ( | struct icd_network_module * | module, | |
gpointer | user_data | |||
) | [static] |
Function that removes all the IAPs for a given module from cache that match name.
module | the network module | |
IAP | name |
References icd_scan_cache_list::cache_list, ICD_NW_ATTR_IAPNAME, icd_scan_cache_entry_free(), icd_scan_cache_list_lookup(), ICD_SCAN_EXPIRE, icd_scan_listener_notify(), ILOG_DEBUG, ILOG_ERR, icd_scan_cache::network_attrs, icd_scan_cache::network_id, icd_scan_cache::network_name, icd_scan_cache::network_type, icd_network_module::network_types, and string_equal().
Referenced by icd_scan_cache_remove_iap().
static gboolean icd_scan_cache_rescan | ( | gpointer | data | ) | [static] |
Rescan timeout function
data | scan cache timeout data |
References icd_scan_listener_exist(), icd_scan_network(), ILOG_INFO, icd_network_module::name, and icd_network_module::scan_timeout_rescan.
Referenced by icd_scan_timeout_rescan_add().
static void icd_scan_cb | ( | enum icd_network_search_status | status, | |
gchar * | network_name, | |||
gchar * | network_type, | |||
const guint | network_attrs, | |||
gchar * | network_id, | |||
enum icd_nw_levels | signal, | |||
gchar * | station_id, | |||
gint | dB, | |||
const gpointer | search_cb_token | |||
) | [static] |
Callback function for scan results
status | status of the operation | |
network_name | name of the network displayable to user | |
network_type | type of network | |
network_attrs | network attributes | |
network_id | network id | |
signal | signal level | |
station_id | base station id | |
dB | raw signal strength | |
search_cb_token | the network module structure |
References icd_scan_cache::dB, icd_scan_expire_network_data::expire, icd_network_priority_get(), ICD_NW_SEARCH_COMPLETE, ICD_NW_SEARCH_EXPIRE, icd_scan_cache_entry_add(), icd_scan_cache_entry_find(), icd_scan_cache_expire(), icd_scan_cache_list_lookup(), ICD_SCAN_COMPLETE, icd_scan_expire_network(), icd_scan_expire_network_for_hash(), icd_scan_listener_notify(), ICD_SCAN_NEW, ICD_SCAN_NOTIFY, icd_scan_status_stop(), icd_scan_timeout_add(), icd_scan_timeout_rescan_add(), ICD_SCAN_UPDATE, icd_srv_provider_identify(), ILOG_ERR, ILOG_INFO, icd_scan_cache::last_seen, icd_scan_expire_network_data::module, icd_network_module::name, icd_scan_cache::network_attrs, icd_scan_cache::network_id, icd_scan_cache::network_name, icd_scan_cache::network_priority, icd_scan_cache::network_type, icd_network_module::network_types, icd_network_module::nw, icd_network_module::scan_cache_table, icd_network_module::scan_progress, icd_nw_api::search_interval, icd_nw_api::search_lifetime, icd_scan_cache::signal, and icd_scan_cache::station_id.
Referenced by icd_scan_network().
static gboolean icd_scan_expire_network | ( | gpointer | key, | |
gpointer | value, | |||
gpointer | user_data | |||
) | [static] |
Hash table callback for removing an entry. Note that this function is also called outside of hash, so care should be taken when dealing with the hash (that is why list_entry is not deleted inside this function).
key | the network_id | |
value | the icd_scan_cache_list struct | |
user_data | expiration time |
References icd_scan_cache_list::cache_list, icd_scan_expire_network_data::expire, icd_scan_cache_entry_free(), ICD_SCAN_EXPIRE, icd_scan_listener_notify(), ILOG_DEBUG, ILOG_ERR, icd_scan_cache::last_seen, and icd_scan_expire_network_data::module.
Referenced by icd_scan_cb(), and icd_scan_expire_network_for_hash().
static gboolean icd_scan_expire_network_for_hash | ( | gpointer | key, | |
gpointer | value, | |||
gpointer | user_data | |||
) | [static] |
Hash table callback for removing an entry, this version is only called from hash remove func.
key | the network_id | |
value | the icd_scan_cache_list struct | |
user_data | expiration time |
References icd_scan_expire_network().
Referenced by icd_scan_cache_expire(), icd_scan_cache_remove(), and icd_scan_cb().
static gboolean icd_scan_listener_add | ( | struct icd_network_module * | module, | |
const gchar * | type, | |||
icd_scan_cb_fn | cb, | |||
gpointer | user_data | |||
) | [static] |
Add a scan result listener to a module
module | the module whose scan results to report | |
type | the network type to receive scan results for | |
cb | listener callback | |
user_data | user data to pass to the callback |
References icd_scan_listener::cb, icd_scan_listener_send_cache(), icd_network_module::scan_listener_list, icd_scan_listener::type, and icd_scan_listener::user_data.
Referenced by icd_scan_results_request().
static gboolean icd_scan_listener_exist | ( | struct icd_network_module * | module | ) | [static] |
Check if there are any listeners that want scan results
module | the network module |
References icd_network_module::scan_listener_list.
Referenced by icd_scan_cache_rescan(), and icd_scan_results_request().
void icd_scan_listener_notify | ( | struct icd_network_module * | module, | |
struct icd_scan_srv_provider * | srv_provider, | |||
struct icd_scan_cache * | cache_entry, | |||
enum icd_scan_status | status | |||
) |
Notify each matching listener about the change in the cache entry
module | the network module | |
srv_provider | NULL or the specific service provider entry that got updated; if non-NULL only this service provider associated with the cache_entry will be sent to the listeners | |
cache_entry | corresponding cache entry that got updated | |
status | status of the notification |
References icd_scan_listener_send_entry(), and icd_network_module::scan_listener_list.
Referenced by icd_scan_cache_remove_iap_for_module(), icd_scan_cb(), icd_scan_expire_network(), and icd_srv_provider_identify_cb().
static void icd_scan_listener_remove | ( | struct icd_network_module * | module, | |
icd_scan_cb_fn | cb, | |||
gpointer | user_data | |||
) | [static] |
Remove all matching listener callback - user data tuples from a module
module | the network module | |
cb | the callback to remove or NULL to remove all callbacks | |
user_data | user data to remove |
References icd_scan_listener::cb, icd_network_module::scan_listener_list, icd_scan_listener::type, and icd_scan_listener::user_data.
Referenced by icd_scan_cache_remove(), and icd_scan_results_unregister().
static void icd_scan_listener_send_cache | ( | struct icd_network_module * | module, | |
struct icd_scan_listener * | listener | |||
) | [static] |
Notify a (new) listener of the current cache
module | the network module | |
listener | the listener to update with the current cache |
References icd_scan_cache_has_elements(), ICD_SCAN_COMPLETE, icd_scan_listener_send_entry(), icd_scan_listener_send_list(), icd_scan_cache::network_type, icd_network_module::scan_cache_table, icd_network_module::scan_timeout_rescan, and icd_scan_listener::type.
Referenced by icd_scan_listener_add().
static gboolean icd_scan_listener_send_entry | ( | struct icd_scan_srv_provider * | srv_provider, | |
struct icd_scan_cache * | cache_entry, | |||
struct icd_scan_listener * | listener, | |||
enum icd_scan_status | status | |||
) | [static] |
Send the cache entry to the listener if the network type matches
srv_provider | send only this service provider to the listener if set; send all network and service provider entries if NULL | |
cache_entry | the cache entry | |
listener | the listener | |
status | the status of the supplied cache entry |
References icd_scan_listener::cb, ICD_NW_ATTR_SRV_PROVIDER, ICD_SCAN_COMPLETE, icd_scan_status_names, ILOG_DEBUG, ILOG_ERR, icd_scan_cache::network_attrs, icd_scan_cache::network_id, icd_scan_cache::network_type, icd_scan_srv_provider::service_attrs, icd_scan_srv_provider::service_id, icd_scan_srv_provider::service_type, icd_scan_cache::srv_provider_list, icd_scan_listener::type, and icd_scan_listener::user_data.
Referenced by icd_scan_listener_notify(), icd_scan_listener_send_cache(), and icd_scan_listener_send_list().
static void icd_scan_listener_send_list | ( | gpointer | key, | |
gpointer | value, | |||
gpointer | user_data | |||
) | [static] |
Send all cache entries to the listener
key | the network_id | |
value | the icd_scan_cache_list | |
user_data | the icd_scan_listener |
References icd_scan_cache_list::cache_list, icd_scan_listener_send_entry(), and ICD_SCAN_NEW.
Referenced by icd_scan_listener_send_cache().
static gboolean icd_scan_network | ( | struct icd_network_module * | module, | |
const gchar * | network_type | |||
) | [static] |
Request one network module to initiate scan with given scope
module | the network module | |
network_type | network type to scan for |
References icd_scan_cb(), icd_scan_status_start(), ILOG_WARN, icd_network_module::name, icd_network_module::nw, icd_network_module::scan_progress, icd_network_module::scope, and icd_nw_api::start_search.
Referenced by icd_scan_cache_rescan(), and icd_scan_results_request().
gboolean icd_scan_results_request | ( | const gchar * | type, | |
guint | scope, | |||
icd_scan_cb_fn | cb, | |||
gpointer | user_data | |||
) |
Function requesting scan results; can be called many times to add more than one network type per callback
type | network type to scan or NULL for all networks | |
scope | scope of the scan, see network_api.h | |
cb | callback function for the results | |
user_data | user data to pass to the callback |
References icd_context_get(), icd_ctx, icd_gconf_agressive_scanning(), icd_network_api_has_type(), icd_scan_cache_has_elements(), icd_scan_listener_add(), icd_scan_listener_exist(), icd_scan_network(), ILOG_ERR, ILOG_WARN, icd_network_module::nw, icd_context::nw_module_list, icd_network_module::scan_timeout_rescan, icd_network_module::scope, and icd_nw_api::start_search.
Referenced by icd_dbus_api_scan_append(), and icd_policy_api_scan_start().
gboolean icd_scan_results_unregister | ( | icd_scan_cb_fn | cb, | |
gpointer | user_data | |||
) |
Unregister all matching callback - user data tuples from receiving scan results
cb | the same callback as given in icd_scan_results_request | |
user_data | the same user_data as given in icd_scan_results_request |
References icd_context_get(), icd_ctx, icd_scan_listener_remove(), ILOG_ERR, and icd_context::nw_module_list.
Referenced by icd_dbus_api_app_exit(), and icd_policy_api_scan_stop().
static void icd_scan_status_start | ( | struct icd_network_module * | module | ) | [static] |
Send scan start status
module | network module |
References icd_status_scan_start(), ILOG_INFO, icd_network_module::network_types, icd_network_module::nw, and icd_nw_api::start_search.
Referenced by icd_scan_network().
static void icd_scan_status_stop | ( | struct icd_network_module * | module | ) | [static] |
Send scan stop status
module | network module |
References icd_status_scan_stop(), ILOG_INFO, icd_network_module::network_types, icd_network_module::nw, and icd_nw_api::start_search.
Referenced by icd_scan_cb().
static guint icd_scan_timeout_add | ( | struct icd_network_module * | module, | |
GSourceFunc | expire_function, | |||
guint | seconds | |||
) | [static] |
Add a pending timeout function. The timeout function must remove the timeout data structure if the same callback is not called repeatedly.
module | the network module | |
expire_function | function to call | |
seconds | seconds until timeout |
References icd_scan_cache_timeout::id, icd_scan_cache_timeout::module, and icd_network_module::scan_timeout_list.
Referenced by icd_scan_cb().
static void icd_scan_timeout_free | ( | struct icd_scan_cache_timeout * | timeout_data | ) | [static] |
Remove and g_free() the timeout data
timeout_data | the timeout data to free |
References icd_scan_cache_timeout::module, and icd_network_module::scan_timeout_list.
Referenced by icd_scan_cache_expire().
static guint icd_scan_timeout_rescan_add | ( | struct icd_network_module * | module, | |
guint | seconds | |||
) | [static] |
Add a rescan timeout.
module | the network module | |
seconds | seconds until timeout |
References icd_scan_cache_rescan(), and icd_network_module::scan_timeout_rescan.
Referenced by icd_scan_cb().
static gboolean string_equal | ( | const gchar * | a, | |
const gchar * | b | |||
) | [static] |
Helper function for comparing two strings where a NULL string is equal to another NULL string
a | string A | |
b | string B |
const gchar const* icd_scan_status_names[] |
Initial value:
{ "ICD_SCAN_NEW", "ICD_SCAN_UPDATE", "ICD_SCAN_NOTIFY", "ICD_SCAN_EXPIRE", "ICD_SCAN_COMPLETE" }
Referenced by icd_scan_listener_send_entry().