xref: /freebsd/contrib/ntp/libparse/parse_conf.c (revision ea906c4152774dff300bb26fbfc1e4188351c89a)
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>
15ea906c41SOllivier Robert  * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universit�t Erlangen-N�rnberg, 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 
99c0b746e5SOllivier Robert /*
100c0b746e5SOllivier Robert  * format definitions
101c0b746e5SOllivier Robert  */
102c0b746e5SOllivier Robert clockformat_t *clockformats[] =
103c0b746e5SOllivier Robert {
104c0b746e5SOllivier Robert #ifdef CLOCK_MEINBERG
105c0b746e5SOllivier Robert 	&clock_meinberg[0],
106c0b746e5SOllivier Robert 	&clock_meinberg[1],
107c0b746e5SOllivier Robert 	&clock_meinberg[2],
108c0b746e5SOllivier Robert #endif
109c0b746e5SOllivier Robert #ifdef CLOCK_DCF7000
110c0b746e5SOllivier Robert 	&clock_dcf7000,
111c0b746e5SOllivier Robert #endif
112c0b746e5SOllivier Robert #ifdef CLOCK_SCHMID
113c0b746e5SOllivier Robert 	&clock_schmid,
114c0b746e5SOllivier Robert #endif
115c0b746e5SOllivier Robert #ifdef CLOCK_RAWDCF
116c0b746e5SOllivier Robert 	&clock_rawdcf,
117c0b746e5SOllivier Robert #endif
118c0b746e5SOllivier Robert #ifdef CLOCK_TRIMTAIP
119c0b746e5SOllivier Robert 	&clock_trimtaip,
120c0b746e5SOllivier Robert #endif
121c0b746e5SOllivier Robert #ifdef CLOCK_TRIMTSIP
122c0b746e5SOllivier Robert 	&clock_trimtsip,
123c0b746e5SOllivier Robert #endif
124c0b746e5SOllivier Robert #ifdef CLOCK_RCC8000
125c0b746e5SOllivier Robert 	&clock_rcc8000,
126c0b746e5SOllivier Robert #endif
127c0b746e5SOllivier Robert #ifdef CLOCK_HOPF6021
128c0b746e5SOllivier Robert 	&clock_hopf6021,
129c0b746e5SOllivier Robert #endif
130c0b746e5SOllivier Robert #ifdef CLOCK_COMPUTIME
131c0b746e5SOllivier Robert 	&clock_computime,
132c0b746e5SOllivier Robert #endif
133c0b746e5SOllivier Robert #ifdef CLOCK_WHARTON_400A
134c0b746e5SOllivier Robert 	&clock_wharton_400a,
135c0b746e5SOllivier Robert #endif
136c0b746e5SOllivier Robert #ifdef CLOCK_VARITEXT
137c0b746e5SOllivier Robert         &clock_varitext,
138c0b746e5SOllivier Robert #endif
139c0b746e5SOllivier Robert 	0};
140c0b746e5SOllivier Robert 
141c0b746e5SOllivier Robert unsigned short nformats = sizeof(clockformats) / sizeof(clockformats[0]) - 1;
142c0b746e5SOllivier Robert 
143c0b746e5SOllivier Robert #else /* not (REFCLOCK && CLOCK_PARSE) */
144c0b746e5SOllivier Robert int parse_conf_bs;
145c0b746e5SOllivier Robert #endif /* not (REFCLOCK && CLOCK_PARSE) */
146c0b746e5SOllivier Robert 
147c0b746e5SOllivier Robert /*
148c0b746e5SOllivier Robert  * History:
149c0b746e5SOllivier Robert  *
150c0b746e5SOllivier Robert  * parse_conf.c,v
151ea906c41SOllivier Robert  * Revision 4.9  2005/04/16 17:32:10  kardel
152ea906c41SOllivier Robert  * update copyright
153ea906c41SOllivier Robert  *
154ea906c41SOllivier Robert  * Revision 4.8  2004/11/14 15:29:41  kardel
155ea906c41SOllivier Robert  * support PPSAPI, upgrade Copyright to Berkeley style
156ea906c41SOllivier Robert  *
157a151a66cSOllivier Robert  * Revision 4.5  1999/11/28 09:13:53  kardel
158a151a66cSOllivier Robert  * RECON_4_0_98F
159a151a66cSOllivier Robert  *
160c0b746e5SOllivier Robert  * Revision 4.4  1999/02/28 15:27:25  kardel
161c0b746e5SOllivier Robert  * wharton clock integration
162c0b746e5SOllivier Robert  *
163c0b746e5SOllivier Robert  * Revision 4.3  1998/08/16 18:52:15  kardel
164c0b746e5SOllivier Robert  * (clockformats): Trimble TSIP driver now also
165c0b746e5SOllivier Robert  * available for kernel operation
166c0b746e5SOllivier Robert  *
167c0b746e5SOllivier Robert  * Revision 4.2  1998/06/12 09:13:48  kardel
168c0b746e5SOllivier Robert  * conditional compile macros fixed
169c0b746e5SOllivier Robert  *
170c0b746e5SOllivier Robert  * Revision 4.1  1998/05/24 09:40:49  kardel
171c0b746e5SOllivier Robert  * adjustments of log messages
172c0b746e5SOllivier Robert  *
173c0b746e5SOllivier Robert  *
174c0b746e5SOllivier Robert  * from V3 3.24 log info deleted 1998/04/11 kardel
175c0b746e5SOllivier Robert  */
176