Home | History | Annotate | Line # | Download | only in net
if_pppvar.h revision 1.11
      1 /*	$NetBSD: if_pppvar.h,v 1.11 2000/03/23 07:03:25 thorpej Exp $	*/
      2 /*	Id: if_pppvar.h,v 1.3 1996/07/01 01:04:37 paulus Exp	 */
      3 
      4 /*
      5  * if_pppvar.h - private structures and declarations for PPP.
      6  *
      7  * Copyright (c) 1994 The Australian National University.
      8  * All rights reserved.
      9  *
     10  * Permission to use, copy, modify, and distribute this software and its
     11  * documentation is hereby granted, provided that the above copyright
     12  * notice appears in all copies.  This software is provided without any
     13  * warranty, express or implied. The Australian National University
     14  * makes no representations about the suitability of this software for
     15  * any purpose.
     16  *
     17  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
     18  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
     19  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
     20  * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
     21  * OF SUCH DAMAGE.
     22  *
     23  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
     24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
     25  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
     26  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
     27  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
     28  * OR MODIFICATIONS.
     29  *
     30  * Copyright (c) 1989 Carnegie Mellon University.
     31  * All rights reserved.
     32  *
     33  * Redistribution and use in source and binary forms are permitted
     34  * provided that the above copyright notice and this paragraph are
     35  * duplicated in all such forms and that any documentation,
     36  * advertising materials, and other materials related to such
     37  * distribution and use acknowledge that the software was developed
     38  * by Carnegie Mellon University.  The name of the
     39  * University may not be used to endorse or promote products derived
     40  * from this software without specific prior written permission.
     41  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
     42  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
     43  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
     44  */
     45 
     46 #ifndef _NET_IF_PPPVAR_H_
     47 #define _NET_IF_PPPVAR_H_
     48 
     49 #include <sys/callout.h>
     50 
     51 /*
     52  * Supported network protocols.  These values are used for
     53  * indexing sc_npmode.
     54  */
     55 #define NP_IP	0		/* Internet Protocol */
     56 #define NP_IPV6	1		/* Internet Protocol version 6 */
     57 #define NUM_NP	2		/* Number of NPs. */
     58 
     59 /*
     60  * Structure describing each ppp unit.
     61  */
     62 struct ppp_softc {
     63 	struct	ifnet sc_if;		/* network-visible interface */
     64 	int	sc_unit;		/* XXX unit number */
     65 	u_int	sc_flags;		/* control/status bits; see if_ppp.h */
     66 	void	*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 	struct	callout sc_timo_ch;	/* timeout callout */
     71 	u_int16_t sc_mru;		/* max receive unit */
     72 	pid_t	sc_xfer;		/* used in transferring unit */
     73 	struct	ifqueue sc_rawq;	/* received packets */
     74 	struct	ifqueue sc_inq;		/* queue of input packets for daemon */
     75 	struct	ifqueue sc_fastq;	/* interactive output packet q */
     76 	struct	mbuf *sc_togo;		/* output packet ready to go */
     77 	struct	mbuf *sc_npqueue;	/* output packets not to be sent yet */
     78 	struct	mbuf **sc_npqtail;	/* ptr to last next ptr in npqueue */
     79 	struct	pppstat sc_stats;	/* count of bytes/pkts sent/rcvd */
     80 	caddr_t	sc_bpf;			/* hook for BPF */
     81 	enum	NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
     82 	struct	compressor *sc_xcomp;	/* transmit compressor */
     83 	void	*sc_xc_state;		/* transmit compressor state */
     84 	struct	compressor *sc_rcomp;	/* receive decompressor */
     85 	void	*sc_rc_state;		/* receive decompressor state */
     86 	time_t	sc_last_sent;		/* time (secs) last NP pkt sent */
     87 	time_t	sc_last_recv;		/* time (secs) last NP pkt rcvd */
     88 #ifdef PPP_FILTER
     89 	/* Filter for packets to pass. */
     90 	struct	bpf_program sc_pass_filt_in;
     91 	struct	bpf_program sc_pass_filt_out;
     92 
     93 	/* Filter for "non-idle" packets. */
     94 	struct	bpf_program sc_active_filt_in;
     95 	struct	bpf_program sc_active_filt_out;
     96 #endif /* PPP_FILTER */
     97 #ifdef	VJC
     98 	struct	slcompress *sc_comp; 	/* vjc control buffer */
     99 #endif
    100 
    101 	/* Device-dependent part for async lines. */
    102 	ext_accm sc_asyncmap;		/* async control character map */
    103 	u_int32_t sc_rasyncmap;		/* receive async control char map */
    104 	struct	mbuf *sc_outm;		/* mbuf chain currently being output */
    105 	struct	mbuf *sc_m;		/* pointer to input mbuf chain */
    106 	struct	mbuf *sc_mc;		/* pointer to current input mbuf */
    107 	char	*sc_mp;			/* ptr to next char in input mbuf */
    108 	u_int16_t sc_ilen;		/* length of input packet so far */
    109 	u_int16_t sc_fcs;		/* FCS so far (input) */
    110 	u_int16_t sc_outfcs;		/* FCS so far for output packet */
    111 	u_char	sc_rawin[16];		/* chars as received */
    112 	int	sc_rawin_count;		/* # in sc_rawin */
    113 };
    114 
    115 #ifdef _KERNEL
    116 struct	ppp_softc ppp_softc[NPPP];
    117 
    118 struct	ppp_softc *pppalloc __P((pid_t pid));
    119 void	pppdealloc __P((struct ppp_softc *sc));
    120 int	pppioctl __P((struct ppp_softc *sc, u_long cmd, caddr_t data,
    121 		      int flag, struct proc *p));
    122 void	ppp_restart __P((struct ppp_softc *sc));
    123 void	ppppktin __P((struct ppp_softc *sc, struct mbuf *m, int lost));
    124 struct	mbuf *ppp_dequeue __P((struct ppp_softc *sc));
    125 int	pppoutput __P((struct ifnet *, struct mbuf *,
    126 		       struct sockaddr *, struct rtentry *));
    127 #endif /* _KERNEL */
    128 
    129 #endif /* _NET_IF_PPPVAR_H_ */
    130