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