154359Sroberto/*
2182007Sroberto * /src/NTP/ntp4-dev/libparse/parse_conf.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A
354359Sroberto *
4182007Sroberto * parse_conf.c,v 4.9 2005/04/16 17:32:10 kardel RELEASE_20050508_A
554359Sroberto *
654359Sroberto * Parser configuration module for reference clocks
754359Sroberto *
854359Sroberto * STREAM define switches between two personalities of the module
954359Sroberto * if STREAM is defined this module can be used with dcf77sync.c as
1054359Sroberto * a STREAMS kernel module. In this case the time stamps will be
1154359Sroberto * a struct timeval.
1254359Sroberto * when STREAM is not defined NTP time stamps will be used.
1354359Sroberto *
14182007Sroberto * Copyright (c) 1995-2005 by Frank Kardel <kardel <AT> ntp.org>
15182007Sroberto * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universit�t Erlangen-N�rnberg, Germany
1654359Sroberto *
17182007Sroberto * Redistribution and use in source and binary forms, with or without
18182007Sroberto * modification, are permitted provided that the following conditions
19182007Sroberto * are met:
20182007Sroberto * 1. Redistributions of source code must retain the above copyright
21182007Sroberto *    notice, this list of conditions and the following disclaimer.
22182007Sroberto * 2. Redistributions in binary form must reproduce the above copyright
23182007Sroberto *    notice, this list of conditions and the following disclaimer in the
24182007Sroberto *    documentation and/or other materials provided with the distribution.
25182007Sroberto * 3. Neither the name of the author nor the names of its contributors
26182007Sroberto *    may be used to endorse or promote products derived from this software
27182007Sroberto *    without specific prior written permission.
28182007Sroberto *
29182007Sroberto * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
30182007Sroberto * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31182007Sroberto * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32182007Sroberto * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
33182007Sroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34182007Sroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35182007Sroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36182007Sroberto * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37182007Sroberto * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38182007Sroberto * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39182007Sroberto * SUCH DAMAGE.
40182007Sroberto *
4154359Sroberto */
4254359Sroberto
4354359Sroberto#ifdef HAVE_CONFIG_H
4454359Sroberto# include <config.h>
4554359Sroberto#endif
4654359Sroberto
4754359Sroberto#if defined(REFCLOCK) && defined(CLOCK_PARSE)
4854359Sroberto
4954359Sroberto#include "ntp_fp.h"
5054359Sroberto#include "ntp_unixtime.h"
5154359Sroberto#include "ntp_calendar.h"
5254359Sroberto
5354359Sroberto#include "parse.h"
5454359Sroberto
5554359Sroberto#ifdef CLOCK_SCHMID
5654359Srobertoextern clockformat_t clock_schmid;
5754359Sroberto#endif
5854359Sroberto
5954359Sroberto#ifdef CLOCK_DCF7000
6054359Srobertoextern clockformat_t clock_dcf7000;
6154359Sroberto#endif
6254359Sroberto
6354359Sroberto#ifdef CLOCK_MEINBERG
6454359Srobertoextern clockformat_t clock_meinberg[];
6554359Sroberto#endif
6654359Sroberto
6754359Sroberto#ifdef CLOCK_RAWDCF
6854359Srobertoextern clockformat_t clock_rawdcf;
6954359Sroberto#endif
7054359Sroberto
7154359Sroberto#ifdef CLOCK_TRIMTAIP
7254359Srobertoextern clockformat_t clock_trimtaip;
7354359Sroberto#endif
7454359Sroberto
7554359Sroberto#ifdef CLOCK_TRIMTSIP
7654359Srobertoextern clockformat_t clock_trimtsip;
7754359Sroberto#endif
7854359Sroberto
7954359Sroberto#ifdef CLOCK_RCC8000
8054359Srobertoextern clockformat_t clock_rcc8000;
8154359Sroberto#endif
8254359Sroberto
8354359Sroberto#ifdef CLOCK_HOPF6021
8454359Srobertoextern clockformat_t clock_hopf6021;
8554359Sroberto#endif
8654359Sroberto
8754359Sroberto#ifdef CLOCK_COMPUTIME
8854359Srobertoextern clockformat_t clock_computime;
8954359Sroberto#endif
9054359Sroberto
9154359Sroberto#ifdef CLOCK_WHARTON_400A
9254359Srobertoextern clockformat_t clock_wharton_400a;
9354359Sroberto#endif
9454359Sroberto
9554359Sroberto#ifdef CLOCK_VARITEXT
9654359Srobertoextern clockformat_t clock_varitext;
9754359Sroberto#endif
9854359Sroberto
9954359Sroberto/*
10054359Sroberto * format definitions
10154359Sroberto */
10254359Srobertoclockformat_t *clockformats[] =
10354359Sroberto{
10454359Sroberto#ifdef CLOCK_MEINBERG
10554359Sroberto	&clock_meinberg[0],
10654359Sroberto	&clock_meinberg[1],
10754359Sroberto	&clock_meinberg[2],
10854359Sroberto#endif
10954359Sroberto#ifdef CLOCK_DCF7000
11054359Sroberto	&clock_dcf7000,
11154359Sroberto#endif
11254359Sroberto#ifdef CLOCK_SCHMID
11354359Sroberto	&clock_schmid,
11454359Sroberto#endif
11554359Sroberto#ifdef CLOCK_RAWDCF
11654359Sroberto	&clock_rawdcf,
11754359Sroberto#endif
11854359Sroberto#ifdef CLOCK_TRIMTAIP
11954359Sroberto	&clock_trimtaip,
12054359Sroberto#endif
12154359Sroberto#ifdef CLOCK_TRIMTSIP
12254359Sroberto	&clock_trimtsip,
12354359Sroberto#endif
12454359Sroberto#ifdef CLOCK_RCC8000
12554359Sroberto	&clock_rcc8000,
12654359Sroberto#endif
12754359Sroberto#ifdef CLOCK_HOPF6021
12854359Sroberto	&clock_hopf6021,
12954359Sroberto#endif
13054359Sroberto#ifdef CLOCK_COMPUTIME
13154359Sroberto	&clock_computime,
13254359Sroberto#endif
13354359Sroberto#ifdef CLOCK_WHARTON_400A
13454359Sroberto	&clock_wharton_400a,
13554359Sroberto#endif
13654359Sroberto#ifdef CLOCK_VARITEXT
13754359Sroberto        &clock_varitext,
13854359Sroberto#endif
13954359Sroberto	0};
14054359Sroberto
14154359Srobertounsigned short nformats = sizeof(clockformats) / sizeof(clockformats[0]) - 1;
14254359Sroberto
14354359Sroberto#else /* not (REFCLOCK && CLOCK_PARSE) */
14454359Srobertoint parse_conf_bs;
14554359Sroberto#endif /* not (REFCLOCK && CLOCK_PARSE) */
14654359Sroberto
14754359Sroberto/*
14854359Sroberto * History:
14954359Sroberto *
15054359Sroberto * parse_conf.c,v
151182007Sroberto * Revision 4.9  2005/04/16 17:32:10  kardel
152182007Sroberto * update copyright
153182007Sroberto *
154182007Sroberto * Revision 4.8  2004/11/14 15:29:41  kardel
155182007Sroberto * support PPSAPI, upgrade Copyright to Berkeley style
156182007Sroberto *
15756746Sroberto * Revision 4.5  1999/11/28 09:13:53  kardel
15856746Sroberto * RECON_4_0_98F
15956746Sroberto *
16054359Sroberto * Revision 4.4  1999/02/28 15:27:25  kardel
16154359Sroberto * wharton clock integration
16254359Sroberto *
16354359Sroberto * Revision 4.3  1998/08/16 18:52:15  kardel
16454359Sroberto * (clockformats): Trimble TSIP driver now also
16554359Sroberto * available for kernel operation
16654359Sroberto *
16754359Sroberto * Revision 4.2  1998/06/12 09:13:48  kardel
16854359Sroberto * conditional compile macros fixed
16954359Sroberto *
17054359Sroberto * Revision 4.1  1998/05/24 09:40:49  kardel
17154359Sroberto * adjustments of log messages
17254359Sroberto *
17354359Sroberto *
17454359Sroberto * from V3 3.24 log info deleted 1998/04/11 kardel
17554359Sroberto */
176