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