00001 #ifndef ICD_IAP_H 00002 #define ICD_IAP_H 00003 00012 #include "policy_api.h" 00013 00019 enum icd_iap_state { 00021 ICD_IAP_STATE_DISCONNECTED = 0, 00023 ICD_IAP_STATE_SCRIPT_PRE_UP, 00025 ICD_IAP_STATE_LINK_UP, 00027 ICD_IAP_STATE_LINK_POST_UP, 00029 ICD_IAP_STATE_IP_UP, 00031 ICD_IAP_STATE_SRV_UP, 00033 ICD_IAP_STATE_SCRIPT_POST_UP, 00035 ICD_IAP_STATE_SAVING, 00037 ICD_IAP_STATE_CONNECTED, 00039 ICD_IAP_STATE_CONNECTED_DOWN, 00041 ICD_IAP_STATE_SRV_DOWN, 00043 ICD_IAP_STATE_IP_DOWN, 00045 ICD_IAP_STATE_IP_RESTART_SCRIPTS, 00047 ICD_IAP_STATE_LINK_PRE_DOWN, 00050 ICD_IAP_STATE_LINK_PRE_RESTART_SCRIPTS, 00052 ICD_IAP_STATE_LINK_DOWN, 00055 ICD_IAP_STATE_LINK_RESTART_SCRIPTS, 00057 ICD_IAP_STATE_SCRIPT_POST_DOWN, 00058 00060 ICD_IAP_MAX_STATES 00061 }; 00062 00064 enum icd_iap_status { 00066 ICD_IAP_CREATED = 0, 00068 ICD_IAP_DISCONNECTED, 00070 ICD_IAP_BUSY, 00072 ICD_IAP_FAILED 00073 }; 00074 00075 struct icd_iap; 00076 00082 typedef void (*icd_iap_request_cb_fn) (enum icd_iap_status status, 00083 struct icd_iap *iap, 00084 gpointer user_data); 00085 00087 struct icd_iap_disconnect_data { 00089 gpointer function; 00091 gpointer *private; 00092 }; 00093 00095 struct icd_iap_env { 00097 gchar *addrfam; 00099 GSList *envlist; 00100 }; 00101 00103 struct icd_iap { 00105 gchar *id; 00109 gboolean id_is_local; 00110 00112 enum icd_iap_state state; 00114 gboolean limited_conn; 00115 00117 gchar *service_name; 00119 gchar *network_name; 00122 struct icd_policy_request connection; 00124 gchar *interface_name; 00126 guint idletimer_id; 00127 00129 struct icd_network_module *busy; 00130 00132 GSList *network_modules; 00134 GSList *current_module; 00136 GSList *ip_down_list; 00139 GSList *link_pre_down_list; 00141 GSList *link_down_list; 00142 00144 gpointer srv_connect_cb; 00146 gpointer srv_connect_cb_user_data; 00148 gpointer srv_disconnect_cb; 00150 gpointer srv_disconnect_cb_user_data; 00151 00153 enum icd_nw_layer restart_layer; 00156 enum icd_iap_state restart_state; 00158 guint restart_count; 00160 enum icd_nw_layer renew_layer; 00162 GSList *current_renew_module; 00163 00166 gboolean user_interaction_done; 00168 gchar *err_str; 00169 00171 gpointer save_dlg; 00173 icd_iap_request_cb_fn request_cb; 00175 gpointer request_cb_user_data; 00176 00178 GSList *script_env; 00180 GSList *script_pids; 00181 }; 00182 00191 typedef gboolean (*icd_iap_foreach_fn) (struct icd_iap *iap, 00192 gpointer user_data); 00193 00194 00195 void icd_iap_free (struct icd_iap *iap); 00196 struct icd_iap *icd_iap_new (void); 00197 gboolean icd_iap_id_create (struct icd_iap *iap, const gchar *new_name); 00198 void icd_iap_connect (struct icd_iap* iap, 00199 icd_iap_request_cb_fn request_cb, 00200 gpointer user_data); 00201 void icd_iap_disconnect (struct icd_iap *iap, const gchar *err_str); 00202 00207 void icd_iap_renew (struct icd_iap *iap, enum icd_nw_layer renew_layer); 00208 00215 void icd_iap_restart (struct icd_iap *iap, enum icd_nw_layer restart_layer); 00216 guint icd_iap_get_ipinfo (struct icd_iap *iap, 00217 icd_nw_ip_addr_info_cb_fn cb, 00218 gpointer user_data); 00219 gboolean icd_iap_get_ip_stats (struct icd_iap *iap, 00220 icd_nw_ip_stats_cb_fn cb, 00221 gpointer user_data); 00222 gboolean icd_iap_get_link_post_stats (struct icd_iap *iap, 00223 icd_nw_link_post_stats_cb_fn cb, 00224 gpointer user_data); 00225 gboolean icd_iap_get_link_stats (struct icd_iap *iap, 00226 icd_nw_link_stats_cb_fn cb, 00227 gpointer user_data); 00228 struct icd_iap* icd_iap_find (const gchar *network_type, 00229 const guint network_attrs, 00230 const gchar *network_id); 00231 struct icd_iap* icd_iap_find_by_id (const gchar *iap_id, 00232 const gboolean is_local); 00233 struct icd_iap *icd_iap_foreach (icd_iap_foreach_fn fn, gpointer user_data); 00234 gboolean icd_iap_rename (struct icd_iap *iap, const gchar *name); 00235 00238 #endif