Classes | |
struct | icd_script_data |
Defines | |
#define | ICD_SCRIPT_MIN_TIMEOUT 1 |
#define | ICD_SCRIPT_DEFAULT_TIMEOUT 15 |
#define | ICD_SCRIPT_MAX_TIMEOUT 120 |
#define | ICD_SCRIPT_GCONF_PATH ICD_GCONF_SETTINGS "/network_scripts/timeout" |
#define | SCRIPT_IFACE "IFACE" |
#define | SCRIPT_LOGICAL "LOGICAL" |
#define | SCRIPT_ADDRFAM "ADDRFAM" |
#define | SCRIPT_METHOD "METHOD" |
#define | SCRIPT_MODE "MODE" |
#define | SCRIPT_PHASE "PHASE" |
#define | SCRIPT_VERBOSITY "VERBOSITY" |
#define | SCRIPT_VERBOSITY_VALUE "0" |
#define | SCRIPT_PATH "PATH" |
#define | SCRIPT_PATH_VALUE |
#define | SCRIPT_IAP_ID "ICD_CONNECTION_ID" |
#define | SCRIPT_IAP_TYPE "ICD_CONNECTION_TYPE" |
#define | SCRIPT_PROXY_UNSET "ICD_PROXY_UNSET" |
Typedefs | |
typedef void(* | icd_script_cb_fn )(const pid_t pid, const gint exit_value, gpointer user_data) |
Functions | |
static gboolean | string_equal (const gchar *a, const gchar *b) |
static GSList ** | icd_script_get () |
gboolean | icd_script_notify_pid (const pid_t pid, const gint exit_value) |
static gboolean | icd_script_timeout (gpointer data) |
static gboolean | icd_script_exec (const gchar *script, const gchar *iface, const gchar *mode, const gchar *phase, const gchar *iap_id, const gchar *iap_type, const gboolean remove_proxies, const struct icd_iap_env *env) |
static gint | icd_script_timeout_secs (void) |
static pid_t | icd_script_run (const gchar *script, const gchar *iface, const gchar *mode, const gchar *phase, const gchar *iap_id, const gchar *iap_type, gboolean remove_proxies, const struct icd_iap_env *env, icd_script_cb_fn cb, gpointer user_data) |
void | icd_script_cancel (const pid_t pid) |
pid_t | icd_script_pre_up (const gchar *iap_id, const gchar *iap_type, const struct icd_iap_env *env, icd_script_cb_fn cb, gpointer user_data) |
pid_t | icd_script_post_up (const gchar *iface, const gchar *iap_id, const gchar *iap_type, const struct icd_iap_env *env, icd_script_cb_fn cb, gpointer user_data) |
pid_t | icd_script_pre_down (const gchar *iface, const gchar *iap_id, const gchar *iap_type, gboolean remove_proxies, const struct icd_iap_env *env, icd_script_cb_fn cb, gpointer user_data) |
pid_t | icd_script_post_down (const gchar *iface, const gchar *iap_id, const gchar *iap_type, const struct icd_iap_env *env, icd_script_cb_fn cb, gpointer user_data) |
void | icd_script_add_env_vars (struct icd_iap *iap, gchar **env_vars) |
Variables | |
static const gchar const * | reserved_env_vars [] |
#define ICD_SCRIPT_DEFAULT_TIMEOUT 15 |
default time in seconds that a script can be run
Referenced by icd_script_timeout_secs().
#define ICD_SCRIPT_GCONF_PATH ICD_GCONF_SETTINGS "/network_scripts/timeout" |
gconf location for timeout value
Referenced by icd_script_timeout_secs().
#define ICD_SCRIPT_MAX_TIMEOUT 120 |
max time in seconds that a script can be run
Referenced by icd_script_timeout_secs().
#define ICD_SCRIPT_MIN_TIMEOUT 1 |
min time in seconds that a script can be run
Referenced by icd_script_timeout_secs().
#define SCRIPT_ADDRFAM "ADDRFAM" |
address family of the interface
Referenced by icd_script_exec().
#define SCRIPT_IAP_ID "ICD_CONNECTION_ID" |
ICd IAP identifier; for now escaped gconf name
Referenced by icd_script_exec().
#define SCRIPT_IAP_TYPE "ICD_CONNECTION_TYPE" |
ICd IAP type
Referenced by icd_script_exec().
#define SCRIPT_IFACE "IFACE" |
physical name of the interface being processed
Referenced by icd_script_exec().
#define SCRIPT_LOGICAL "LOGICAL" |
logical name of the interface being processed
Referenced by icd_script_exec().
#define SCRIPT_METHOD "METHOD" |
method of the interface
#define SCRIPT_MODE "MODE" |
'start' if going up, 'stop' if going down
Referenced by icd_script_exec().
#define SCRIPT_PATH "PATH" |
the command search path
Referenced by icd_script_exec().
#define SCRIPT_PATH_VALUE |
Value:
"/usr/local/sbin:/usr/local/bin:/usr/sbin:"\ "/usr/bin:/sbin:/bin"
Referenced by icd_script_exec().
#define SCRIPT_PHASE "PHASE" |
as per MODE, but with finer granularity, distinguishing the pre-up, post-up, pre-down and post-down phases
Referenced by icd_script_exec().
#define SCRIPT_PROXY_UNSET "ICD_PROXY_UNSET" |
Unset proxies
Referenced by icd_script_exec().
#define SCRIPT_VERBOSITY "VERBOSITY" |
verbosity
Referenced by icd_script_exec().
#define SCRIPT_VERBOSITY_VALUE "0" |
script verbosity value
Referenced by icd_script_exec().
typedef void(* icd_script_cb_fn)(const pid_t pid, const gint exit_value, gpointer user_data) |
Callback function called when script has exited
pid | the process id of the script that exited | |
exit_value | exit value of the script or -1 on timeout | |
user_data | user data |
void icd_script_cancel | ( | const pid_t | pid | ) |
Cancel a running script
pid | script process id |
References icd_script_get(), ILOG_INFO, icd_script_data::pid, and icd_script_data::timeout_id.
Referenced by icd_iap_script_pre_down().
static gboolean icd_script_exec | ( | const gchar * | script, | |
const gchar * | iface, | |||
const gchar * | mode, | |||
const gchar * | phase, | |||
const gchar * | iap_id, | |||
const gchar * | iap_type, | |||
const gboolean | remove_proxies, | |||
const struct icd_iap_env * | env | |||
) | [static] |
Forks and execs the network script
script | the script, i.e. 'pre-up', 'post-up', 'pre-down', 'post-down' | |
iface | interface name | |
method | address configuration method, i.e. 'static', 'manual', 'dhcp', 'ppp', etc. | |
mode | either 'start' or 'stop' | |
phase | script phase, i.e. 'pre-up', 'post-up', 'pre-down', 'post-down' | |
iap_id | Unique IAP identifier, currently the escaped iap name | |
iap_type | IAP type | |
remove_proxies | TRUE to set ICD_PROXY_UNSET=1 |
References icd_iap_env::addrfam, icd_iap_env::envlist, ILOG_DEBUG, ILOG_ERR, icd_script_data::pid, SCRIPT_ADDRFAM, SCRIPT_IAP_ID, SCRIPT_IAP_TYPE, SCRIPT_IFACE, SCRIPT_LOGICAL, SCRIPT_MODE, SCRIPT_PATH, SCRIPT_PATH_VALUE, SCRIPT_PHASE, SCRIPT_PROXY_UNSET, SCRIPT_VERBOSITY, and SCRIPT_VERBOSITY_VALUE.
Referenced by icd_script_run().
static GSList** icd_script_get | ( | ) | [static] |
Get the list of running scripts
Referenced by icd_script_cancel(), icd_script_notify_pid(), and icd_script_run().
gboolean icd_script_notify_pid | ( | const pid_t | pid, | |
const gint | exit_value | |||
) |
Notification of an exited script process
pid | the process id | |
exit_value | exit value |
References icd_script_data::cb, icd_script_get(), ILOG_DEBUG, ILOG_ERR, ILOG_INFO, icd_script_data::pid, icd_script_data::timeout_id, and icd_script_data::user_data.
Referenced by icd_exec_signal_cb().
pid_t icd_script_post_down | ( | const gchar * | iface, | |
const gchar * | iap_id, | |||
const gchar * | iap_type, | |||
const struct icd_iap_env * | env, | |||
icd_script_cb_fn | cb, | |||
gpointer | user_data | |||
) |
Run post-down scripts
iface | interface name | |
iap_id | Unique IAP identifier, currently the escaped iap name | |
iap_type | IAP type | |
env | script environment variables | |
cb | callback | |
user_data | user data for the callback |
References icd_script_run().
pid_t icd_script_post_up | ( | const gchar * | iface, | |
const gchar * | iap_id, | |||
const gchar * | iap_type, | |||
const struct icd_iap_env * | env, | |||
icd_script_cb_fn | cb, | |||
gpointer | user_data | |||
) |
Run post-up scripts
iface | interface name | |
iap_id | Unique IAP identifier, currently the escaped iap name | |
iap_type | IAP type | |
env | script environment variables | |
cb | callback | |
user_data | user data for the callback |
References icd_script_run().
Referenced by icd_iap_module_next().
pid_t icd_script_pre_down | ( | const gchar * | iface, | |
const gchar * | iap_id, | |||
const gchar * | iap_type, | |||
const gboolean | remove_proxies, | |||
const struct icd_iap_env * | env, | |||
icd_script_cb_fn | cb, | |||
gpointer | user_data | |||
) |
Run pre-down scripts
iface | interface name | |
iap_id | Unique IAP identifier, currently the escaped iap name | |
iap_type | IAP type | |
remove_proxies | remove http, etc. proxies if TRUE | |
env | script environment variables | |
cb | callback | |
user_data | user data for the callback |
References icd_script_run().
Referenced by icd_iap_script_pre_down().
pid_t icd_script_pre_up | ( | const gchar * | iap_id, | |
const gchar * | iap_type, | |||
const struct icd_iap_env * | env, | |||
icd_script_cb_fn | cb, | |||
gpointer | user_data | |||
) |
Run pre-up scripts
iap_id | Unique IAP identifier, currently the escaped iap name | |
iap_type | IAP type | |
env | script environment variables | |
cb | callback | |
user_data | user data for the callback |
References icd_script_run().
Referenced by icd_iap_run_pre_up_scripts().
static pid_t icd_script_run | ( | const gchar * | script, | |
const gchar * | iface, | |||
const gchar * | mode, | |||
const gchar * | phase, | |||
const gchar * | iap_id, | |||
const gchar * | iap_type, | |||
gboolean | remove_proxies, | |||
const struct icd_iap_env * | env, | |||
icd_script_cb_fn | cb, | |||
gpointer | user_data | |||
) | [static] |
Run the script and start waiting for the result
script | the script | |
iface | interface name | |
mode | mode | |
phase | script phase, i.e. 'pre-up', 'post-up', 'pre-down', 'post-down' | |
cb | callback function | |
user_data | user data for callback function | |
iap_id | Unique IAP identifier, currently the escaped iap name | |
iap_type | IAP type | |
remove_proxies | wheter to remove http, etc. proxies | |
env | rest of the environment variables |
References icd_script_data::cb, icd_script_exec(), icd_script_get(), icd_script_timeout(), icd_script_timeout_secs(), icd_script_data::pid, icd_script_data::timeout_id, and icd_script_data::user_data.
Referenced by icd_script_post_down(), icd_script_post_up(), icd_script_pre_down(), and icd_script_pre_up().
static gboolean icd_script_timeout | ( | gpointer | data | ) | [static] |
Script timeout function
data | the pid of the script that timed out |
References ILOG_INFO, and icd_script_data::pid.
Referenced by icd_script_run().
static gint icd_script_timeout_secs | ( | void | ) | [static] |
Read the script timeout value from gconf
References ICD_SCRIPT_DEFAULT_TIMEOUT, ICD_SCRIPT_GCONF_PATH, ICD_SCRIPT_MAX_TIMEOUT, ICD_SCRIPT_MIN_TIMEOUT, ILOG_DEBUG, and ILOG_WARN.
Referenced by icd_script_run().
static gboolean 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
a | string A | |
b | string B |
const gchar const* reserved_env_vars[] [static] |
Initial value: