Connection request
[ICd internal functions]


Classes

struct  icd_request

Typedefs

typedef void(* icd_request_cb_fn )(enum icd_request_status status, gpointer user_data)
typedef gpointer(* icd_request_foreach_fn )(struct icd_request *request, gpointer user_data)

Enumerations

enum  icd_request_status {
  ICD_REQUEST_POLICY_PENDING = 0, ICD_REQUEST_WAITING, ICD_REQUEST_CHANGETO, ICD_REQUEST_MERGED,
  ICD_REQUEST_CONNECTING_IAPS, ICD_REQUEST_SUCCEEDED, ICD_REQUEST_DENIED, ICD_REQUEST_DISCONNECTED,
  ICD_REQUEST_MAX
}

Functions

static gboolean icd_request_try_iap (struct icd_request *request)
static void icd_request_connect (struct icd_request *request)
static gboolean icd_request_string_equal (const gchar *a, const gchar *b)
gpointer icd_request_foreach (icd_request_foreach_fn fn, gpointer user_data)
void icd_request_tracking_info_remove (struct icd_request *request, struct icd_tracking_info *track)
static gpointer icd_request_tracking_info_delete_foreach (struct icd_request *request, gpointer user_data)
gboolean icd_request_tracking_info_delete (const gchar *sender)
void icd_request_tracking_info_add (struct icd_request *request, struct icd_tracking_info *track)
static void icd_request_tracking_info_free (struct icd_request *request)
static gpointer icd_request_find_foreach (struct icd_request *request, gpointer user_data)
struct icd_requesticd_request_find (const gchar *network_type, const guint network_attrs, const gchar *network_id)
struct icd_requesticd_request_find_by_iap (const gchar *network_type, const guint network_attrs, const gchar *network_id)
struct icd_requesticd_request_find_by_iap_id (const gchar *iap_id, const gboolean is_local)
static void icd_request_update_status (enum icd_request_status status, struct icd_request *request)
void icd_request_free_iaps (struct icd_request *request)
static void icd_request_free (struct icd_request *request)
static gboolean icd_request_find_iap_by_module (struct icd_iap *iap, gpointer user_data)
static gpointer icd_request_find_changeto (struct icd_request *request, gpointer user_data)
void icd_request_send_ack (struct icd_request *request, struct icd_iap *iap)
void icd_request_send_nack (struct icd_request *request)
static void icd_request_retry_cb (gboolean success, gpointer user_data)
static void icd_request_try_iap_cb (enum icd_iap_status status, struct icd_iap *iap, gpointer user_data)
static void icd_request_connect_iaps (enum icd_policy_status status, struct icd_policy_request *req)
void icd_request_add_iap (struct icd_request *request, gchar *service_type, guint service_attrs, gchar *service_id, gchar *network_type, guint network_attrs, gchar *network_id, gint network_priority)
struct icd_requesticd_request_new (guint policy_attrs, const gchar *service_type, const guint service_attrs, const gchar *service_id, const gchar *network_type, const guint network_attrs, const gchar *network_id)
static gpointer icd_request_make_check_duplicate (struct icd_request *request, gpointer user_data)
void icd_request_make (struct icd_request *request)
gboolean icd_request_merge (struct icd_request *merge_request, struct icd_request *existing)
void icd_request_cancel (struct icd_request *request, guint policy_attrs)

Variables

const gchar * icd_request_status_names [ICD_REQUEST_MAX]

Typedef Documentation

typedef void(* icd_request_cb_fn)(enum icd_request_status status, gpointer user_data)

The request status callback function

Parameters:
status the outcome of the request
user_data user data

typedef gpointer(* icd_request_foreach_fn)(struct icd_request *request, gpointer user_data)

Function called for each request structure

Parameters:
request the request
user_data user data passed to icd_request_foreach()
Returns:
NULL to continue iteration, non-NULL to stop the iteration and return this pointer in icd_request_foreach().


Enumeration Type Documentation

status of the request

Enumerator:
ICD_REQUEST_POLICY_PENDING  the request is pending in the policy framework
ICD_REQUEST_WAITING  the request is waiting for an external event such as scan results, UI dialog, etc; stops policy processing
ICD_REQUEST_CHANGETO  change to this request when the other request has been closed
ICD_REQUEST_MERGED  request was merged with an existing one
ICD_REQUEST_CONNECTING_IAPS  establishing connection(s)
ICD_REQUEST_SUCCEEDED  the request was successfully completed
ICD_REQUEST_DENIED  the request was denied
ICD_REQUEST_DISCONNECTED  the IAP and network connection mapping to the request was successfully closed down
ICD_REQUEST_MAX  max number of request statuses


Function Documentation

void icd_request_add_iap ( struct icd_request request,
gchar *  service_type,
guint  service_attrs,
gchar *  service_id,
gchar *  network_type,
guint  network_attrs,
gchar *  network_id,
gint  network_priority 
)

Add a network connection to try.

Parameters:
request the request to which the new network is added
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
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, default value to use is -1

References icd_policy_request::attrs, icd_iap::connection, icd_iap_id_create(), icd_iap_new(), icd_network_priority_get(), ICD_NW_ATTR_ALWAYS_ONLINE, ICD_NW_ATTR_SILENT, ICD_POLICY_ATTRIBUTE_ALWAYS_ONLINE, ICD_POLICY_ATTRIBUTE_HAS_CONNECTIONS, ICD_POLICY_ATTRIBUTE_NO_INTERACTION, ILOG_DEBUG, icd_policy_request::network_attrs, icd_policy_request::network_id, icd_policy_request::network_priority, icd_policy_request::network_type, req, icd_policy_request::request_token, icd_policy_request::service_attrs, icd_policy_request::service_id, icd_policy_request::service_type, and try_iaps.

Referenced by icd_dbus_api_connect_req(), and icd_policy_api_add_iap().

void icd_request_cancel ( struct icd_request request,
guint  policy_attrs 
)

static void icd_request_connect ( struct icd_request request  )  [static]

Try to connect the request (for the first time), request UI dialog if unsuccessful

Parameters:
request the request to connect

References ICD_POLICY_ATTRIBUTE_BACKGROUND, ICD_POLICY_ATTRIBUTE_NO_INTERACTION, icd_request_make(), icd_request_merge(), icd_request_new(), icd_request_try_iap(), and ILOG_INFO.

Referenced by icd_request_connect_iaps(), and icd_request_try_iap_cb().

static void icd_request_connect_iaps ( enum icd_policy_status  status,
struct icd_policy_request req 
) [static]

struct icd_request * icd_request_find ( const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id 
) [read]

Find a request

Parameters:
network_type requested network type
network_attrs requested network attributes
network_id requesete (meta) IAP name
Returns:
the first (and only) request found or NULL

References icd_request_find_foreach(), icd_request_foreach(), icd_policy_request::network_attrs, icd_policy_request::network_id, and icd_policy_request::network_type.

Referenced by icd_dbus_api_connect_req(), icd_name_owner_filter(), icd_osso_ic_activate(), and icd_osso_ui_retry().

struct icd_request * icd_request_find_by_iap ( const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id 
) [read]

Find a request by IAP

Parameters:
network_type network type
network_attrs network attributes
network_id network id
Returns:
the first (and only) request found or NULL

References icd_iap::connection, icd_iap_find(), and icd_policy_request::request_token.

Referenced by icd_dbus_api_disconnect_req(), icd_osso_ic_disconnect(), and icd_osso_ui_retry().

struct icd_request * icd_request_find_by_iap_id ( const gchar *  iap_id,
const gboolean  is_local 
) [read]

Find a request by IAP id

Parameters:
iap_id IAP id
is_local TRUE if a locally generated icd2 id is requested, FALSE otherwise

References icd_iap::connection, icd_iap_find_by_id(), and icd_policy_request::request_token.

Referenced by icd_osso_ui_retry().

static gpointer icd_request_find_changeto ( struct icd_request request,
gpointer  user_data 
) [static]

Find a request to change to

Parameters:
request the request
user_data user data passed to icd_request_foreach()
Returns:
NULL to continue iteration, non-NULL to stop the iteration and return this pointer in icd_request_foreach().

References ICD_REQUEST_CHANGETO, and state.

Referenced by icd_request_try_iap_cb().

static gpointer icd_request_find_foreach ( struct icd_request request,
gpointer  user_data 
) [static]

Foreach function for network finding

Parameters:
request the request
user_data the network to search for
Returns:
the request that has a matching network connection or NULL if none

References ICD_NW_ATTR_IAPNAME, ICD_NW_ATTR_LOCALMASK, icd_request_string_equal(), ILOG_DEBUG, icd_policy_request::network_attrs, icd_policy_request::network_id, icd_policy_request::network_type, and req.

Referenced by icd_request_find().

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

Find an iap by module

Parameters:
iap the IAP struct
user_data user data
Returns:
TRUE to continue, FALSE to stop iterating

References ILOG_DEBUG, and icd_iap::network_modules.

Referenced by icd_request_try_iap_cb().

gpointer icd_request_foreach ( icd_request_foreach_fn  fn,
gpointer  user_data 
)

Iterate over all requests and call the user given function for each of them

Parameters:
fn the function
user_data user data to pass to the function
Returns:
the pointer returned from the user function

References icd_context_get(), icd_ctx, ILOG_ERR, and icd_context::request_list.

Referenced by icd_osso_ic_connstats(), icd_osso_ic_get_state(), icd_osso_ic_ipinfo(), icd_request_find(), icd_request_make(), icd_request_tracking_info_delete(), icd_request_try_iap_cb(), and icd_tracking_info_find().

static void icd_request_free ( struct icd_request request  )  [static]

void icd_request_free_iaps ( struct icd_request request  ) 

Free memory allocated for all IAPs in a request

Parameters:
request the request

References icd_iap_free(), ILOG_CRIT, and try_iaps.

Referenced by icd_osso_ui_retry(), icd_request_cancel(), icd_request_connect_iaps(), icd_request_make(), icd_request_merge(), icd_request_retry_cb(), and icd_request_try_iap_cb().

void icd_request_make ( struct icd_request request  ) 

static gpointer icd_request_make_check_duplicate ( struct icd_request request,
gpointer  user_data 
) [static]

Find out wheter the request already exists in the icd context request list

Parameters:
request a request from the list
user_data the request to be added
Returns:
the request if it is on the list, NULL if not

Referenced by icd_request_make().

gboolean icd_request_merge ( struct icd_request merge_request,
struct icd_request existing 
)

struct icd_request * icd_request_new ( guint  policy_attrs,
const gchar *  service_type,
const guint  service_attrs,
const gchar *  service_id,
const gchar *  network_type,
const guint  network_attrs,
const gchar *  network_id 
) [read]

Request a connection. ICd policy will be consulted and any number of IAPs may be created in response.

Parameters:
policy_attrs ICD_POLICY_ATTRIBUTE_* attributes
service_type service type
service_attrs service attributes
service_id service id
network_type network type to connect
network_attrs network attributes
network_id network id uniquely identifies the connection to the network module in question
Returns:
the newly created request which the caller shall not free or reference in any way. The pointer is to be passed only to icd_request_tracking_info_* and icd_request_make functions.

References icd_policy_request::attrs, icd_policy_request::network_attrs, icd_policy_request::network_id, icd_policy_request::network_priority, icd_policy_request::network_type, req, icd_policy_request::request_token, icd_policy_request::service_attrs, icd_policy_request::service_id, and icd_policy_request::service_type.

Referenced by icd_dbus_api_connect_req(), icd_dbus_api_select_req(), icd_osso_ic_make_request(), icd_osso_ui_retry(), icd_policy_api_make_request(), icd_request_connect(), and icd_request_try_iap_cb().

static void icd_request_retry_cb ( gboolean  success,
gpointer  user_data 
) [static]

Callback for requesting retry UI dialog

Parameters:
success TRUE if the UI dialog was successfully requested, FALSE otherwise
user_data the request that was retried

References ICD_REQUEST_DISCONNECTED, icd_request_free(), icd_request_free_iaps(), icd_request_send_nack(), icd_request_update_status(), ILOG_DEBUG, and ILOG_WARN.

Referenced by icd_request_try_iap_cb().

void icd_request_send_ack ( struct icd_request request,
struct icd_iap iap 
)

Send an ACK to all D-Bus listeners

Parameters:
request the request to ack
iap the IAP to ack

References icd_iap::connection, icd_dbus_api_send_ack(), icd_dbus_api_send_nack(), icd_osso_ic_send_ack(), ICD_REQUEST_DISCONNECTED, icd_policy_request::network_id, state, and users.

Referenced by icd_request_merge(), and icd_request_try_iap_cb().

void icd_request_send_nack ( struct icd_request request  ) 

Send a NACK to all D-Bus listeners

Parameters:
request the request to NACK

References icd_dbus_api_send_nack(), icd_osso_ic_send_nack(), and users.

Referenced by icd_osso_ic_activate(), icd_osso_ui_retry(), icd_request_connect_iaps(), icd_request_make(), icd_request_retry_cb(), and icd_request_try_iap_cb().

static gboolean icd_request_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 icd_request_find_foreach().

void icd_request_tracking_info_add ( struct icd_request request,
struct icd_tracking_info track 
)

gboolean icd_request_tracking_info_delete ( const gchar *  sender  ) 

Delete a tracked user by D-Bus id

Parameters:
sender the D-Bus sender
Returns:
TRUE if the sender was deleted; FALSE on error or sender not found

References icd_request_foreach(), icd_request_tracking_info_delete_foreach(), and ILOG_ERR.

Referenced by icd_name_owner_filter().

static gpointer icd_request_tracking_info_delete_foreach ( struct icd_request request,
gpointer  user_data 
) [static]

Iterator function for removal by D-Bus sender id

Parameters:
request the request
user_data user data passed to icd_request_tracking_info_delete().
Returns:
the request in which the sender id was found or NULL

References icd_name_owner_remove_filter(), icd_tracking_info_free(), ILOG_ERR, icd_tracking_info::sender, and users.

Referenced by icd_request_tracking_info_delete().

static void icd_request_tracking_info_free ( struct icd_request request  )  [static]

Free all tracking info associated with a request

Parameters:
request the request

References icd_tracking_info_free(), and users.

Referenced by icd_request_merge(), and icd_request_try_iap_cb().

void icd_request_tracking_info_remove ( struct icd_request request,
struct icd_tracking_info track 
)

Remove tracking info to a request

Parameters:
request the request
track tracking info

References users.

Referenced by icd_request_merge().

static gboolean icd_request_try_iap ( struct icd_request request  )  [static]

Check policy and try to connect IAP

Parameters:
request the request
Returns:
TRUE if connection is being tried; FALSE when there are no more IAPs to try

References icd_iap::connection, icd_iap_connect(), icd_iap_free(), ICD_POLICY_ACCEPTED, icd_policy_api_iap_connect(), ICD_REQUEST_CONNECTING_IAPS, icd_request_try_iap_cb(), icd_request_update_status(), icd_status_connect(), ILOG_DEBUG, ILOG_INFO, and try_iaps.

Referenced by icd_request_connect(), and icd_request_try_iap_cb().

static void icd_request_try_iap_cb ( enum icd_iap_status  status,
struct icd_iap iap,
gpointer  user_data 
) [static]

IAP creation callback. Adds the IAP to the iap context list on success, frees the IAP and tries with a next one if the IAP failed.

Parameters:
status status of the IAP creation
iap the iap that was tried; the IAP must not be freed in this callback
user_data the request

Todo:
generate status updates for the event(s)

Todo:
how to remove this request if UI goes down

References icd_policy_request::attrs, icd_iap::busy, icd_iap::connection, icd_iap::err_str, icd_context_get(), icd_ctx, ICD_IAP_BUSY, ICD_IAP_CREATED, icd_iap_disconnect(), ICD_IAP_DISCONNECTED, ICD_IAP_FAILED, icd_iap_foreach(), icd_iap_free(), icd_osso_ui_send_retry(), icd_policy_api_iap_disconnected(), icd_policy_api_iap_succeeded(), ICD_POLICY_ATTRIBUTE_BACKGROUND, ICD_POLICY_ATTRIBUTE_NO_INTERACTION, ICD_REQUEST_CHANGETO, icd_request_connect(), ICD_REQUEST_DISCONNECTED, icd_request_find_changeto(), icd_request_find_iap_by_module(), icd_request_foreach(), icd_request_free(), icd_request_free_iaps(), icd_request_make(), icd_request_merge(), icd_request_new(), icd_request_retry_cb(), icd_request_send_ack(), icd_request_send_nack(), ICD_REQUEST_SUCCEEDED, icd_request_tracking_info_free(), icd_request_try_iap(), icd_request_update_status(), ICD_REQUEST_WAITING, icd_status_connected(), icd_status_disconnected(), icd_iap::id, icd_iap::id_is_local, ILOG_DEBUG, ILOG_INFO, ILOG_WARN, multi_iaps, icd_policy_request::network_id, req, icd_context::shutting_down, state, try_iaps, and icd_iap::user_interaction_done.

Referenced by icd_request_try_iap().

static void icd_request_update_status ( enum icd_request_status  status,
struct icd_request request 
) [static]

Notify the caller with the status of the request. The callback will not be called after ICD_REQUEST_DISCONNECTED or ICD_REQUEST_DENIED has been reported

Parameters:
status the status of the request to pass to the callback
request the request whose processing is finished

References icd_request_status_names, ILOG_DEBUG, and state.

Referenced by icd_request_cancel(), icd_request_connect_iaps(), icd_request_make(), icd_request_merge(), icd_request_retry_cb(), icd_request_try_iap(), and icd_request_try_iap_cb().


Variable Documentation

const gchar* icd_request_status_names[ICD_REQUEST_MAX]

Initial value:

 {
  "ICD_REQUEST_POLICY_PENDING",
  "ICD_REQUEST_WAITING",
  "ICD_REQUEST_CHANGETO",
  "ICD_REQUEST_MERGED",
  "ICD_REQUEST_CONNECTING_IAPS",
  "ICD_REQUEST_SUCCEEDED",
  "ICD_REQUEST_DENIED",
  "ICD_REQUEST_DISCONNECTED"
}
ICd request status names

Referenced by icd_request_merge(), and icd_request_update_status().


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