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