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
00052 #define ICD_POLICY_ATTRIBUTE_ALWAYS_ONLINE 0x40
00053
00057 struct icd_policy_request {
00059 gpointer request_token;
00061 guint attrs;
00063 gchar *service_type;
00065 guint service_attrs;
00067 gchar *service_id;
00069 gchar *network_type;
00071 guint network_attrs;
00073 gchar *network_id;
00075 gint network_priority;
00076 };
00077
00078
00080 enum icd_policy_scan_status {
00082 ICD_POLICY_SCAN_NEW_NETWORK = 0,
00084 ICD_POLICY_SCAN_UPDATE_NETWORK,
00086 ICD_POLICY_SCAN_EXPIRED_NETWORK,
00088 ICD_POLICY_SCAN_DONE
00089 };
00090
00098 typedef void
00099 (*icd_policy_request_new_cb_fn) (enum icd_policy_status status,
00100 struct icd_policy_request *new_request,
00101 gpointer policy_token);
00102
00113 typedef void
00114 (*icd_policy_request_new_fn) (struct icd_policy_request *new_request,
00115 const GSList *existing_requests,
00116 icd_policy_request_new_cb_fn policy_done_cb,
00117 gpointer policy_token,
00118 gpointer *private);
00125 typedef void
00126 (*icd_policy_request_cancel_fn) (struct icd_policy_request *request,
00127 gpointer *private);
00128
00129
00136 typedef enum icd_policy_status
00137 (*icd_policy_nw_connect_fn) (struct icd_policy_request *network,
00138 GSList *existing_connections,
00139 gpointer *private);
00140
00148 typedef enum icd_policy_status
00149 (*icd_policy_nw_connection_restart_fn) (struct icd_policy_request *network,
00150 guint restart_count,
00151 gpointer *private);
00152
00153
00159 typedef void
00160 (*icd_policy_nw_connected_fn) (struct icd_policy_request *network,
00161 GSList *existing_connections,
00162 gpointer *private);
00163
00172 typedef enum icd_policy_status
00173 (*icd_policy_nw_disconnect_fn) (struct icd_policy_request *network,
00174 gint reference_count,
00175 GSList *existing_connections,
00176 gpointer *private);
00177
00185 typedef void
00186 (*icd_policy_nw_disconnected_fn) (struct icd_policy_request *network,
00187 const gchar *err_str,
00188 GSList *existing_connections,
00189 gpointer *private);
00190
00195 typedef void (*icd_policy_nw_scan_stop_fn) (const gchar *network_type,
00196 gpointer *private);
00197
00202 typedef void (*icd_policy_nw_scan_start_fn) (const gchar *network_type,
00203 gpointer *private);
00204
00209 typedef void (*icd_policy_destruct_fn) (gpointer *private);
00210
00219 typedef gboolean
00220 (*icd_policy_network_priority_fn)(const gchar *srv_type,
00221 const gchar *srv_id,
00222 const gchar *network_type,
00223 const guint network_attrs,
00224 gint *network_priority);
00225
00230 typedef gboolean
00231 (*icd_policy_service_module_check_fn)(const gchar *network_type);
00232
00234 struct icd_policy_api {
00236 gpointer private;
00238 icd_policy_request_new_fn new_request;
00240 icd_policy_request_cancel_fn cancel_request;
00241
00243 icd_policy_nw_connect_fn connect;
00245 icd_policy_nw_connection_restart_fn restart;
00247 icd_policy_nw_connected_fn connected;
00249 icd_policy_nw_disconnect_fn disconnect;
00251 icd_policy_nw_disconnected_fn disconnected;
00252
00254 icd_policy_nw_scan_start_fn scan_start;
00256 icd_policy_nw_scan_stop_fn scan_stop;
00257
00259 icd_policy_destruct_fn destruct;
00260
00262 icd_policy_network_priority_fn priority;
00263 };
00264
00278 typedef void
00279 (*icd_policy_nw_add_fn) (struct icd_policy_request *request,
00280 gchar *service_type,
00281 guint service_attrs,
00282 gchar *service_id,
00283 gchar *network_type,
00284 guint network_attrs,
00285 gchar *network_id,
00286 gint network_priority);
00287
00294 typedef void
00295 (*icd_policy_request_merge_fn) (struct icd_policy_request *request_to_merge,
00296 struct icd_policy_request *existing_request);
00297
00308 typedef void (*icd_policy_request_make_new_fn) (guint policy_attrs,
00309 gchar *service_type,
00310 guint service_attrs,
00311 gchar *service_id,
00312 gchar *network_type,
00313 guint network_attrs,
00314 gchar *network_id);
00315
00331 typedef void
00332 (*icd_policy_scan_cb_fn) (const guint status,
00333 const gchar *service_name,
00334 const gchar *service_type,
00335 const guint service_attrs,
00336 const gchar *service_id,
00337 gint service_priority,
00338 const gchar *network_name,
00339 const gchar *network_type,
00340 const guint network_attrs,
00341 const gchar *network_id,
00342 gint network_priority,
00343 const enum icd_nw_levels signal,
00344 gpointer user_data);
00345
00355 typedef void (*icd_policy_scan_start_fn) (const gchar *type,
00356 const guint scope,
00357 icd_policy_scan_cb_fn cb,
00358 gpointer user_data);
00359
00364 typedef void (*icd_policy_scan_stop_fn) (icd_policy_scan_cb_fn cb,
00365 gpointer user_data);
00366
00370 typedef void (*icd_policy_nw_close_fn) (struct icd_policy_request *network);
00371
00383 typedef void
00384 (*icd_policy_init_fn) (struct icd_policy_api *policy_api,
00385 icd_policy_nw_add_fn add_network,
00386 icd_policy_request_merge_fn merge_requests,
00387 icd_policy_request_make_new_fn make_request,
00388 icd_policy_scan_start_fn scan_start,
00389 icd_policy_scan_stop_fn scan_stop,
00390 icd_policy_nw_close_fn nw_close,
00391 icd_policy_network_priority_fn priority,
00392 icd_policy_service_module_check_fn srv_check);
00393
00396 #endif