]> git.ozlabs.org Git - ppp.git/blob - linux/if_pppvar.h
NetBSD-1.1 files
[ppp.git] / linux / if_pppvar.h
1 /*      $Id: if_pppvar.h,v 1.2 1995/06/12 11:36:51 paulus Exp $ */
2 /*
3  * if_pppvar.h - private structures and declarations for PPP.
4  *
5  * Copyright (c) 1994 The Australian National University.
6  * All rights reserved.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation is hereby granted, provided that the above copyright
10  * notice appears in all copies.  This software is provided without any
11  * warranty, express or implied. The Australian National University
12  * makes no representations about the suitability of this software for
13  * any purpose.
14  *
15  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
16  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
17  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
18  * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
19  * OF SUCH DAMAGE.
20  *
21  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
22  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
24  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
25  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
26  * OR MODIFICATIONS.
27  *
28  * Copyright (c) 1989 Carnegie Mellon University.
29  * All rights reserved.
30  *
31  * Redistribution and use in source and binary forms are permitted
32  * provided that the above copyright notice and this paragraph are
33  * duplicated in all such forms and that any documentation,
34  * advertising materials, and other materials related to such
35  * distribution and use acknowledge that the software was developed
36  * by Carnegie Mellon University.  The name of the
37  * University may not be used to endorse or promote products derived
38  * from this software without specific prior written permission.
39  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
40  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
41  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
42  */
43
44 /*
45  *  ==PPPVERSION 2.1.3==
46  *
47  *  NOTE TO MAINTAINERS:
48  *     If you modify this file at all, increment the last number above.
49  *     ppp.c is shipped with a PPP distribution as well as with the kernel;
50  *     if everyone increases the PPPVERSION number above, then scripts
51  *     can do the right thing when deciding whether to install a new ppp.c
52  *     file.  Don't change the format of that line otherwise, so the
53  *     installation script can recognize it.
54  */
55
56 /*
57  * Supported network protocols.  These values are used for
58  * indexing sc_npmode.
59  */
60
61 #define NP_IP   0               /* Internet Protocol */
62 #define NUM_NP  1               /* Number of NPs. */
63
64 /*
65  * Buffers for the PPP process have the following structure
66  */
67
68 #define RBUFSIZE 2048   /* MUST be a power of 2 and be <= 4095 */
69 struct ppp_buffer {
70   int                   size;           /* Size of the buffer area      */
71   int                   count;          /* Count of characters in bufr  */
72   int                   head;           /* index to head of list        */
73   int                   tail;           /* index to tail of list        */
74   int                   locked;         /* Buffer is being sent         */
75   int                   type;           /* Type of the buffer           */
76                                         /* =0, device read buffer       */
77                                         /* =1, device write buffer      */
78                                         /* =2, daemon write buffer      */
79                                         /* =3, daemon read buffer       */
80   unsigned short        fcs;            /* Frame Check Sequence (CRC)   */
81 };
82
83 /* Given a pointer to the ppp_buffer then return base address of buffer */
84 #define buf_base(buf) ((u_char *) (&buf[1]))
85
86 /*
87  * Structure describing each ppp unit.
88  */
89
90 struct ppp {
91         int             magic;          /* magic value for structure    */
92
93   /* Bitmapped flag fields. */
94         char            inuse;          /* are we allocated?            */
95         char            escape;         /* 0x20 if prev char was PPP_ESC*/
96         char            toss;           /* toss this frame              */
97
98         unsigned int    flags;          /* miscellany                   */
99
100         ext_accm        xmit_async_map; /* 1 bit means that given control 
101                                            character is quoted on output*/
102
103         unsigned long   recv_async_map; /* 1 bit means that given control 
104                                            character is ignored on input*/
105         int                     mtu;    /* maximum xmit frame size      */
106         int                     mru;    /* maximum receive frame size   */
107
108   /* Information about the current tty data */
109         int                     line;           /* PPP channel number   */
110         struct tty_struct       *tty;           /* ptr to TTY structure */
111         int                     bytes_sent;     /* Bytes sent on frame  */
112         int                     bytes_rcvd;     /* Bytes recvd on frame */
113
114   /* Interface to the network layer */
115         struct device           *dev;   /* easy for intr handling       */
116
117   /* VJ Header compression data */
118         struct slcompress       *slcomp;/* for header compression       */
119
120   /* Transmission information */
121         struct ppp_buffer *xbuf;        /* Buffer currently being sent  */
122         struct ppp_buffer *s1buf;       /* Pointer to daemon buffer     */
123         struct ppp_buffer *s2buf;       /* Pointer to device buffer     */
124
125         unsigned long     last_xmit;    /* time of last transmission    */
126
127   /* These are pointers to the malloc()ed frame buffers.
128      These buffers are used while processing a packet.  If a packet
129      has to hang around for the user process to read it, it lingers in
130      the user buffers below. */
131
132         struct ppp_buffer *wbuf;        /* Transmission information     */
133         struct ppp_buffer *tbuf;        /* daemon transmission buffer   */
134         struct ppp_buffer *rbuf;        /* Receive information          */
135         struct ppp_buffer *ubuf;        /* User buffer information      */
136         struct ppp_buffer *cbuf;        /* compression buffer           */
137
138   /* Queues for select() functionality */
139         struct wait_queue *write_wait;  /* queue for reading processes  */
140         struct wait_queue *read_wait;   /* queue for writing processes  */
141
142   /* Statistic information */
143         struct pppstat    stats;        /* statistic information        */
144         struct ppp_ddinfo ddinfo;       /* demand dial information      */
145
146   /* PPP compression protocol information */
147         u_int   sc_bytessent;             /* count of octets sent */
148         u_int   sc_bytesrcvd;             /* count of octets received */
149         enum    NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
150         struct  compressor *sc_xcomp;     /* transmit compressor */
151         void    *sc_xc_state;             /* transmit compressor state */
152         struct  compressor *sc_rcomp;     /* receive decompressor */
153         void    *sc_rc_state;             /* receive decompressor state */
154 };