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