parse_conf.c revision 285612
1133391Sharti/* 2133391Sharti * /src/NTP/ntp4-dev/libparse/parse_conf.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A 3133391Sharti * 4133391Sharti * parse_conf.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A 5133391Sharti * 6133391Sharti * Parser configuration module for reference clocks 7133391Sharti * 8133391Sharti * STREAM define switches between two personalities of the module 9133391Sharti * if STREAM is defined this module can be used with dcf77sync.c as 10133391Sharti * a STREAMS kernel module. In this case the time stamps will be 11133391Sharti * a struct timeval. 12133391Sharti * when STREAM is not defined NTP time stamps will be used. 13133391Sharti * 14133391Sharti * Copyright (c) 1995-2005 by Frank Kardel <kardel <AT> ntp.org> 15133391Sharti * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany 16133391Sharti * 17133391Sharti * Redistribution and use in source and binary forms, with or without 18133391Sharti * modification, are permitted provided that the following conditions 19133391Sharti * are met: 20133391Sharti * 1. Redistributions of source code must retain the above copyright 21133391Sharti * notice, this list of conditions and the following disclaimer. 22133391Sharti * 2. Redistributions in binary form must reproduce the above copyright 23133391Sharti * notice, this list of conditions and the following disclaimer in the 24133391Sharti * documentation and/or other materials provided with the distribution. 25133391Sharti * 3. Neither the name of the author nor the names of its contributors 26133391Sharti * may be used to endorse or promote products derived from this software 27133391Sharti * without specific prior written permission. 28133391Sharti * 29133391Sharti * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 30133391Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31133391Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32133391Sharti * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 33133391Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34133391Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35133391Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36133391Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37133391Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38133391Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39133391Sharti * SUCH DAMAGE. 40133391Sharti * 41133391Sharti */ 42133391Sharti 43133391Sharti#ifdef HAVE_CONFIG_H 44133391Sharti# include <config.h> 45133391Sharti#endif 46133391Sharti 47133391Sharti#if defined(REFCLOCK) && defined(CLOCK_PARSE) 48133391Sharti 49133391Sharti#include "ntp_fp.h" 50133391Sharti#include "ntp_unixtime.h" 51133391Sharti#include "ntp_calendar.h" 52133391Sharti 53133391Sharti#include "parse.h" 54133391Sharti 55133391Sharti#ifdef CLOCK_SCHMID 56133391Shartiextern clockformat_t clock_schmid; 57133391Sharti#endif 58133391Sharti 59133391Sharti#ifdef CLOCK_DCF7000 60133391Shartiextern clockformat_t clock_dcf7000; 61133391Sharti#endif 62133391Sharti 63133391Sharti#ifdef CLOCK_MEINBERG 64133391Shartiextern clockformat_t clock_meinberg[]; 65133391Sharti#endif 66133391Sharti 67133391Sharti#ifdef CLOCK_RAWDCF 68133391Shartiextern clockformat_t clock_rawdcf; 69133391Sharti#endif 70133391Sharti 71133391Sharti#ifdef CLOCK_TRIMTAIP 72133391Shartiextern clockformat_t clock_trimtaip; 73133391Sharti#endif 74133391Sharti 75133391Sharti#ifdef CLOCK_TRIMTSIP 76133391Shartiextern clockformat_t clock_trimtsip; 77133391Sharti#endif 78133391Sharti 79133391Sharti#ifdef CLOCK_RCC8000 80133391Shartiextern clockformat_t clock_rcc8000; 81133391Sharti#endif 82133391Sharti 83133391Sharti#ifdef CLOCK_HOPF6021 84133391Shartiextern clockformat_t clock_hopf6021; 85133391Sharti#endif 86133391Sharti 87133391Sharti#ifdef CLOCK_COMPUTIME 88133391Shartiextern clockformat_t clock_computime; 89133391Sharti#endif 90133391Sharti 91133391Sharti#ifdef CLOCK_WHARTON_400A 92133391Shartiextern clockformat_t clock_wharton_400a; 93133391Sharti#endif 94133391Sharti 95133391Sharti#ifdef CLOCK_VARITEXT 96133391Shartiextern clockformat_t clock_varitext; 97133391Sharti#endif 98133391Sharti 99133391Sharti#ifdef CLOCK_SEL240X 100133391Shartiextern clockformat_t clock_sel240x; 101133391Sharti#endif 102133391Sharti 103133391Sharti/* 104133391Sharti * format definitions 105133391Sharti */ 106133391Sharticlockformat_t *clockformats[] = 107133391Sharti{ 108133391Sharti#ifdef CLOCK_MEINBERG 109133391Sharti &clock_meinberg[0], 110133391Sharti &clock_meinberg[1], 111133391Sharti &clock_meinberg[2], 112133391Sharti#endif 113133391Sharti#ifdef CLOCK_DCF7000 114133391Sharti &clock_dcf7000, 115133391Sharti#endif 116133391Sharti#ifdef CLOCK_SCHMID 117133391Sharti &clock_schmid, 118133391Sharti#endif 119133391Sharti#ifdef CLOCK_RAWDCF 120133391Sharti &clock_rawdcf, 121133391Sharti#endif 122133391Sharti#ifdef CLOCK_TRIMTAIP 123133391Sharti &clock_trimtaip, 124133391Sharti#endif 125133391Sharti#ifdef CLOCK_TRIMTSIP 126133391Sharti &clock_trimtsip, 127133391Sharti#endif 128133391Sharti#ifdef CLOCK_RCC8000 129133391Sharti &clock_rcc8000, 130133391Sharti#endif 131133391Sharti#ifdef CLOCK_HOPF6021 132133391Sharti &clock_hopf6021, 133133391Sharti#endif 134133391Sharti#ifdef CLOCK_COMPUTIME 135133391Sharti &clock_computime, 136133391Sharti#endif 137133391Sharti#ifdef CLOCK_WHARTON_400A 138133391Sharti &clock_wharton_400a, 139133391Sharti#endif 140133391Sharti#ifdef CLOCK_VARITEXT 141133391Sharti &clock_varitext, 142133391Sharti#endif 143133391Sharti#ifdef CLOCK_SEL240X 144133391Sharti &clock_sel240x, 145133391Sharti#endif 146133391Sharti 0}; 147133391Sharti 148133391Shartiunsigned short nformats = sizeof(clockformats) / sizeof(clockformats[0]) - 1; 149133391Sharti 150133391Sharti#else /* not (REFCLOCK && CLOCK_PARSE) */ 151133391Shartiint parse_conf_bs; 152133391Sharti#endif /* not (REFCLOCK && CLOCK_PARSE) */ 153133391Sharti 154133391Sharti/* 155133391Sharti * History: 156133391Sharti * 157133391Sharti * parse_conf.c,v 158133391Sharti * Revision 4.9 2005/04/16 17:32:10 kardel 159133391Sharti * update copyright 160133391Sharti * 161133391Sharti * Revision 4.8 2004/11/14 15:29:41 kardel 162133391Sharti * support PPSAPI, upgrade Copyright to Berkeley style 163133391Sharti * 164133391Sharti * Revision 4.5 1999/11/28 09:13:53 kardel 165133391Sharti * RECON_4_0_98F 166133391Sharti * 167133391Sharti * Revision 4.4 1999/02/28 15:27:25 kardel 168133391Sharti * wharton clock integration 169133391Sharti * 170133391Sharti * Revision 4.3 1998/08/16 18:52:15 kardel 171133391Sharti * (clockformats): Trimble TSIP driver now also 172133391Sharti * available for kernel operation 173133391Sharti * 174133391Sharti * Revision 4.2 1998/06/12 09:13:48 kardel 175133391Sharti * conditional compile macros fixed 176133391Sharti * 177133391Sharti * Revision 4.1 1998/05/24 09:40:49 kardel 178133391Sharti * adjustments of log messages 179133391Sharti * 180133391Sharti * 181133391Sharti * from V3 3.24 log info deleted 1998/04/11 kardel 182133391Sharti */ 183133391Sharti