30 |
|
|
31 |
typedef struct |
typedef struct |
32 |
{ |
{ |
33 |
char shortopt; |
char shortopt; /* h & V are reserved */ |
34 |
char *longopt; |
char *longopt; /* help & version are reserver */ |
35 |
char *name; |
char *name; |
36 |
enum |
enum |
37 |
{ boolean, integer, string } |
{ boolean, integer, string } |
38 |
type; |
type; |
39 |
bool_t defined; |
bool_t defined; |
40 |
|
bool_t allocated; |
41 |
union |
union |
42 |
{ |
{ |
43 |
bool_t boolean; |
bool_t boolean; |
45 |
int integer; |
int integer; |
46 |
} |
} |
47 |
value; |
value; |
48 |
|
char *descr; |
49 |
|
char *param_name; |
50 |
|
int section; |
51 |
|
union |
52 |
|
{ |
53 |
|
int (*check_boolean) (bool_t); |
54 |
|
int (*check_string) (char *); |
55 |
|
int (*check_integer) (int); |
56 |
|
} |
57 |
|
checkfn; |
58 |
} |
} |
59 |
param_t; |
param_t; |
60 |
|
|
64 |
#define PARAM_BOOLEAN(x) param[x].value.boolean |
#define PARAM_BOOLEAN(x) param[x].value.boolean |
65 |
#define PARAM_INTEGER(x) param[x].value.integer |
#define PARAM_INTEGER(x) param[x].value.integer |
66 |
|
|
67 |
|
/* Be carreful, parameters order *MUST* correspond */ |
68 |
enum |
enum |
69 |
{ |
{ |
70 |
__access_method, |
__access_method, |
95 |
__ip_up, |
__ip_up, |
96 |
__ip_down, |
__ip_down, |
97 |
|
|
98 |
|
#ifdef WITH_MODEM |
99 |
__modem_device, |
__modem_device, |
100 |
__modem_rtscts, |
__modem_rtscts, |
101 |
__modem_initstr1, |
__modem_initstr1, |
126 |
__modem_retry_delay, |
__modem_retry_delay, |
127 |
__modem_abort_busy, |
__modem_abort_busy, |
128 |
__modem_abort_dialtone, |
__modem_abort_dialtone, |
129 |
|
#endif /* WITH_MODEM */ |
130 |
|
|
131 |
|
#ifdef WITH_CABLE |
132 |
__cable_aol_host, |
__cable_aol_host, |
133 |
__cable_aol_port, |
__cable_aol_port, |
134 |
__cable_interface, |
__cable_interface, |
135 |
__cable_connect_ip, |
__cable_connect_ip, |
136 |
|
#endif /* WITH_CABLE */ |
137 |
|
|
138 |
__last_param /* not a parameter */ |
__last_param /* not a parameter */ |
139 |
}; |
}; |
140 |
|
|
141 |
|
/* Macros for options access facility */ |
142 |
#define PARAM_ACCESS_METHOD PARAM_STRING(__access_method) |
#define PARAM_ACCESS_METHOD PARAM_STRING(__access_method) |
143 |
#define PARAM_PROTOCOL PARAM_STRING(__protocol) |
#define PARAM_PROTOCOL PARAM_STRING(__protocol) |
144 |
#define PARAM_INTERFACE_TYPE PARAM_STRING(__interface_type) |
#define PARAM_INTERFACE_TYPE PARAM_STRING(__interface_type) |
155 |
#define PARAM_IP_UP PARAM_STRING(__ip_up) |
#define PARAM_IP_UP PARAM_STRING(__ip_up) |
156 |
#define PARAM_IP_DOWN PARAM_STRING(__ip_up) |
#define PARAM_IP_DOWN PARAM_STRING(__ip_up) |
157 |
|
|
158 |
|
#ifdef WITH_MODEM |
159 |
#define PARAM_MODEM_DEVICE PARAM_STRING(__modem_device) |
#define PARAM_MODEM_DEVICE PARAM_STRING(__modem_device) |
160 |
#define PARAM_MODEM_RTSCTS PARAM_BOOLEAN(__modem_rtscts) |
#define PARAM_MODEM_RTSCTS PARAM_BOOLEAN(__modem_rtscts) |
161 |
#define PARAM_MODEM_INITSTR(i) PARAM_STRING(__modem_initstr1 + i - 1) |
#define PARAM_MODEM_INITSTR(i) PARAM_STRING(__modem_initstr1 + i - 1) |
173 |
#define PARAM_MODEM_RETRY_DELAY PARAM_INTEGER(__modem_retry_delay) |
#define PARAM_MODEM_RETRY_DELAY PARAM_INTEGER(__modem_retry_delay) |
174 |
#define PARAM_MODEM_ABORT_BUSY PARAM_BOOLEAN(__modem_abort_busy) |
#define PARAM_MODEM_ABORT_BUSY PARAM_BOOLEAN(__modem_abort_busy) |
175 |
#define PARAM_MODEM_ABORT_DIALTONE PARAM_BOOLEAN(__modem_abort_dialtone) |
#define PARAM_MODEM_ABORT_DIALTONE PARAM_BOOLEAN(__modem_abort_dialtone) |
176 |
|
#endif /* WITH_MODEM */ |
177 |
|
|
178 |
|
#ifdef WITH_CABLE |
179 |
#define PARAM_CABLE_AOL_HOST PARAM_STRING(__cable_aol_host) |
#define PARAM_CABLE_AOL_HOST PARAM_STRING(__cable_aol_host) |
180 |
#define PARAM_CABLE_AOL_PORT PARAM_INTEGER(__cable_aol_port) |
#define PARAM_CABLE_AOL_PORT PARAM_INTEGER(__cable_aol_port) |
181 |
#define PARAM_CABLE_INTERFACE PARAM_STRING(__cable_interface) |
#define PARAM_CABLE_INTERFACE PARAM_STRING(__cable_interface) |
182 |
#define PARAM_CABLE_CONNECT_IP PARAM_STRING(__cable_connect_ip) |
#define PARAM_CABLE_CONNECT_IP PARAM_STRING(__cable_connect_ip) |
183 |
|
#endif /* WITH_CABLE */ |
184 |
|
|
185 |
#define DEFAULT_CONFIG "/etc/pengfork/pengfork.cfg" |
#define DEFAULT_CONFIG "/etc/pengfork/pengfork.cfg" |
186 |
#define HOME_CONFIG "pengfork.cfg" |
#define HOME_CONFIG "pengfork.cfg" |