1 1.6 christos /* $NetBSD: parse_conf.c,v 1.7 2024/08/18 20:47:17 christos Exp $ */ 2 1.1 kardel 3 1.1 kardel /* 4 1.1 kardel * /src/NTP/ntp4-dev/libparse/parse_conf.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A 5 1.3 christos * 6 1.1 kardel * parse_conf.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A 7 1.1 kardel * 8 1.1 kardel * Parser configuration module for reference clocks 9 1.1 kardel * 10 1.1 kardel * STREAM define switches between two personalities of the module 11 1.1 kardel * if STREAM is defined this module can be used with dcf77sync.c as 12 1.1 kardel * a STREAMS kernel module. In this case the time stamps will be 13 1.1 kardel * a struct timeval. 14 1.1 kardel * when STREAM is not defined NTP time stamps will be used. 15 1.1 kardel * 16 1.1 kardel * Copyright (c) 1995-2005 by Frank Kardel <kardel <AT> ntp.org> 17 1.3 christos * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany 18 1.1 kardel * 19 1.1 kardel * Redistribution and use in source and binary forms, with or without 20 1.1 kardel * modification, are permitted provided that the following conditions 21 1.1 kardel * are met: 22 1.1 kardel * 1. Redistributions of source code must retain the above copyright 23 1.1 kardel * notice, this list of conditions and the following disclaimer. 24 1.1 kardel * 2. Redistributions in binary form must reproduce the above copyright 25 1.1 kardel * notice, this list of conditions and the following disclaimer in the 26 1.1 kardel * documentation and/or other materials provided with the distribution. 27 1.1 kardel * 3. Neither the name of the author nor the names of its contributors 28 1.1 kardel * may be used to endorse or promote products derived from this software 29 1.1 kardel * without specific prior written permission. 30 1.1 kardel * 31 1.1 kardel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 32 1.1 kardel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 33 1.1 kardel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 34 1.1 kardel * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 35 1.1 kardel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 1.1 kardel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 1.1 kardel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 1.1 kardel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 39 1.1 kardel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 40 1.1 kardel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 41 1.1 kardel * SUCH DAMAGE. 42 1.1 kardel * 43 1.1 kardel */ 44 1.1 kardel 45 1.1 kardel #ifdef HAVE_CONFIG_H 46 1.1 kardel # include <config.h> 47 1.1 kardel #endif 48 1.1 kardel 49 1.1 kardel #if defined(REFCLOCK) && defined(CLOCK_PARSE) 50 1.1 kardel 51 1.1 kardel #include "ntp_fp.h" 52 1.1 kardel #include "ntp_unixtime.h" 53 1.1 kardel #include "ntp_calendar.h" 54 1.1 kardel 55 1.1 kardel #include "parse.h" 56 1.1 kardel 57 1.1 kardel #ifdef CLOCK_SCHMID 58 1.1 kardel extern clockformat_t clock_schmid; 59 1.1 kardel #endif 60 1.1 kardel 61 1.1 kardel #ifdef CLOCK_DCF7000 62 1.1 kardel extern clockformat_t clock_dcf7000; 63 1.1 kardel #endif 64 1.1 kardel 65 1.1 kardel #ifdef CLOCK_MEINBERG 66 1.1 kardel extern clockformat_t clock_meinberg[]; 67 1.1 kardel #endif 68 1.1 kardel 69 1.1 kardel #ifdef CLOCK_RAWDCF 70 1.1 kardel extern clockformat_t clock_rawdcf; 71 1.1 kardel #endif 72 1.1 kardel 73 1.1 kardel #ifdef CLOCK_TRIMTAIP 74 1.1 kardel extern clockformat_t clock_trimtaip; 75 1.1 kardel #endif 76 1.1 kardel 77 1.1 kardel #ifdef CLOCK_TRIMTSIP 78 1.1 kardel extern clockformat_t clock_trimtsip; 79 1.1 kardel #endif 80 1.1 kardel 81 1.1 kardel #ifdef CLOCK_RCC8000 82 1.1 kardel extern clockformat_t clock_rcc8000; 83 1.1 kardel #endif 84 1.1 kardel 85 1.1 kardel #ifdef CLOCK_HOPF6021 86 1.1 kardel extern clockformat_t clock_hopf6021; 87 1.1 kardel #endif 88 1.1 kardel 89 1.1 kardel #ifdef CLOCK_COMPUTIME 90 1.1 kardel extern clockformat_t clock_computime; 91 1.1 kardel #endif 92 1.1 kardel 93 1.1 kardel #ifdef CLOCK_WHARTON_400A 94 1.1 kardel extern clockformat_t clock_wharton_400a; 95 1.1 kardel #endif 96 1.1 kardel 97 1.1 kardel #ifdef CLOCK_VARITEXT 98 1.1 kardel extern clockformat_t clock_varitext; 99 1.1 kardel #endif 100 1.1 kardel 101 1.2 christos #ifdef CLOCK_SEL240X 102 1.2 christos extern clockformat_t clock_sel240x; 103 1.2 christos #endif 104 1.2 christos 105 1.1 kardel /* 106 1.1 kardel * format definitions 107 1.1 kardel */ 108 1.1 kardel clockformat_t *clockformats[] = 109 1.1 kardel { 110 1.1 kardel #ifdef CLOCK_MEINBERG 111 1.1 kardel &clock_meinberg[0], 112 1.1 kardel &clock_meinberg[1], 113 1.1 kardel &clock_meinberg[2], 114 1.1 kardel #endif 115 1.1 kardel #ifdef CLOCK_DCF7000 116 1.1 kardel &clock_dcf7000, 117 1.1 kardel #endif 118 1.1 kardel #ifdef CLOCK_SCHMID 119 1.1 kardel &clock_schmid, 120 1.1 kardel #endif 121 1.1 kardel #ifdef CLOCK_RAWDCF 122 1.1 kardel &clock_rawdcf, 123 1.1 kardel #endif 124 1.1 kardel #ifdef CLOCK_TRIMTAIP 125 1.1 kardel &clock_trimtaip, 126 1.1 kardel #endif 127 1.1 kardel #ifdef CLOCK_TRIMTSIP 128 1.1 kardel &clock_trimtsip, 129 1.1 kardel #endif 130 1.1 kardel #ifdef CLOCK_RCC8000 131 1.1 kardel &clock_rcc8000, 132 1.1 kardel #endif 133 1.1 kardel #ifdef CLOCK_HOPF6021 134 1.1 kardel &clock_hopf6021, 135 1.1 kardel #endif 136 1.1 kardel #ifdef CLOCK_COMPUTIME 137 1.1 kardel &clock_computime, 138 1.1 kardel #endif 139 1.1 kardel #ifdef CLOCK_WHARTON_400A 140 1.1 kardel &clock_wharton_400a, 141 1.1 kardel #endif 142 1.1 kardel #ifdef CLOCK_VARITEXT 143 1.1 kardel &clock_varitext, 144 1.1 kardel #endif 145 1.2 christos #ifdef CLOCK_SEL240X 146 1.2 christos &clock_sel240x, 147 1.2 christos #endif 148 1.1 kardel 0}; 149 1.1 kardel 150 1.1 kardel unsigned short nformats = sizeof(clockformats) / sizeof(clockformats[0]) - 1; 151 1.1 kardel 152 1.1 kardel #else /* not (REFCLOCK && CLOCK_PARSE) */ 153 1.7 christos NONEMPTY_TRANSLATION_UNIT 154 1.1 kardel #endif /* not (REFCLOCK && CLOCK_PARSE) */ 155 1.1 kardel 156 1.1 kardel /* 157 1.1 kardel * History: 158 1.1 kardel * 159 1.1 kardel * parse_conf.c,v 160 1.1 kardel * Revision 4.9 2005/04/16 17:32:10 kardel 161 1.1 kardel * update copyright 162 1.1 kardel * 163 1.1 kardel * Revision 4.8 2004/11/14 15:29:41 kardel 164 1.1 kardel * support PPSAPI, upgrade Copyright to Berkeley style 165 1.1 kardel * 166 1.1 kardel * Revision 4.5 1999/11/28 09:13:53 kardel 167 1.1 kardel * RECON_4_0_98F 168 1.1 kardel * 169 1.1 kardel * Revision 4.4 1999/02/28 15:27:25 kardel 170 1.1 kardel * wharton clock integration 171 1.1 kardel * 172 1.1 kardel * Revision 4.3 1998/08/16 18:52:15 kardel 173 1.1 kardel * (clockformats): Trimble TSIP driver now also 174 1.1 kardel * available for kernel operation 175 1.1 kardel * 176 1.1 kardel * Revision 4.2 1998/06/12 09:13:48 kardel 177 1.1 kardel * conditional compile macros fixed 178 1.1 kardel * 179 1.1 kardel * Revision 4.1 1998/05/24 09:40:49 kardel 180 1.1 kardel * adjustments of log messages 181 1.1 kardel * 182 1.1 kardel * 183 1.1 kardel * from V3 3.24 log info deleted 1998/04/11 kardel 184 1.1 kardel */ 185