00001 #ifndef NETWORK_API_H
00002 #define NETWORK_API_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00040 #include <sys/types.h>
00041 #include <unistd.h>
00042 #include <glib.h>
00043
00044
00173 #define ICD_NW_MODULE_VERSION "0.87+fremantle9+0m5"
00174
00175 #include "network_api_defines.h"
00176
00177
00182 typedef void (*icd_nw_layer_renew_cb_fn) (enum icd_nw_renew_status status,
00183 gpointer renew_cb_token);
00192 typedef void (*icd_nw_layer_renew_fn) (const gchar *network_type,
00193 const guint network_attrs,
00194 const gchar *network_id,
00195 icd_nw_layer_renew_cb_fn renew_cb,
00196 gpointer renew_cb_token,
00197 gpointer *private);
00198
00203 typedef void
00204 (*icd_nw_ip_down_cb_fn) (const enum icd_nw_status status,
00205 const gpointer ip_down_cb_token);
00218 typedef void
00219 (*icd_nw_ip_down_fn) (const gchar *network_type,
00220 const guint network_attrs,
00221 const gchar *network_id,
00222 const gchar *interface_name,
00223 icd_nw_ip_down_cb_fn ip_down_cb,
00224 gpointer ip_down_cb_token,
00225 gpointer *private);
00226
00234 typedef void (*icd_nw_ip_up_cb_fn) (const enum icd_nw_status status,
00235 const gchar *err_str,
00236 const gpointer ip_up_cb_token,
00237 ...);
00250 typedef void
00251 (*icd_nw_ip_up_fn) (const gchar *network_type,
00252 const guint network_attrs,
00253 const gchar *network_id,
00254 const gchar *interface_name,
00255 icd_nw_ip_up_cb_fn ip_up_cb,
00256 gpointer ip_up_cb_token,
00257 gpointer *private);
00258
00274 typedef void (*icd_nw_ip_addr_info_cb_fn) (const gpointer addr_info_cb_token,
00275 const gchar *network_type,
00276 const guint network_attrs,
00277 const gchar *network_id,
00278 gchar *ip_address,
00279 gchar *ip_netmask,
00280 gchar *ip_gateway,
00281 gchar *ip_dns1,
00282 gchar *ip_dns2,
00283 gchar *ip_dns3);
00293 typedef void (*icd_nw_ip_addr_info_fn) (const gchar *network_type,
00294 const guint network_attrs,
00295 const gchar *network_id,
00296 gpointer *private,
00297 icd_nw_ip_addr_info_cb_fn cb,
00298 const gpointer addr_info_cb_token);
00299
00311 typedef void (*icd_nw_ip_stats_cb_fn) (const gpointer ip_stats_cb_token,
00312 const gchar *network_type,
00313 const guint network_attrs,
00314 const gchar *network_id,
00315 guint time_active,
00316 guint rx_bytes,
00317 guint tx_bytes);
00318
00327 typedef void (*icd_nw_ip_stats_fn) (const gchar *network_type,
00328 const guint network_attrs,
00329 const gchar *network_id,
00330 gpointer *private,
00331 icd_nw_ip_stats_cb_fn cb,
00332 const gpointer ip_stats_cb_token);
00333
00338 typedef void
00339 (*icd_nw_link_pre_down_cb_fn) (const enum icd_nw_status status,
00340 const gpointer link_pre_down_cb_token);
00351 typedef void
00352 (*icd_nw_link_pre_down_fn) (const gchar *network_type,
00353 const guint network_attrs,
00354 const gchar *network_id,
00355 const gchar *interface_name,
00356 icd_nw_link_pre_down_cb_fn link_pre_down_cb,
00357 const gpointer link_pre_down_cb_token,
00358 gpointer *private);
00359
00367 typedef void
00368 (*icd_nw_link_post_up_cb_fn) (const enum icd_nw_status status,
00369 const gchar *err_str,
00370 const gpointer link_post_up_cb_token,
00371 ...);
00383 typedef void
00384 (*icd_nw_link_post_up_fn) (const gchar *network_type,
00385 const guint network_attrs,
00386 const gchar *network_id,
00387 const gchar *interface_name,
00388 icd_nw_link_post_up_cb_fn link_post_up,
00389 const gpointer link_post_up_cb_token,
00390 gpointer *private);
00391
00403 typedef void
00404 (*icd_nw_link_post_stats_cb_fn) (const gpointer link_post_stats_cb_token,
00405 const gchar *network_type,
00406 const guint network_attrs,
00407 const gchar *network_id,
00408 guint time_active,
00409 guint rx_bytes,
00410 guint tx_bytes);
00411
00420 typedef void
00421 (*icd_nw_link_post_stats_fn) (const gchar *network_type,
00422 const guint network_attrs,
00423 const gchar *network_id,
00424 gpointer *private,
00425 icd_nw_link_post_stats_cb_fn cb,
00426 const gpointer link_post_stats_cb_token);
00427
00432 typedef void
00433 (*icd_nw_link_down_cb_fn) (const enum icd_nw_status status,
00434 const gpointer link_down_cb_token);
00445 typedef void
00446 (*icd_nw_link_down_fn) (const gchar *network_type,
00447 const guint network_attrs,
00448 const gchar *network_id,
00449 const gchar *interface_name,
00450 icd_nw_link_down_cb_fn link_down_cb,
00451 const gpointer link_down_cb_token,
00452 gpointer *private);
00453
00463 typedef void
00464 (*icd_nw_link_up_cb_fn) (const enum icd_nw_status status,
00465 const gchar *err_str,
00466 const gchar *interface_name,
00467 const gpointer link_up_cb_token,
00468 ...);
00477 typedef void
00478 (*icd_nw_link_up_fn) (const gchar *network_type,
00479 const guint network_attrs,
00480 const gchar *network_id,
00481 icd_nw_link_up_cb_fn link_up_cb,
00482 const gpointer link_up_cb_token,
00483 gpointer *private);
00484
00499 typedef void (*icd_nw_link_stats_cb_fn) (const gpointer link_stats_cb_token,
00500 const gchar *network_type,
00501 const guint network_attrs,
00502 const gchar *network_id,
00503 guint time_active,
00504 gint signal,
00505 gchar *station_id,
00506 gint dB,
00507 guint rx_bytes,
00508 guint tx_bytes);
00509
00518 typedef void (*icd_nw_link_stats_fn) (const gchar *network_type,
00519 const guint network_attrs,
00520 const gchar *network_id,
00521 gpointer *private,
00522 icd_nw_link_stats_cb_fn cb,
00523 const gpointer link_stats_cb_token);
00524
00536 typedef void
00537 (*icd_nw_search_cb_fn) (enum icd_network_search_status status,
00538 gchar *network_name,
00539 gchar *network_type,
00540 const guint network_attrs,
00541 gchar *network_id,
00542 enum icd_nw_levels signal,
00543 gchar *station_id,
00544 gint dB,
00545 const gpointer search_cb_token);
00557 typedef void
00558 (*icd_nw_start_search_fn) (const gchar *network_type,
00559 guint search_scope,
00560 icd_nw_search_cb_fn search_cb,
00561 const gpointer search_cb_token,
00562 gpointer *private);
00568 typedef void
00569 (*icd_nw_stop_search_fn) (gpointer *private);
00570
00576 typedef void
00577 (*icd_nw_child_exit_fn) (const pid_t pid,
00578 const gint exit_value,
00579 gpointer *private);
00580
00581
00587 typedef void
00588 (*icd_nw_network_destruct_fn) (gpointer *private);
00589
00604 struct icd_nw_api {
00607 gchar *version;
00608
00610 gpointer private;
00611
00614 icd_nw_ip_down_fn ip_down;
00617 icd_nw_ip_up_fn ip_up;
00619 icd_nw_ip_addr_info_fn ip_addr_info;
00621 icd_nw_ip_stats_fn ip_stats;
00622
00624 icd_nw_link_pre_down_fn link_pre_down;
00626 icd_nw_link_post_up_fn link_post_up;
00628 icd_nw_link_post_stats_fn link_post_stats;
00629
00631 icd_nw_link_down_fn link_down;
00633 icd_nw_link_up_fn link_up;
00635 icd_nw_link_stats_fn link_stats;
00636
00638 guint search_lifetime;
00641 guint search_interval;
00643 icd_nw_start_search_fn start_search;
00645 icd_nw_stop_search_fn stop_search;
00646
00648 icd_nw_child_exit_fn child_exit;
00649
00652 icd_nw_network_destruct_fn network_destruct;
00653
00655 icd_nw_layer_renew_fn ip_renew;
00657 icd_nw_layer_renew_fn link_post_renew;
00659 icd_nw_layer_renew_fn link_renew;
00660 };
00661
00662
00669 typedef void (*icd_nw_watch_pid_fn) (const pid_t pid,
00670 gpointer watch_cb_token);
00671
00682 typedef void (*icd_nw_close_fn) (enum icd_nw_status status,
00683 const gchar *err_str,
00684 const gchar *network_type,
00685 const guint network_attrs,
00686 const gchar *network_id);
00687
00693 typedef void (*icd_nw_status_change_fn) (gchar *network_type,
00694 guint network_attrs,
00695 gchar *network_id);
00696
00703 typedef void (*icd_nw_renew_fn) (enum icd_nw_layer renew_layer,
00704 const gchar *network_type,
00705 const guint network_attrs,
00706 const gchar *network_id);
00707
00722 typedef gboolean
00723 (*icd_nw_init_fn) (struct icd_nw_api *network_api,
00724 icd_nw_watch_pid_fn watch_fn,
00725 gpointer watch_fn_token,
00726 icd_nw_close_fn close_fn,
00727 icd_nw_status_change_fn status_change_fn,
00728 icd_nw_renew_fn renew_fn);
00729
00732 #ifdef __cplusplus
00733 }
00734 #endif
00735
00736 #endif