Home | History | Annotate | Line # | Download | only in net
if_pppvar.h revision 1.15
      1  1.15    itojun /*	$NetBSD: if_pppvar.h,v 1.15 2002/07/01 22:09:34 itojun Exp $	*/
      2   1.6  christos /*	Id: if_pppvar.h,v 1.3 1996/07/01 01:04:37 paulus Exp	 */
      3   1.6  christos 
      4   1.1    paulus /*
      5   1.1    paulus  * if_pppvar.h - private structures and declarations for PPP.
      6   1.1    paulus  *
      7   1.1    paulus  * Copyright (c) 1994 The Australian National University.
      8   1.1    paulus  * All rights reserved.
      9   1.1    paulus  *
     10   1.1    paulus  * Permission to use, copy, modify, and distribute this software and its
     11   1.1    paulus  * documentation is hereby granted, provided that the above copyright
     12   1.1    paulus  * notice appears in all copies.  This software is provided without any
     13   1.1    paulus  * warranty, express or implied. The Australian National University
     14   1.1    paulus  * makes no representations about the suitability of this software for
     15   1.1    paulus  * any purpose.
     16   1.1    paulus  *
     17   1.1    paulus  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
     18   1.1    paulus  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
     19   1.1    paulus  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
     20   1.1    paulus  * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
     21   1.1    paulus  * OF SUCH DAMAGE.
     22   1.1    paulus  *
     23   1.1    paulus  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
     24   1.1    paulus  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
     25   1.1    paulus  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
     26   1.1    paulus  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
     27   1.1    paulus  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
     28   1.1    paulus  * OR MODIFICATIONS.
     29   1.1    paulus  *
     30  1.15    itojun  * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
     31   1.1    paulus  *
     32  1.15    itojun  * Redistribution and use in source and binary forms, with or without
     33  1.15    itojun  * modification, are permitted provided that the following conditions
     34  1.15    itojun  * are met:
     35  1.15    itojun  *
     36  1.15    itojun  * 1. Redistributions of source code must retain the above copyright
     37  1.15    itojun  *    notice, this list of conditions and the following disclaimer.
     38  1.15    itojun  *
     39  1.15    itojun  * 2. Redistributions in binary form must reproduce the above copyright
     40  1.15    itojun  *    notice, this list of conditions and the following disclaimer in
     41  1.15    itojun  *    the documentation and/or other materials provided with the
     42  1.15    itojun  *    distribution.
     43  1.15    itojun  *
     44  1.15    itojun  * 3. The name "Carnegie Mellon University" must not be used to
     45  1.15    itojun  *    endorse or promote products derived from this software without
     46  1.15    itojun  *    prior written permission. For permission or any legal
     47  1.15    itojun  *    details, please contact
     48  1.15    itojun  *      Office of Technology Transfer
     49  1.15    itojun  *      Carnegie Mellon University
     50  1.15    itojun  *      5000 Forbes Avenue
     51  1.15    itojun  *      Pittsburgh, PA  15213-3890
     52  1.15    itojun  *      (412) 268-4387, fax: (412) 268-7395
     53  1.15    itojun  *      tech-transfer (at) andrew.cmu.edu
     54  1.15    itojun  *
     55  1.15    itojun  * 4. Redistributions of any form whatsoever must retain the following
     56  1.15    itojun  *    acknowledgment:
     57  1.15    itojun  *    "This product includes software developed by Computing Services
     58  1.15    itojun  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
     59  1.15    itojun  *
     60  1.15    itojun  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
     61  1.15    itojun  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     62  1.15    itojun  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
     63  1.15    itojun  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     64  1.15    itojun  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
     65  1.15    itojun  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
     66  1.15    itojun  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     67   1.1    paulus  */
     68   1.1    paulus 
     69   1.8     perry #ifndef _NET_IF_PPPVAR_H_
     70   1.8     perry #define _NET_IF_PPPVAR_H_
     71   1.8     perry 
     72  1.11   thorpej #include <sys/callout.h>
     73  1.11   thorpej 
     74   1.1    paulus /*
     75   1.1    paulus  * Supported network protocols.  These values are used for
     76   1.1    paulus  * indexing sc_npmode.
     77   1.1    paulus  */
     78   1.1    paulus #define NP_IP	0		/* Internet Protocol */
     79  1.10    itojun #define NP_IPV6	1		/* Internet Protocol version 6 */
     80  1.10    itojun #define NUM_NP	2		/* Number of NPs. */
     81   1.1    paulus 
     82   1.1    paulus /*
     83   1.1    paulus  * Structure describing each ppp unit.
     84   1.1    paulus  */
     85   1.1    paulus struct ppp_softc {
     86   1.1    paulus 	struct	ifnet sc_if;		/* network-visible interface */
     87   1.4   thorpej 	int	sc_unit;		/* XXX unit number */
     88   1.1    paulus 	u_int	sc_flags;		/* control/status bits; see if_ppp.h */
     89   1.1    paulus 	void	*sc_devp;		/* pointer to device-dep structure */
     90   1.1    paulus 	void	(*sc_start) __P((struct ppp_softc *));	/* start output proc */
     91   1.1    paulus 	void	(*sc_ctlp) __P((struct ppp_softc *)); /* rcvd control pkt */
     92   1.1    paulus 	void	(*sc_relinq) __P((struct ppp_softc *)); /* relinquish ifunit */
     93  1.11   thorpej 	struct	callout sc_timo_ch;	/* timeout callout */
     94   1.1    paulus 	u_int16_t sc_mru;		/* max receive unit */
     95   1.1    paulus 	pid_t	sc_xfer;		/* used in transferring unit */
     96   1.1    paulus 	struct	ifqueue sc_rawq;	/* received packets */
     97   1.1    paulus 	struct	ifqueue sc_inq;		/* queue of input packets for daemon */
     98   1.1    paulus 	struct	ifqueue sc_fastq;	/* interactive output packet q */
     99   1.1    paulus 	struct	mbuf *sc_togo;		/* output packet ready to go */
    100   1.1    paulus 	struct	mbuf *sc_npqueue;	/* output packets not to be sent yet */
    101   1.1    paulus 	struct	mbuf **sc_npqtail;	/* ptr to last next ptr in npqueue */
    102   1.3    paulus 	struct	pppstat sc_stats;	/* count of bytes/pkts sent/rcvd */
    103   1.1    paulus 	enum	NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
    104   1.1    paulus 	struct	compressor *sc_xcomp;	/* transmit compressor */
    105   1.1    paulus 	void	*sc_xc_state;		/* transmit compressor state */
    106   1.1    paulus 	struct	compressor *sc_rcomp;	/* receive decompressor */
    107   1.1    paulus 	void	*sc_rc_state;		/* receive decompressor state */
    108   1.1    paulus 	time_t	sc_last_sent;		/* time (secs) last NP pkt sent */
    109   1.1    paulus 	time_t	sc_last_recv;		/* time (secs) last NP pkt rcvd */
    110  1.13   thorpej #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
    111  1.13   thorpej 	void	*sc_si;			/* software interrupt handle */
    112  1.13   thorpej #endif
    113   1.6  christos #ifdef PPP_FILTER
    114   1.9   thorpej 	/* Filter for packets to pass. */
    115   1.9   thorpej 	struct	bpf_program sc_pass_filt_in;
    116   1.9   thorpej 	struct	bpf_program sc_pass_filt_out;
    117   1.9   thorpej 
    118   1.9   thorpej 	/* Filter for "non-idle" packets. */
    119   1.9   thorpej 	struct	bpf_program sc_active_filt_in;
    120   1.9   thorpej 	struct	bpf_program sc_active_filt_out;
    121   1.6  christos #endif /* PPP_FILTER */
    122   1.3    paulus #ifdef	VJC
    123   1.3    paulus 	struct	slcompress *sc_comp; 	/* vjc control buffer */
    124   1.3    paulus #endif
    125   1.6  christos 
    126   1.1    paulus 	/* Device-dependent part for async lines. */
    127   1.1    paulus 	ext_accm sc_asyncmap;		/* async control character map */
    128   1.1    paulus 	u_int32_t sc_rasyncmap;		/* receive async control char map */
    129   1.1    paulus 	struct	mbuf *sc_outm;		/* mbuf chain currently being output */
    130   1.1    paulus 	struct	mbuf *sc_m;		/* pointer to input mbuf chain */
    131   1.1    paulus 	struct	mbuf *sc_mc;		/* pointer to current input mbuf */
    132   1.1    paulus 	char	*sc_mp;			/* ptr to next char in input mbuf */
    133   1.1    paulus 	u_int16_t sc_ilen;		/* length of input packet so far */
    134   1.1    paulus 	u_int16_t sc_fcs;		/* FCS so far (input) */
    135   1.1    paulus 	u_int16_t sc_outfcs;		/* FCS so far for output packet */
    136   1.1    paulus 	u_char	sc_rawin[16];		/* chars as received */
    137   1.1    paulus 	int	sc_rawin_count;		/* # in sc_rawin */
    138   1.1    paulus };
    139   1.1    paulus 
    140   1.5     mikel #ifdef _KERNEL
    141  1.14      matt extern	struct	ppp_softc ppp_softc[];
    142   1.1    paulus 
    143   1.1    paulus struct	ppp_softc *pppalloc __P((pid_t pid));
    144   1.1    paulus void	pppdealloc __P((struct ppp_softc *sc));
    145   1.2    briggs int	pppioctl __P((struct ppp_softc *sc, u_long cmd, caddr_t data,
    146   1.1    paulus 		      int flag, struct proc *p));
    147   1.6  christos void	ppp_restart __P((struct ppp_softc *sc));
    148   1.1    paulus void	ppppktin __P((struct ppp_softc *sc, struct mbuf *m, int lost));
    149   1.1    paulus struct	mbuf *ppp_dequeue __P((struct ppp_softc *sc));
    150   1.7  christos int	pppoutput __P((struct ifnet *, struct mbuf *,
    151   1.7  christos 		       struct sockaddr *, struct rtentry *));
    152   1.5     mikel #endif /* _KERNEL */
    153   1.8     perry 
    154   1.8     perry #endif /* _NET_IF_PPPVAR_H_ */
    155