]> git.ozlabs.org Git - ppp.git/blob - NeXT/if_pppvar.h
Get the repository a bit closer to what will be released
[ppp.git] / NeXT / if_pppvar.h
1 /*
2  * if_ppp.h - Point-to-Point Protocol definitions.
3  *
4  * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *
18  * 3. The name "Carnegie Mellon University" must not be used to
19  *    endorse or promote products derived from this software without
20  *    prior written permission. For permission or any legal
21  *    details, please contact
22  *      Office of Technology Transfer
23  *      Carnegie Mellon University
24  *      5000 Forbes Avenue
25  *      Pittsburgh, PA  15213-3890
26  *      (412) 268-4387, fax: (412) 268-7395
27  *      tech-transfer@andrew.cmu.edu
28  *
29  * 4. Redistributions of any form whatsoever must retain the following
30  *    acknowledgment:
31  *    "This product includes software developed by Computing Services
32  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
33  *
34  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
35  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
37  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
38  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
39  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
40  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
41  */
42
43 /* Portions Copyright (C) 1990 Brad K. Clements (streams support)
44  */
45
46 #if !(NS_TARGET >= 40)
47 #import <kernserv/prototypes.h>
48 #endif /* NS_TARGET */
49
50 /*
51  * Supported network protocols.  These values are used for
52  * indexing sc_npmode.
53  */
54 #define NP_IP   0               /* Internet Protocol */
55 #define NUM_NP  1               /* Number of NPs. */
56
57 #include "nbq.h"
58
59
60 /* only defined in the posix universe... */
61 /*typedef       int pid_t; */
62
63 struct ppp_softc {
64         netif_t sc_if;          /* network-visible interface */
65         u_int   sc_flags;       /* control/status bits; see if_ppp.h */
66         struct  tty *sc_devp;   /* pointer to device-dep structure */
67         void    (*sc_start) __P((struct ppp_softc *));  /* start output proc */
68         void    (*sc_ctlp) __P((struct ppp_softc *));   /* rcvd control pkt */
69         void    (*sc_relinq) __P((struct ppp_softc *)); /* relinquish ifunit */
70         u_int16_t sc_mru;       /* max receive unit */
71         pid_t   sc_xfer;        /* used in transferring unit */
72         NETBUF_T sc_m;          /* Current TTY input netbuf */
73         struct nb_queue sc_freeq; /* reserve netbufs */
74         struct nb_queue sc_rawq;  /* Raw input buffers */
75         struct nb_queue sc_fastq; /* For telnet, rlogin, and ftp control */
76         struct nb_queue sc_slowq; /* Everything else */
77         struct nb_queue sc_inq; /* Input available to user ppp */
78         struct nb_queue sc_npq; /* output packets not to be sent yet */
79         struct nb_queue sc_compq; /* Cache of compressed bufs to be sent */
80 #ifdef VJC
81         struct vjcompress sc_comp;
82 #endif
83         u_int   sc_bytessent;   /* count of octets sent */
84         u_int   sc_bytesrcvd;   /* count of octets received */
85         enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
86 #ifdef  PPP_COMPRESS
87         struct compressor *sc_xcomp; /* transmit compressor */
88         void    *sc_xc_state;   /* transmit compressor state */
89         struct compressor *sc_rcomp; /* receive decompressor */
90         void    *sc_rc_state;   /* receive decompressor state */
91 #endif
92         time_t  sc_last_sent;   /* time (secs) last NP pkt sent */
93         time_t  sc_last_recv;   /* time (secs) last NP pkt rcvd */
94
95         short sc_compsched;     /* synchronize compression callouts */
96         short sc_decompsched;   /* synchronize decompression callouts */
97
98         /* Device-dependent part for async lines. */
99         ext_accm sc_asyncmap;   /* async control character map */
100         u_int32_t sc_rasyncmap; /* receive async control char map */
101         NETBUF_T sc_outm;       /* netbuf currently being output */
102         char    *sc_mp;         /* ptr to next char in input netbuf */
103         u_int16_t sc_ilen;      /* length of input packet so far */
104         u_int16_t sc_fcs;       /* FCS so far (input) */
105         u_int16_t sc_outfcs;    /* FCS so far for output packet */
106         u_char  sc_rawin[16];   /* chars as received */
107         int     sc_rawin_count; /* # in sc_rawin */
108 };
109
110 extern struct   ppp_softc ppp_softc[];
111
112 struct  ppp_softc *pppalloc __P((pid_t pid));
113 void    pppdealloc __P((struct ppp_softc *sc));
114 int     pppioctl __P((struct ppp_softc *sc, u_long cmd, void *data, int flag));
115 void    ppppktin __P((struct ppp_softc *sc, NETBUF_T m, int lost));
116 NETBUF_T ppp_dequeue __P((struct ppp_softc *sc));
117
118 #define t_sc T_LINEP
119
120 #define incr_cnt(ifp,field) field##_set(ifp, field(ifp) + 1)
121
122 #ifdef VJC
123 #define VJ_HDRLEN       128
124 #endif