MASSIVE reorganization of the device operations vector. Change cdevsw
[dragonfly.git] / sys / net / ppp / if_pppvar.h
1 /*
2  * if_pppvar.h - private structures and declarations for PPP.
3  *
4  * Copyright (c) 1994 The Australian National University.
5  * All rights reserved.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation is hereby granted, provided that the above copyright
9  * notice appears in all copies.  This software is provided without any
10  * warranty, express or implied. The Australian National University
11  * makes no representations about the suitability of this software for
12  * any purpose.
13  *
14  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
15  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
17  * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
18  * OF SUCH DAMAGE.
19  *
20  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
24  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
25  * OR MODIFICATIONS.
26  *
27  * Copyright (c) 1989 Carnegie Mellon University.
28  * All rights reserved.
29  *
30  * Redistribution and use in source and binary forms are permitted
31  * provided that the above copyright notice and this paragraph are
32  * duplicated in all such forms and that any documentation,
33  * advertising materials, and other materials related to such
34  * distribution and use acknowledge that the software was developed
35  * by Carnegie Mellon University.  The name of the
36  * University may not be used to endorse or promote products derived
37  * from this software without specific prior written permission.
38  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
39  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
40  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
41  *
42  * $FreeBSD: src/sys/net/if_pppvar.h,v 1.15 2000/01/29 16:56:23 peter Exp $
43  * $DragonFly: src/sys/net/ppp/if_pppvar.h,v 1.6 2006/07/28 02:17:40 dillon Exp $
44  */
45
46 /*
47  * Supported network protocols.  These values are used for
48  * indexing sc_npmode.
49  */
50 #define NP_IP   0               /* Internet Protocol */
51 #define NUM_NP  1               /* Number of NPs. */
52
53 /*
54  * Structure describing each ppp unit.
55  */
56 struct ppp_softc {
57         struct  ifnet sc_if;            /* network-visible interface */
58 /*hi*/  u_int   sc_flags;               /* control/status bits; see if_ppp.h */
59         struct  callout sc_timeout;     /* Used for scheduling timeouts */
60         void    *sc_devp;               /* pointer to device-dep structure */
61         void    (*sc_start) (struct ppp_softc *);       /* start output proc */
62         void    (*sc_ctlp) (struct ppp_softc *); /* rcvd control pkt */
63         void    (*sc_relinq) (struct ppp_softc *); /* relinquish ifunit */
64         void    (*sc_setmtu) (struct ppp_softc *); /* set mtu */
65         short   sc_mru;                 /* max receive unit */
66         struct  thread *sc_xfer;        /* used in transferring unit */
67 /*hi*/  struct  ifqueue sc_rawq;        /* received packets */
68 /*net*/ struct  ifqueue sc_inq;         /* queue of input packets for daemon */
69 /*net*/ struct  ifqueue sc_fastq;       /* interactive output packet q */
70         struct  mbuf *sc_npqueue;       /* output packets not to be sent yet */
71         struct  mbuf **sc_npqtail;      /* ptr to last next ptr in npqueue */
72         struct  pppstat sc_stats;       /* count of bytes/pkts sent/rcvd */
73         enum    NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
74         struct  compressor *sc_xcomp;   /* transmit compressor */
75         void    *sc_xc_state;           /* transmit compressor state */
76         struct  compressor *sc_rcomp;   /* receive decompressor */
77         void    *sc_rc_state;           /* receive decompressor state */
78         time_t  sc_last_sent;           /* time (secs) last NP pkt sent */
79         time_t  sc_last_recv;           /* time (secs) last NP pkt rcvd */
80 #ifdef PPP_FILTER
81         struct  bpf_program sc_pass_filt;   /* filter for packets to pass */
82         struct  bpf_program sc_active_filt; /* filter for "non-idle" packets */
83 #endif /* PPP_FILTER */
84 #ifdef  VJC
85         struct  slcompress *sc_comp;    /* vjc control buffer */
86 #endif
87
88         /* Device-dependent part for async lines. */
89         ext_accm sc_asyncmap;           /* async control character map */
90         u_long  sc_rasyncmap;           /* receive async control char map */
91         struct  mbuf *sc_outm;          /* mbuf chain currently being output */
92         struct  mbuf *sc_m;             /* pointer to input mbuf chain */
93         struct  mbuf *sc_mc;            /* pointer to current input mbuf */
94         char    *sc_mp;                 /* ptr to next char in input mbuf */
95         short   sc_ilen;                /* length of input packet so far */
96         u_short sc_fcs;                 /* FCS so far (input) */
97         u_short sc_outfcs;              /* FCS so far for output packet */
98         u_char  sc_rawin[16];           /* chars as received */
99         int     sc_rawin_count;         /* # in sc_rawin */
100 };
101
102 extern struct ppp_softc ppp_softc[];
103
104 struct  ppp_softc *pppalloc (struct thread *td);
105 void    pppdealloc (struct ppp_softc *sc);
106 int     pppioctl (struct ppp_softc *sc, u_long cmd, caddr_t data,
107                       int flag, struct ucred *cred);
108 int     pppoutput (struct ifnet *ifp, struct mbuf *m0,
109                        struct sockaddr *dst, struct rtentry *rtp);
110 void    ppp_restart (struct ppp_softc *sc);
111 void    ppppktin (struct ppp_softc *sc, struct mbuf *m, int lost);
112 struct  mbuf *ppp_dequeue (struct ppp_softc *sc);