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)
icd_requesticd_request_find (const gchar *network_type, const guint network_attrs, const gchar *network_id)
icd_requesticd_request_find_by_iap (const gchar *network_type, const guint network_attrs, const gchar *network_id)
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)
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

enum icd_request_status

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

void icd_request_cancel ( struct icd_request request,
guint  policy_attrs 
)

Cancel a request. The request will be freed when the icd_request_try_iap_cb() callback is called at the time of IAP disconnection

Parameters:
request the request
policy_attrs ICD_POLICY_ATTRIBUTE_* attributes

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

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

Callback for the new_connection policy request.

Parameters:
status status of the policy request
req the policy request structure

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

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

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

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

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

Find a request by IAP id

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

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().

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

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

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

static void icd_request_free ( struct icd_request request  )  [static]

Free an icd_request structure

Parameters:
request the request

void icd_request_free_iaps ( struct icd_request request  ) 

Free memory allocated for all IAPs in a request

Parameters:
request the request

void icd_request_make ( struct icd_request request  ) 

Make a request for a new network connection.

Parameters:
request the request - do not use after calling this function, as the request may be freed without any further notice

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

gboolean icd_request_merge ( struct icd_request merge_request,
struct icd_request existing 
)

Merge two requets

Parameters:
merge_request request that is to be merged and freed
existing the request to merge with
Returns:
TRUE on success, FALSE on failure

Todo:
we should really pass a token to the modules and look up the existing pointer based on this token, or at least verify that this request exists

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 
)

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.

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

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

void icd_request_send_nack ( struct icd_request request  ) 

Send a NACK to all D-Bus listeners

Parameters:
request the request to NACK

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

void icd_request_tracking_info_add ( struct icd_request request,
struct icd_tracking_info track 
)

Add tracking info to a request

Parameters:
request the request
track tracking info

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

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

static void icd_request_tracking_info_free ( struct icd_request request  )  [static]

Free all tracking info associated with a request

Parameters:
request the request

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

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

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

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


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


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