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