00001 #ifndef POLICY_API_H
00002 #define POLICY_API_H
00003
00012 #include <glib.h>
00013
00014 #include "network_api.h"
00015
00021 enum icd_policy_status {
00023 ICD_POLICY_ACCEPTED = 0,
00025 ICD_POLICY_MERGED,
00027 ICD_POLICY_WAITING,
00029 ICD_POLICY_REJECTED
00030 };
00031
00033 #define ICD_POLICY_ATTRIBUTE_CONN_UI 0x01
00034
00036 #define ICD_POLICY_ATTRIBUTE_BACKGROUND 0x02
00037
00040 #define ICD_POLICY_ATTRIBUTE_CONNECTIONS_FAILED 0x04
00041
00043 #define ICD_POLICY_ATTRIBUTE_HAS_CONNECTIONS 0x08
00044
00046 #define ICD_POLICY_ATTRIBUTE_NO_INTERACTION 0x10
00047
00049 #define ICD_POLICY_ATTRIBUTE_ALWAYS_ONLINE_CHANGE 0x20
00050
00054 struct icd_policy_request {
00056 gpointer request_token;
00058 guint attrs;
00060 gchar *service_type;
00062 guint service_attrs;
00064 gchar *service_id;
00066 gchar *network_type;
00068 guint network_attrs;
00070 gchar *network_id;
00072 gint network_priority;
00073 };
00074
00075
00077 enum icd_policy_scan_status {
00079 ICD_POLICY_SCAN_NEW_NETWORK = 0,
00081 ICD_POLICY_SCAN_UPDATE_NETWORK,
00083 ICD_POLICY_SCAN_EXPIRED_NETWORK,
00085 ICD_POLICY_SCAN_DONE
00086 };
00087
00095 typedef void
00096 (*icd_policy_request_new_cb_fn) (enum icd_policy_status status,
00097 struct icd_policy_request *new_request,
00098 gpointer policy_token);
00099
00110 typedef void
00111 (*icd_policy_request_new_fn) (struct icd_policy_request *new_request,
00112 const GSList *existing_requests,
00113 icd_policy_request_new_cb_fn policy_done_cb,
00114 gpointer policy_token,
00115 gpointer *private);
00122 typedef void
00123 (*icd_policy_request_cancel_fn) (struct icd_policy_request *request,
00124 gpointer *private);
00125
00126
00133 typedef enum icd_policy_status
00134 (*icd_policy_nw_connect_fn) (struct icd_policy_request *network,
00135 GSList *existing_connections,
00136 gpointer *private);
00137
00145 typedef enum icd_policy_status
00146 (*icd_policy_nw_connection_restart_fn) (struct icd_policy_request *network,
00147 guint restart_count,
00148 gpointer *private);
00149
00150
00156 typedef void
00157 (*icd_policy_nw_connected_fn) (struct icd_policy_request *network,
00158 GSList *existing_connections,
00159 gpointer *private);
00160
00169 typedef enum icd_policy_status
00170 (*icd_policy_nw_disconnect_fn) (struct icd_policy_request *network,
00171 gint reference_count,
00172 GSList *existing_connections,
00173 gpointer *private);
00174
00182 typedef void
00183 (*icd_policy_nw_disconnected_fn) (struct icd_policy_request *network,
00184 const gchar *err_str,
00185 GSList *existing_connections,
00186 gpointer *private);
00187
00192 typedef void (*icd_policy_nw_scan_stop_fn) (const gchar *network_type,
00193 gpointer *private);
00194
00199 typedef void (*icd_policy_nw_scan_start_fn) (const gchar *network_type,
00200 gpointer *private);
00201
00206 typedef void (*icd_policy_destruct_fn) (gpointer *private);
00207
00216 typedef gboolean
00217 (*icd_policy_network_priority_fn)(const gchar *srv_type,
00218 const gchar *srv_id,
00219 const gchar *network_type,
00220 const guint network_attrs,
00221 gint *network_priority);
00222
00223
00225 struct icd_policy_api {
00227 gpointer private;
00229 icd_policy_request_new_fn new_request;
00231 icd_policy_request_cancel_fn cancel_request;
00232
00234 icd_policy_nw_connect_fn connect;
00236 icd_policy_nw_connection_restart_fn restart;
00238 icd_policy_nw_connected_fn connected;
00240 icd_policy_nw_disconnect_fn disconnect;
00242 icd_policy_nw_disconnected_fn disconnected;
00243
00245 icd_policy_nw_scan_start_fn scan_start;
00247 icd_policy_nw_scan_stop_fn scan_stop;
00248
00250 icd_policy_destruct_fn destruct;
00251
00253 icd_policy_network_priority_fn priority;
00254 };
00255
00269 typedef void
00270 (*icd_policy_nw_add_fn) (struct icd_policy_request *request,
00271 gchar *service_type,
00272 guint service_attrs,
00273 gchar *service_id,
00274 gchar *network_type,
00275 guint network_attrs,
00276 gchar *network_id,
00277 gint network_priority);
00278
00285 typedef void
00286 (*icd_policy_request_merge_fn) (struct icd_policy_request *request_to_merge,
00287 struct icd_policy_request *existing_request);
00288
00299 typedef void (*icd_policy_request_make_new_fn) (guint policy_attrs,
00300 gchar *service_type,
00301 guint service_attrs,
00302 gchar *service_id,
00303 gchar *network_type,
00304 guint network_attrs,
00305 gchar *network_id);
00306
00322 typedef void
00323 (*icd_policy_scan_cb_fn) (const guint status,
00324 const gchar *service_name,
00325 const gchar *service_type,
00326 const guint service_attrs,
00327 const gchar *service_id,
00328 gint service_priority,
00329 const gchar *network_name,
00330 const gchar *network_type,
00331 const guint network_attrs,
00332 const gchar *network_id,
00333 gint network_priority,
00334 const enum icd_nw_levels signal,
00335 gpointer user_data);
00336
00346 typedef void (*icd_policy_scan_start_fn) (const gchar *type,
00347 const guint scope,
00348 icd_policy_scan_cb_fn cb,
00349 gpointer user_data);
00350
00355 typedef void (*icd_policy_scan_stop_fn) (icd_policy_scan_cb_fn cb,
00356 gpointer user_data);
00357
00361 typedef void (*icd_policy_nw_close_fn) (struct icd_policy_request *network);
00362
00373 typedef void
00374 (*icd_policy_init_fn) (struct icd_policy_api *policy_api,
00375 icd_policy_nw_add_fn add_network,
00376 icd_policy_request_merge_fn merge_requests,
00377 icd_policy_request_make_new_fn make_request,
00378 icd_policy_scan_start_fn scan_start,
00379 icd_policy_scan_stop_fn scan_stop,
00380 icd_policy_nw_close_fn nw_close,
00381 icd_policy_network_priority_fn priority);
00382
00385 #endif