xref: /freebsd/contrib/ntp/kernel/sys/parsestreams.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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 Universitaet Erlangen-Nuernberg, 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 
34 #if	!(defined(lint) || defined(__GNUC__))
35   static char sysparsehrcsid[] = "parsestreams.h,v 4.5 2005/06/25 10:52:47 kardel RELEASE_20050625_A";
36 #endif
37 
38 #undef PARSEKERNEL
39 #if defined(KERNEL) || defined(_KERNEL)
40 #ifndef PARSESTREAM
41 #define PARSESTREAM
42 #endif
43 #endif
44 #if defined(PARSESTREAM) && defined(HAVE_SYS_STREAM_H)
45 #define PARSEKERNEL
46 
47 #ifdef HAVE_SYS_TERMIOS_H
48 #include <sys/termios.h>
49 #endif
50 
51 #include <sys/ppsclock.h>
52 
53 #ifndef NTP_NEED_BOPS
54 #define NTP_NEED_BOPS
55 #endif
56 
57 #if defined(PARSESTREAM) && (defined(_sun) || defined(__sun)) && defined(HAVE_SYS_STREAM_H)
58 /*
59  * Sorry, but in SunOS 4.x AND Solaris 2.x kernels there are no
60  * mem* operations. I don't want them - bcopy, bzero
61  * are fine in the kernel
62  */
63 #undef HAVE_STRING_H	/* don't include that at kernel level - prototype mismatch in Solaris 2.6 */
64 #include "ntp_string.h"
65 #else
66 #include <stdio.h>
67 #endif
68 
69 struct parsestream		/* parse module local data */
70 {
71   queue_t       *parse_queue;	/* read stream for this channel */
72   queue_t	*parse_dqueue;	/* driver queue entry (PPS support) */
73   unsigned long  parse_status;  /* operation flags */
74   void          *parse_data;	/* local data space (PPS support) */
75   parse_t	 parse_io;	/* io structure */
76   struct ppsclockev parse_ppsclockev; /* copy of last pps event */
77 };
78 
79 typedef struct parsestream parsestream_t;
80 
81 #define PARSE_ENABLE	0x0001
82 
83 /*--------------- debugging support ---------------------------------*/
84 
85 #define DD_OPEN    0x00000001
86 #define DD_CLOSE   0x00000002
87 #define DD_RPUT    0x00000004
88 #define DD_WPUT    0x00000008
89 #define DD_RSVC    0x00000010
90 #define DD_PARSE   0x00000020
91 #define DD_INSTALL 0x00000040
92 #define DD_ISR     0x00000080
93 #define DD_RAWDCF  0x00000100
94 
95 extern int parsedebug;
96 
97 #ifdef DEBUG_PARSE
98 
99 #define parseprintf(X, Y) if ((X) & parsedebug) printf Y
100 
101 #else
102 
103 #define parseprintf(X, Y)
104 
105 #endif
106 #endif
107 
108 /*
109  * History:
110  *
111  * parsestreams.h,v
112  * Revision 4.5  2005/06/25 10:52:47  kardel
113  * fix version id / add version log
114  *
115  * Revision 4.4  1998/06/14 21:09:32  kardel
116  * Sun acc cleanup
117  *
118  * Revision 4.3  1998/06/13 18:14:32  kardel
119  * make mem*() to b*() mapping magic work on Solaris too
120  *
121  * Revision 4.2  1998/06/13 15:16:22  kardel
122  * fix mem*() to b*() function macro emulation
123  *
124  * Revision 4.1  1998/06/13 11:50:37  kardel
125  * STREAM macro gone in favor of HAVE_SYS_STREAM_H
126  *
127  * Revision 4.0  1998/04/10 19:51:30  kardel
128  * Start 4.0 release version numbering
129  *
130  * Revision 1.2  1998/04/10 19:27:42  kardel
131  * initial NTP VERSION 4 integration of PARSE with GPS166 binary support
132  *
133  */
134