6 #include "ntp_machine.h"
7 #include "ntp_data_structures.h"
12 * Configuration file name
16 # define CONFIG_FILE "/etc/ntp.conf"
17 # else /* SYS_WINNT */
18 # define CONFIG_FILE "%windir%\\system32\\drivers\\etc\\ntp.conf"
19 # define ALT_CONFIG_FILE "%windir%\\ntp.conf"
20 # define NTP_KEYSDIR "%windir%\\system32\\drivers\\etc"
21 # endif /* SYS_WINNT */
22 #endif /* not CONFIG_FILE */
24 #ifdef HAVE_IPTOS_SUPPORT
26 * "qos" modified keywords
28 #define CONF_QOS_LOWDELAY 1
29 #define CONF_QOS_THROUGHPUT 2
30 #define CONF_QOS_RELIABILITY 3
31 #define CONF_QOS_MINCOST 4
33 #ifdef IPTOS_PREC_INTERNETCONTROL
34 #define CONF_QOS_CS0 5
35 #define CONF_QOS_CS1 6
36 #define CONF_QOS_CS2 7
37 #define CONF_QOS_CS3 8
38 #define CONF_QOS_CS4 9
39 #define CONF_QOS_CS5 10
40 #define CONF_QOS_CS6 11
41 #define CONF_QOS_CS7 12
42 #endif /* IPTOS_PREC_INTERNETCONTROL */
44 #endif /* HAVE_IPTOS_SUPPORT */
48 * We keep config trees around for possible saveconfig use. When
49 * built with configure --disable-saveconfig, and when built with
50 * debugging enabled, include the free_config_*() routines. In the
51 * DEBUG case, they are used in an atexit() cleanup routine to make
52 * postmortem leak check reports more interesting.
54 #if !defined(FREE_CFG_T) && (!defined(SAVECONFIG) || defined(DEBUG))
59 * Some systems do not support fork() and don't have an alternate
60 * threads implementation of ntp_intres. Such systems are limited
61 * to using numeric IP addresses.
63 #if defined(VMS) || defined (SYS_VXWORKS) || \
64 (!defined(HAVE_FORK) && !defined(SYS_WINNT))
71 /* Configuration sources */
73 #define CONF_SOURCE_FILE 0
74 #define CONF_SOURCE_NTPQ 1
77 /* Structure for storing an attribute-value pair */
89 /* Structure for nodes on the syntax tree */
95 struct restrict_node
{
96 struct address_node
*addr
;
97 struct address_node
*mask
;
104 struct address_node
*addr
;
116 struct address_node
* addr
;
122 queue
*crypto_cmd_list
;
127 queue
*trusted_key_list
;
128 char *ntp_signd_socket
;
131 struct filegen_node
{
142 typedef struct nic_rule_node_tag
{
144 char *if_name
; /* interface name or numeric address */
148 struct addr_opts_node
{
149 struct address_node
*addr
;
159 /* The syntax tree */
161 struct config_tree
*link
;
163 struct attr_val source
;
171 queue
*manycastserver
;
172 queue
*multicastclient
;
176 /* Monitoring Configuration */
181 /* Access Control Configuration */
183 queue
*restrict_opts
;
189 struct auth_node auth
;
200 struct sim_node
*sim_details
;
204 /* Structure for holding a remote configuration command */
205 struct REMOTE_CONFIG_INFO
{
206 char buffer
[MAXLINE
];
207 char err_msg
[MAXLINE
];
213 /* get text from T_ tokens */
214 const char * token_name(int token
);
216 struct peer_node
*create_peer_node(int hmode
,
217 struct address_node
*addr
,
219 struct unpeer_node
*create_unpeer_node(struct address_node
*addr
);
220 struct address_node
*create_address_node(char *addr
, int type
);
221 void destroy_address_node(struct address_node
*my_node
);
222 queue
*enqueue_in_new_queue(void *my_node
);
223 struct attr_val
*create_attr_dval(int attr
, double value
);
224 struct attr_val
*create_attr_ival(int attr
, int value
);
225 struct attr_val
*create_attr_sval(int attr
, char *s
);
226 struct attr_val
*create_attr_pval(int attr
, void *s
);
227 struct filegen_node
*create_filegen_node(int filegen_token
, queue
*options
);
228 void **create_pval(void *val
);
229 struct restrict_node
*create_restrict_node(struct address_node
*addr
,
230 struct address_node
*mask
,
231 queue
*flags
, int line_no
);
232 int *create_ival(int val
);
233 struct addr_opts_node
*create_addr_opts_node(struct address_node
*addr
,
235 struct sim_node
*create_sim_node(queue
*init_opts
, queue
*servers
);
236 struct setvar_node
*create_setvar_node(char *var
, char *val
,
238 nic_rule_node
*create_nic_rule_node(int match_class
, char *if_name
,
241 script_info
*create_sim_script_info(double duration
,
242 queue
*script_queue
);
243 server_info
*create_sim_server(struct address_node
*addr
,
244 double server_offset
, queue
*script
);
246 extern struct REMOTE_CONFIG_INFO remote_config
;
247 void config_remotely(sockaddr_u
*);
250 int dump_config_tree(struct config_tree
*ptree
, FILE *df
, int comment
);
251 int dump_all_config_trees(FILE *df
, int comment
);
255 #endif /* !defined(NTP_CONFIG_H) */