Any connection -policy
[Policy modules]


Classes

struct  policy_scan_data
struct  policy_any_data
struct  policy_any_network

Functions

void icd_policy_init (struct icd_policy_api *policy_api, icd_policy_nw_add_fn add_network, icd_policy_request_merge_fn merge_requests, icd_policy_request_make_new_fn make_request, icd_policy_scan_start_fn scan_start, icd_policy_scan_stop_fn scan_stop, icd_policy_nw_close_fn not_used_1, icd_policy_network_priority_fn not_used_2, icd_policy_service_module_check_fn srv_check)
static gboolean policy_any_string_equal (const gchar *a, const gchar *b)
static struct policy_scan_datapolicy_any_scan_data_new (struct policy_any_data *any_data, struct icd_policy_request *new_request, icd_policy_request_new_cb_fn policy_done_cb, gpointer policy_token)
static gint policy_any_sort_network (gconstpointer a, gconstpointer b)
static void policy_any_scan_cb (const guint status, const gchar *service_name, const gchar *service_type, const guint service_attrs, const gchar *service_id, gint service_priority, const gchar *network_name, const gchar *network_type, const guint network_attrs, const gchar *network_id, const gint network_priority, const enum icd_nw_levels signal, gpointer user_data)
static GSList * policy_any_get_types (struct policy_any_data *data)
static gint policy_any_get_prio (const GSList *existing_requests)
static void policy_any_new_request (struct icd_policy_request *new_request, const GSList *existing_requests, icd_policy_request_new_cb_fn policy_done_cb, gpointer policy_token, gpointer *private)
static void policy_any_cancel_request (struct icd_policy_request *request, gpointer *private)
static void policy_any_destruct (gpointer *private)

Function Documentation

void icd_policy_init ( struct icd_policy_api policy_api,
icd_policy_nw_add_fn  add_network,
icd_policy_request_merge_fn  merge_requests,
icd_policy_request_make_new_fn  make_request,
icd_policy_scan_start_fn  scan_start,
icd_policy_scan_stop_fn  scan_stop,
icd_policy_nw_close_fn  not_used_1,
icd_policy_network_priority_fn  not_used_2,
icd_policy_service_module_check_fn  srv_check 
)

Policy module initialization function.

Parameters:
policy_api policy API structure to be filled in by the module
add_network function to add a network in response to a policy
merge_requests function to merge requests
make_request function for creating a new request
scan_start function for scanning networks
scan_stop function for stopping network scanning

static void policy_any_cancel_request ( struct icd_policy_request request,
gpointer *  private 
) [static]

Clean up internal policy module data structures for a request that has previously reported ICD_POLICY_WAITING.

Parameters:
request the request that is to be removed or NULL for all
private private data for the module

References policy_any_data::found_networks, ILOG_DEBUG, ILOG_ERR, policy_any_network::network_id, policy_any_network::network_type, policy_any_data::ongoing_scans, policy_any_scan_cb(), policy_any_data::request, policy_any_data::scan_stop, policy_any_network::service_id, and policy_any_network::service_type.

Referenced by policy_any_destruct().

static void policy_any_destruct ( gpointer *  private  )  [static]

Policy module destruction function. Will be called before unloading the module.

Parameters:
private a reference to the private data

References policy_any_cancel_request().

static gint policy_any_get_prio ( const GSList *  existing_requests  )  [static]

Get the highest priority in the existing requests if change while connected is on

Parameters:
existing_requests existing requests
Returns:
the highest priority found or -1 if change while connected not set

References icd_policy_request::network_priority.

Referenced by policy_any_new_request().

static GSList* policy_any_get_types ( struct policy_any_data data  )  [static]

Get a list of network types to scan

Returns:
list of network types that caller needs to free

References ILOG_DEBUG, ILOG_ERR, ILOG_WARN, policy_any_network::network_type, and policy_any_data::srv_check.

Referenced by policy_any_new_request().

static void policy_any_new_request ( struct icd_policy_request new_request,
const GSList *  existing_requests,
icd_policy_request_new_cb_fn  policy_done_cb,
gpointer  policy_token,
gpointer *  private 
) [static]

New connection request policy function.

Parameters:
new_request the new connection request
existing_requests currently existing requests
policy_done_cb callback to call when policy has been decided
policy_token token to pass to the callback
private the private memeber of the icd_request_api structure

Todo:
here we should make a new ASK request and merge with that

References icd_policy_request::attrs, ICD_NW_SEARCH_SCOPE_SAVED, ICD_POLICY_ACCEPTED, ICD_POLICY_ATTRIBUTE_HAS_CONNECTIONS, ICD_POLICY_REJECTED, ILOG_DEBUG, ILOG_ERR, ILOG_INFO, policy_any_data::min_prio, icd_policy_request::network_id, policy_any_data::ongoing_scans, policy_any_get_prio(), policy_any_get_types(), policy_any_scan_cb(), policy_any_scan_data_new(), policy_any_data::request, icd_policy_request::request_token, policy_any_data::scan_start, and policy_any_data::scan_types_list.

static void policy_any_scan_cb ( const guint  status,
const gchar *  service_name,
const gchar *  service_type,
const guint  service_attrs,
const gchar *  service_id,
gint  service_priority,
const gchar *  network_name,
const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id,
const gint  network_priority,
const enum icd_nw_levels  signal,
gpointer  user_data 
) [static]

Callback function for network scan.

Parameters:
status network scan status with ICD_POLICY_SCAN_* values
service_name service provider name, see srv_provider_api.h
service_type service provider type, see srv_provider_api.h
service_attrs service provider attributes, see srv_provider_api.h
service_id service_provider id, see srv_provider_api.h
service_priority service priority within a service_type
network_name network name, see network_api.h
network_type network type, see network_api.h
network_attrs network attributes, see network_api.h
network_id network id, see network_api.h
network_priority network priority between different network_type
signal signal leve, see network_api.h
user_data user data passed to icd_policy_scan_start_fn

Todo:
actually we should wait until all networks have completed one round of scanning and only then remove all scan requests

References policy_any_data::add_network, policy_scan_data::any_data, icd_policy_request::attrs, policy_any_data::found_networks, policy_any_data::iaps_added, ICD_NW_ATTR_AUTOCONNECT, ICD_NW_ATTR_LOCALMASK, ICD_POLICY_ACCEPTED, ICD_POLICY_ATTRIBUTE_CONNECTIONS_FAILED, ICD_POLICY_ATTRIBUTE_HAS_CONNECTIONS, ICD_POLICY_SCAN_DONE, ICD_POLICY_SCAN_EXPIRED_NETWORK, ICD_POLICY_SCAN_NEW_NETWORK, ICD_POLICY_SCAN_UPDATE_NETWORK, ILOG_DEBUG, ILOG_ERR, ILOG_INFO, ILOG_WARN, policy_any_data::min_prio, policy_any_network::network_attrs, policy_any_network::network_id, policy_any_network::network_priority, policy_any_network::network_type, policy_any_data::ongoing_scans, policy_any_sort_network(), policy_any_string_equal(), policy_scan_data::policy_done_cb, policy_scan_data::policy_token, policy_any_data::request, policy_any_data::scan_stop, policy_any_data::scan_types_list, policy_any_network::service_attrs, policy_any_network::service_id, policy_any_network::service_type, and policy_any_network::signal.

Referenced by policy_any_cancel_request(), and policy_any_new_request().

static struct policy_scan_data* policy_any_scan_data_new ( struct policy_any_data any_data,
struct icd_policy_request new_request,
icd_policy_request_new_cb_fn  policy_done_cb,
gpointer  policy_token 
) [static, read]

Create a new scan data structure and add it to the list of ongoing scans.

Parameters:
any_data module data
new_request the new connection request
policy_done_cb callback to call when policy has been decided
policy_token policy token
Returns:
scan data structure

References policy_scan_data::any_data, policy_any_data::ongoing_scans, policy_scan_data::policy_done_cb, and policy_scan_data::policy_token.

Referenced by policy_any_new_request().

static gint policy_any_sort_network ( gconstpointer  a,
gconstpointer  b 
) [static]

Sort new network according to priority and signal strength

Parameters:
a network A
b network B
Returns:
< 0 if A comes before B, 0 on equality, > 0 if A comes after B

References policy_any_network::network_priority, and policy_any_network::signal.

Referenced by policy_any_scan_cb().

static gboolean policy_any_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

Parameters:
a string A
b string B
Returns:
TRUE if equal, FALSE if unequal

Referenced by policy_any_scan_cb().


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