xref: /freebsd/contrib/ntp/ntpd/refclock_conf.c (revision f81cdf24ba5436367377f7c8e8f51f6df2a75ca7)
1 /*
2  * refclock_conf.c - reference clock configuration
3  */
4 #ifdef HAVE_CONFIG_H
5 #include <config.h>
6 #endif
7 
8 #include <stdio.h>
9 #include <sys/types.h>
10 
11 #include "ntpd.h"
12 #include "ntp_refclock.h"
13 #include "ntp_stdlib.h"
14 
15 #ifdef REFCLOCK
16 
17 static struct refclock refclock_none = {
18 	noentry, noentry, noentry, noentry, noentry, noentry, NOFLAGS
19 };
20 
21 #ifdef CLOCK_LOCAL
22 extern	struct refclock	refclock_local;
23 #else
24 #define	refclock_local	refclock_none
25 #endif
26 
27 #ifdef CLOCK_PST
28 extern	struct refclock	refclock_pst;
29 #else
30 #define	refclock_pst	refclock_none
31 #endif
32 
33 #ifdef CLOCK_CHU
34 extern	struct refclock	refclock_chu;
35 #else
36 #define	refclock_chu	refclock_none
37 #endif
38 
39 #ifdef CLOCK_WWV
40 extern  struct refclock refclock_wwv;
41 #else
42 #define refclock_wwv    refclock_none
43 #endif
44 
45 #ifdef CLOCK_SPECTRACOM
46 extern	struct refclock	refclock_wwvb;
47 #else
48 #define	refclock_wwvb	refclock_none
49 #endif
50 
51 #ifdef CLOCK_PARSE
52 extern	struct refclock	refclock_parse;
53 #else
54 #define	refclock_parse	refclock_none
55 #endif
56 
57 #if defined(CLOCK_MX4200) && defined(HAVE_PPSAPI)
58 extern	struct refclock	refclock_mx4200;
59 #else
60 #define	refclock_mx4200	refclock_none
61 #endif
62 
63 #ifdef CLOCK_AS2201
64 extern	struct refclock	refclock_as2201;
65 #else
66 #define	refclock_as2201	refclock_none
67 #endif
68 
69 #ifdef CLOCK_ARBITER
70 extern  struct refclock refclock_arbiter;
71 #else
72 #define refclock_arbiter refclock_none
73 #endif
74 
75 #ifdef CLOCK_TPRO
76 extern	struct refclock	refclock_tpro;
77 #else
78 #define	refclock_tpro	refclock_none
79 #endif
80 
81 #ifdef CLOCK_LEITCH
82 extern	struct refclock	refclock_leitch;
83 #else
84 #define	refclock_leitch	refclock_none
85 #endif
86 
87 #ifdef CLOCK_IRIG
88 extern	struct refclock	refclock_irig;
89 #else
90 #define refclock_irig	refclock_none
91 #endif
92 
93 #if 0 && defined(CLOCK_MSFEES) && defined(PPS)
94 extern	struct refclock	refclock_msfees;
95 #else
96 #define refclock_msfees	refclock_none
97 #endif
98 
99 #ifdef CLOCK_BANC
100 extern	struct refclock refclock_bancomm;
101 #else
102 #define refclock_bancomm refclock_none
103 #endif
104 
105 #ifdef CLOCK_TRUETIME
106 extern	struct refclock	refclock_true;
107 #else
108 #define	refclock_true	refclock_none
109 #endif
110 
111 #ifdef CLOCK_DATUM
112 extern	struct refclock	refclock_datum;
113 #else
114 #define refclock_datum	refclock_none
115 #endif
116 
117 #ifdef CLOCK_ACTS
118 extern	struct refclock	refclock_acts;
119 #else
120 #define refclock_acts	refclock_none
121 #endif
122 
123 #ifdef CLOCK_HEATH
124 extern	struct refclock	refclock_heath;
125 #else
126 #define refclock_heath	refclock_none
127 #endif
128 
129 #ifdef CLOCK_NMEA
130 extern	struct refclock refclock_nmea;
131 #else
132 #define	refclock_nmea	refclock_none
133 #endif
134 
135 #if defined (CLOCK_ATOM) && defined(HAVE_PPSAPI)
136 extern	struct refclock	refclock_atom;
137 #else
138 #define refclock_atom	refclock_none
139 #endif
140 
141 #ifdef CLOCK_HPGPS
142 extern	struct refclock	refclock_hpgps;
143 #else
144 #define	refclock_hpgps	refclock_none
145 #endif
146 
147 #ifdef CLOCK_GPSVME
148 extern	struct refclock refclock_gpsvme;
149 #else
150 #define refclock_gpsvme refclock_none
151 #endif
152 
153 #ifdef CLOCK_ARCRON_MSF
154 extern	struct refclock refclock_arc;
155 #else
156 #define refclock_arc refclock_none
157 #endif
158 
159 #ifdef CLOCK_SHM
160 extern	struct refclock refclock_shm;
161 #else
162 #define refclock_shm refclock_none
163 #endif
164 
165 #ifdef CLOCK_PALISADE
166 extern	struct refclock refclock_palisade;
167 #else
168 #define refclock_palisade refclock_none
169 #endif
170 
171 #if defined(CLOCK_ONCORE)
172 extern	struct refclock refclock_oncore;
173 #else
174 #define refclock_oncore refclock_none
175 #endif
176 
177 #if defined(CLOCK_JUPITER) && defined(HAVE_PPSAPI)
178 extern	struct refclock refclock_jupiter;
179 #else
180 #define refclock_jupiter refclock_none
181 #endif
182 
183 #if defined(CLOCK_CHRONOLOG)
184 extern struct refclock refclock_chronolog;
185 #else
186 #define refclock_chronolog refclock_none
187 #endif
188 
189 #if defined(CLOCK_DUMBCLOCK)
190 extern struct refclock refclock_dumbclock;
191 #else
192 #define refclock_dumbclock refclock_none
193 #endif
194 
195 #ifdef CLOCK_ULINK
196 extern	struct refclock	refclock_ulink;
197 #else
198 #define	refclock_ulink	refclock_none
199 #endif
200 
201 #ifdef CLOCK_PCF
202 extern	struct refclock	refclock_pcf;
203 #else
204 #define	refclock_pcf	refclock_none
205 #endif
206 
207 #ifdef CLOCK_FG
208 extern	struct refclock	refclock_fg;
209 #else
210 #define	refclock_fg	refclock_none
211 #endif
212 
213 #ifdef CLOCK_HOPF_SERIAL
214 extern	struct refclock	refclock_hopfser;
215 #else
216 #define	refclock_hopfser refclock_none
217 #endif
218 
219 #ifdef CLOCK_HOPF_PCI
220 extern	struct refclock	refclock_hopfpci;
221 #else
222 #define	refclock_hopfpci refclock_none
223 #endif
224 
225 #ifdef CLOCK_JJY
226 extern	struct refclock	refclock_jjy;
227 #else
228 #define	refclock_jjy refclock_none
229 #endif
230 
231 #ifdef CLOCK_TT560
232 extern	struct refclock	refclock_tt560;
233 #else
234 #define	refclock_tt560 refclock_none
235 #endif
236 
237 #ifdef CLOCK_ZYFER
238 extern	struct refclock	refclock_zyfer;
239 #else
240 #define	refclock_zyfer refclock_none
241 #endif
242 
243 #ifdef CLOCK_RIPENCC
244 extern struct refclock refclock_ripencc;
245 #else
246 #define refclock_ripencc refclock_none
247 #endif
248 
249 #ifdef CLOCK_NEOCLOCK4X
250 extern	struct refclock	refclock_neoclock4x;
251 #else
252 #define	refclock_neoclock4x	refclock_none
253 #endif
254 
255 #ifdef CLOCK_TSYNCPCI
256 extern struct refclock refclock_tsyncpci;
257 #else
258 #define refclock_tsyncpci refclock_none
259 #endif
260 
261 #if defined(CLOCK_GPSDJSON) && !defined(SYS_WINNT)
262 extern struct refclock refclock_gpsdjson;
263 #else
264 #define refclock_gpsdjson refclock_none
265 #endif
266 /*
267  * Order is clock_start(), clock_shutdown(), clock_poll(),
268  * clock_control(), clock_init(), clock_buginfo, clock_flags;
269  *
270  * Types are defined in ntp.h.  The index must match this.
271  */
272 struct refclock * const refclock_conf[] = {
273 	&refclock_none,		/* 0 REFCLK_NONE */
274 	&refclock_local,	/* 1 REFCLK_LOCAL */
275 	&refclock_none,		/* 2 deprecated: REFCLK_GPS_TRAK */
276 	&refclock_pst,		/* 3 REFCLK_WWV_PST */
277 	&refclock_wwvb, 	/* 4 REFCLK_SPECTRACOM */
278 	&refclock_true,		/* 5 REFCLK_TRUETIME */
279 	&refclock_irig,		/* 6 REFCLK_IRIG_AUDIO */
280 	&refclock_chu,		/* 7 REFCLK_CHU_AUDIO */
281 	&refclock_parse,	/* 8 REFCLK_PARSE */
282 	&refclock_mx4200,	/* 9 REFCLK_GPS_MX4200 */
283 	&refclock_as2201,	/* 10 REFCLK_GPS_AS2201 */
284 	&refclock_arbiter,	/* 11 REFCLK_GPS_ARBITER */
285 	&refclock_tpro,		/* 12 REFCLK_IRIG_TPRO */
286 	&refclock_leitch,	/* 13 REFCLK_ATOM_LEITCH */
287 	&refclock_none,		/* 14 deprecated: REFCLK_MSF_EES */
288 	&refclock_none,		/* 15 not used */
289 	&refclock_bancomm,	/* 16 REFCLK_IRIG_BANCOMM */
290 	&refclock_datum,	/* 17 REFCLK_GPS_DATUM */
291 	&refclock_acts,		/* 18 REFCLK_ACTS */
292 	&refclock_heath,	/* 19 REFCLK_WWV_HEATH */
293 	&refclock_nmea,		/* 20 REFCLK_GPS_NMEA */
294 	&refclock_gpsvme,	/* 21 REFCLK_GPS_VME */
295 	&refclock_atom,		/* 22 REFCLK_ATOM_PPS */
296 	&refclock_none,		/* 23 not used */
297 	&refclock_none,		/* 24 not used */
298 	&refclock_none,		/* 25 not used */
299 	&refclock_hpgps,	/* 26 REFCLK_GPS_HP */
300 	&refclock_arc, 		/* 27 REFCLK_ARCRON_MSF */
301 	&refclock_shm,		/* 28 REFCLK_SHM */
302 	&refclock_palisade,	/* 29 REFCLK_PALISADE */
303 	&refclock_oncore,	/* 30 REFCLK_ONCORE */
304 	&refclock_jupiter,	/* 31 REFCLK_GPS_JUPITER */
305 	&refclock_chronolog,	/* 32 REFCLK_CHRONOLOG */
306 	&refclock_dumbclock,	/* 33 REFCLK_DUMBCLOCK */
307 	&refclock_ulink,	/* 34 REFCLOCK_ULINK */
308 	&refclock_pcf,		/* 35 REFCLOCK_PCF */
309 	&refclock_wwv,		/* 36 REFCLOCK_WWV_AUDIO */
310 	&refclock_fg,		/* 37 REFCLOCK_FG */
311 	&refclock_hopfser,	/* 38 REFCLK_HOPF_SERIAL */
312 	&refclock_hopfpci,	/* 39 REFCLK_HOPF_PCI */
313 	&refclock_jjy,		/* 40 REFCLK_JJY */
314 	&refclock_tt560,	/* 41 REFCLK_TT560 */
315 	&refclock_zyfer,	/* 42 REFCLK_ZYFER */
316 	&refclock_ripencc,	/* 43 REFCLK_RIPENCC */
317 	&refclock_neoclock4x,	/* 44 REFCLK_NEOCLOCK4X */
318 	&refclock_tsyncpci,	/* 45 REFCLK_TSYNCPCI */
319 	&refclock_gpsdjson	/* 46 REFCLK_GPSDJSON */
320 };
321 
322 u_char num_refclock_conf = sizeof(refclock_conf)/sizeof(struct refclock *);
323 
324 #else
325 int refclock_conf_bs;
326 #endif
327