/contrib/ntp/libparse/parse_conf.c

https://bitbucket.org/freebsd/freebsd-head/ · C · 175 lines · 83 code · 19 blank · 73 comment · 1 complexity · 492cb577e8ca2bc912f87b75dca6444f MD5 · raw file

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