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