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