/contrib/ntp/kernel/sys/parsestreams.h

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 133 lines · 51 code · 18 blank · 64 comment · 7 complexity · 2f17dde36f5a29341f136f51b3c870ef MD5 · raw file

  1. /*
  2. * /src/NTP/ntp4-dev/kernel/sys/parsestreams.h,v 4.5 2005/06/25 10:52:47 kardel RELEASE_20050625_A
  3. *
  4. * parsestreams.h,v 4.5 2005/06/25 10:52:47 kardel RELEASE_20050625_A
  5. *
  6. * Copyright (c) 1995-2005 by Frank Kardel <kardel <AT> ntp.org>
  7. * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. Neither the name of the author nor the names of its contributors
  18. * may be used to endorse or promote products derived from this software
  19. * without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  22. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  25. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31. * SUCH DAMAGE.
  32. */
  33. #if !(defined(lint) || defined(__GNUC__))
  34. static char sysparsehrcsid[] = "parsestreams.h,v 4.5 2005/06/25 10:52:47 kardel RELEASE_20050625_A";
  35. #endif
  36. #undef PARSEKERNEL
  37. #if defined(KERNEL) || defined(_KERNEL)
  38. #ifndef PARSESTREAM
  39. #define PARSESTREAM
  40. #endif
  41. #endif
  42. #if defined(PARSESTREAM) && defined(HAVE_SYS_STREAM_H)
  43. #define PARSEKERNEL
  44. #ifdef HAVE_SYS_TERMIOS_H
  45. #include <sys/termios.h>
  46. #endif
  47. #include <sys/ppsclock.h>
  48. #ifndef NTP_NEED_BOPS
  49. #define NTP_NEED_BOPS
  50. #endif
  51. #if defined(PARSESTREAM) && (defined(_sun) || defined(__sun)) && defined(HAVE_SYS_STREAM_H)
  52. /*
  53. * Sorry, but in SunOS 4.x AND Solaris 2.x kernels there are no
  54. * mem* operations. I don't want them - bcopy, bzero
  55. * are fine in the kernel
  56. */
  57. #undef HAVE_STRING_H /* don't include that at kernel level - prototype mismatch in Solaris 2.6 */
  58. #include "ntp_string.h"
  59. #else
  60. #include <stdio.h>
  61. #endif
  62. struct parsestream /* parse module local data */
  63. {
  64. queue_t *parse_queue; /* read stream for this channel */
  65. queue_t *parse_dqueue; /* driver queue entry (PPS support) */
  66. unsigned long parse_status; /* operation flags */
  67. void *parse_data; /* local data space (PPS support) */
  68. parse_t parse_io; /* io structure */
  69. struct ppsclockev parse_ppsclockev; /* copy of last pps event */
  70. };
  71. typedef struct parsestream parsestream_t;
  72. #define PARSE_ENABLE 0x0001
  73. /*--------------- debugging support ---------------------------------*/
  74. #define DD_OPEN 0x00000001
  75. #define DD_CLOSE 0x00000002
  76. #define DD_RPUT 0x00000004
  77. #define DD_WPUT 0x00000008
  78. #define DD_RSVC 0x00000010
  79. #define DD_PARSE 0x00000020
  80. #define DD_INSTALL 0x00000040
  81. #define DD_ISR 0x00000080
  82. #define DD_RAWDCF 0x00000100
  83. extern int parsedebug;
  84. #ifdef DEBUG_PARSE
  85. #define parseprintf(X, Y) if ((X) & parsedebug) printf Y
  86. #else
  87. #define parseprintf(X, Y)
  88. #endif
  89. #endif
  90. /*
  91. * History:
  92. *
  93. * parsestreams.h,v
  94. * Revision 4.5 2005/06/25 10:52:47 kardel
  95. * fix version id / add version log
  96. *
  97. * Revision 4.4 1998/06/14 21:09:32 kardel
  98. * Sun acc cleanup
  99. *
  100. * Revision 4.3 1998/06/13 18:14:32 kardel
  101. * make mem*() to b*() mapping magic work on Solaris too
  102. *
  103. * Revision 4.2 1998/06/13 15:16:22 kardel
  104. * fix mem*() to b*() function macro emulation
  105. *
  106. * Revision 4.1 1998/06/13 11:50:37 kardel
  107. * STREAM macro gone in favor of HAVE_SYS_STREAM_H
  108. *
  109. * Revision 4.0 1998/04/10 19:51:30 kardel
  110. * Start 4.0 release version numbering
  111. *
  112. * Revision 1.2 1998/04/10 19:27:42 kardel
  113. * initial NTP VERSION 4 integration of PARSE with GPS166 binary support
  114. *
  115. */