Home | History | Annotate | Line # | Download | only in net
if_pppvar.h revision 1.21
      1 /*	$NetBSD: if_pppvar.h,v 1.21 2005/12/11 23:05: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) 1989-2002 Paul Mackerras. All rights reserved.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  *
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  *
     16  * 2. Redistributions in binary form must reproduce the above copyright
     17  *    notice, this list of conditions and the following disclaimer in
     18  *    the documentation and/or other materials provided with the
     19  *    distribution.
     20  *
     21  * 3. The name(s) of the authors of this software must not be used to
     22  *    endorse or promote products derived from this software without
     23  *    prior written permission.
     24  *
     25  * 4. Redistributions of any form whatsoever must retain the following
     26  *    acknowledgment:
     27  *    "This product includes software developed by Paul Mackerras
     28  *     <paulus (at) samba.org>".
     29  *
     30  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
     31  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     32  * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
     33  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     34  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
     35  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
     36  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     37  *
     38  * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
     39  *
     40  * Redistribution and use in source and binary forms, with or without
     41  * modification, are permitted provided that the following conditions
     42  * are met:
     43  *
     44  * 1. Redistributions of source code must retain the above copyright
     45  *    notice, this list of conditions and the following disclaimer.
     46  *
     47  * 2. Redistributions in binary form must reproduce the above copyright
     48  *    notice, this list of conditions and the following disclaimer in
     49  *    the documentation and/or other materials provided with the
     50  *    distribution.
     51  *
     52  * 3. The name "Carnegie Mellon University" must not be used to
     53  *    endorse or promote products derived from this software without
     54  *    prior written permission. For permission or any legal
     55  *    details, please contact
     56  *      Office of Technology Transfer
     57  *      Carnegie Mellon University
     58  *      5000 Forbes Avenue
     59  *      Pittsburgh, PA  15213-3890
     60  *      (412) 268-4387, fax: (412) 268-7395
     61  *      tech-transfer (at) andrew.cmu.edu
     62  *
     63  * 4. Redistributions of any form whatsoever must retain the following
     64  *    acknowledgment:
     65  *    "This product includes software developed by Computing Services
     66  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
     67  *
     68  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
     69  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     70  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
     71  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     72  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
     73  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
     74  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     75  */
     76 
     77 #ifndef _NET_IF_PPPVAR_H_
     78 #define _NET_IF_PPPVAR_H_
     79 
     80 #include <sys/callout.h>
     81 
     82 /*
     83  * Supported network protocols.  These values are used for
     84  * indexing sc_npmode.
     85  */
     86 #define NP_IP	0		/* Internet Protocol */
     87 #define NP_IPV6	1		/* Internet Protocol version 6 */
     88 #define NUM_NP	2		/* Number of NPs. */
     89 
     90 /*
     91  * Structure describing each ppp unit.
     92  */
     93 struct ppp_softc {
     94 	struct	ifnet sc_if;		/* network-visible interface */
     95 	int	sc_unit;		/* XXX unit number */
     96 	u_int	sc_flags;		/* control/status bits; see if_ppp.h */
     97 	void	*sc_devp;		/* pointer to device-dep structure */
     98 	void	(*sc_start)(struct ppp_softc *);	/* start output proc */
     99 	void	(*sc_ctlp)(struct ppp_softc *); /* rcvd control pkt */
    100 	void	(*sc_relinq)(struct ppp_softc *); /* relinquish ifunit */
    101 	struct	callout sc_timo_ch;	/* timeout callout */
    102 	u_int16_t sc_mru;		/* max receive unit */
    103 	pid_t	sc_xfer;		/* used in transferring unit */
    104 	struct	ifqueue sc_rawq;	/* received packets */
    105 	struct	ifqueue sc_inq;		/* queue of input packets for daemon */
    106 	struct	ifqueue sc_fastq;	/* interactive output packet q */
    107 	struct	mbuf *sc_togo;		/* output packet ready to go */
    108 	struct	mbuf *sc_npqueue;	/* output packets not to be sent yet */
    109 	struct	mbuf **sc_npqtail;	/* ptr to last next ptr in npqueue */
    110 	struct	pppstat sc_stats;	/* count of bytes/pkts sent/rcvd */
    111 	enum	NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
    112 	struct	compressor *sc_xcomp;	/* transmit compressor */
    113 	void	*sc_xc_state;		/* transmit compressor state */
    114 	struct	compressor *sc_rcomp;	/* receive decompressor */
    115 	void	*sc_rc_state;		/* receive decompressor state */
    116 	time_t	sc_last_sent;		/* time (secs) last NP pkt sent */
    117 	time_t	sc_last_recv;		/* time (secs) last NP pkt rcvd */
    118 #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
    119 	void	*sc_si;			/* software interrupt handle */
    120 #endif
    121 #ifdef PPP_FILTER
    122 	/* Filter for packets to pass. */
    123 	struct	bpf_program sc_pass_filt_in;
    124 	struct	bpf_program sc_pass_filt_out;
    125 
    126 	/* Filter for "non-idle" packets. */
    127 	struct	bpf_program sc_active_filt_in;
    128 	struct	bpf_program sc_active_filt_out;
    129 #endif /* PPP_FILTER */
    130 #ifdef	VJC
    131 	struct	slcompress *sc_comp; 	/* vjc control buffer */
    132 #endif
    133 
    134 	/* Device-dependent part for async lines. */
    135 	ext_accm sc_asyncmap;		/* async control character map */
    136 	u_int32_t sc_rasyncmap;		/* receive async control char map */
    137 	struct	mbuf *sc_outm;		/* mbuf chain currently being output */
    138 	struct	mbuf *sc_m;		/* pointer to input mbuf chain */
    139 	struct	mbuf *sc_mc;		/* pointer to current input mbuf */
    140 	char	*sc_mp;			/* ptr to next char in input mbuf */
    141 	u_int16_t sc_ilen;		/* length of input packet so far */
    142 	u_int16_t sc_fcs;		/* FCS so far (input) */
    143 	u_int16_t sc_outfcs;		/* FCS so far for output packet */
    144 	u_char sc_rawin_start;		/* current char start */
    145 	struct ppp_rawin sc_rawin;	/* chars as received */
    146 	LIST_ENTRY(ppp_softc) sc_iflist;
    147 };
    148 
    149 #ifdef _KERNEL
    150 
    151 struct	ppp_softc *pppalloc(pid_t);
    152 void	pppdealloc(struct ppp_softc *);
    153 int	pppioctl(struct ppp_softc *, u_long, caddr_t, int, struct proc *);
    154 void	ppp_restart(struct ppp_softc *);
    155 void	ppppktin(struct ppp_softc *, struct mbuf *, int);
    156 struct	mbuf *ppp_dequeue(struct ppp_softc *);
    157 int	pppoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
    158 	    struct rtentry *);
    159 #endif /* _KERNEL */
    160 
    161 #endif /* !_NET_IF_PPPVAR_H_ */
    162