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