1/* 2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23/* 24 * if_ppp.h - Point-to-Point Protocol definitions. 25 * 26 * Copyright (c) 1989 Carnegie Mellon University. 27 * All rights reserved. 28 * 29 * Redistribution and use in source and binary forms are permitted 30 * provided that the above copyright notice and this paragraph are 31 * duplicated in all such forms and that any documentation, 32 * advertising materials, and other materials related to such 33 * distribution and use acknowledge that the software was developed 34 * by Carnegie Mellon University. The name of the 35 * University may not be used to endorse or promote products derived 36 * from this software without specific prior written permission. 37 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 38 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 39 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 40 * 41 */ 42 43#ifndef _IF_PPP_H_ 44#define _IF_PPP_H_ 45 46#include <net/if.h> 47 48/* 49 * Packet sizes 50 */ 51 52#define PPP_MTU 1500 /* Default MTU (size of Info field) */ 53#define PPP_MRU 1500 /* default MRU = max length of info field */ 54#define PPP_MAXMRU 65000 /* Largest MRU we allow */ 55#define PROTO_IPX 0x002b /* protocol numbers */ 56#define PROTO_DNA_RT 0x0027 /* DNA Routing */ 57 58 59/* 60 * Bit definitions for flags. 61 */ 62 63/* Link flags */ 64#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ 65#define SC_COMP_AC 0x00000002 /* header compression (output) */ 66#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ 67#define SC_HOLD 0x00000020 /* temporarily stop link */ 68 69/* Interface flags */ 70#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ 71#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ 72#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ 73#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ 74#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ 75#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ 76#define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */ 77#define SC_MULTILINK 0x00000400 /* do multilink encapsulation */ 78#define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */ 79#define SC_COMP_RUN 0x00001000 /* compressor has been inited */ 80#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ 81#define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */ 82#define SC_DEBUG 0x00010000 /* enable debug messages */ 83#define SC_LOOP_LOCAL 0x01000000 /* loopback packet to local address */ 84#define SC_SYNC 0x00200000 /* synchronous serial mode */ 85#define SC_LOG_RAWIN 0x00080000 /* log all chars received */ 86#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ 87 88/* unused flags */ 89#if 0 90#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ 91#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ 92#endif 93 94#define SC_MASK 0x0f200fff /* bits that user can change */ 95 96/* state bits */ 97#define SC_XMIT_BUSY 0x10000000 /* link is busy transmitting, don't attempt to send */ 98#define SC_XMIT_FULL 0x20000000 /* link is full transmitting, don't attempt to send */ 99#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ 100#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ 101#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ 102#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ 103#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ 104#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ 105 106 107#if __DARWIN_ALIGN_POWER 108#pragma options align=power 109#endif 110 111/* 112 * Ioctl definitions. 113 */ 114 115struct npioctl { 116 int protocol; /* PPP protocol, e.g. PPP_IP */ 117 enum NPmode mode; 118}; 119 120struct npafioctl { 121 int protocol; /* PPP protocol, e.g. PPP_IP */ 122 enum NPAFmode mode; 123}; 124 125/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ 126struct ppp_option_data { 127 void * ptr; 128 u_int32_t length; 129 int transmit; 130}; 131 132#ifdef KERNEL_PRIVATE 133struct ppp_option_data64 { 134 u_int64_t ptr; 135 u_int32_t length; 136 int transmit; 137}; 138 139struct ppp_option_data32 { 140 u_int32_t ptr; 141 u_int32_t length; 142 int transmit; 143}; 144#endif /* KERNEL_PRIVATE */ 145 146struct ifpppstatsreq { 147 char ifr_name[IFNAMSIZ]; 148 struct ppp_stats stats; /* statistic information */ 149}; 150 151struct ifpppcstatsreq { 152 char ifr_name[IFNAMSIZ]; 153 struct ppp_comp_stats stats; 154}; 155 156struct ifpppdelegate { 157 char ifr_delegate_name[IFNAMSIZ]; 158}; 159 160#if __DARWIN_ALIGN_POWER 161#pragma options align=reset 162#endif 163 164/* 165 * Ioctl definitions. 166 */ 167 168#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ 169#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ 170#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ 171#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ 172#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ 173#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ 174#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ 175#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ 176#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ 177#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ 178#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ 179#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ 180#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ 181#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) 182#ifdef KERNEL_PRIVATE 183#ifdef __LP64__ 184#define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32) 185#define PPPIOCSCOMPRESS64 PPPIOCSCOMPRESS 186#else 187#define PPPIOCSCOMPRESS32 PPPIOCSCOMPRESS 188#define PPPIOCSCOMPRESS64 _IOW('t', 77, struct ppp_option_data64) 189#endif /* __LP64__ */ 190#endif /* KERNEL_PRIVATE */ 191#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ 192#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ 193#define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */ 194#define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */ 195#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ 196#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ 197#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ 198#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ 199#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ 200#define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */ 201#define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ 202#define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ 203#define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ 204#define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ 205#define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ 206#define PPPIOCGNPAFMODE _IOWR('t', 54, struct npafioctl) /* get NPAF mode */ 207#define PPPIOCSNPAFMODE _IOW('t', 53, struct npafioctl) /* set NPAF mode */ 208#define PPPIOCSDELEGATE _IOW('t', 52, struct ifpppdelegate) /* set the delegate interface */ 209 210/* 211 * These two are interface ioctls so that pppstats can do them on 212 * a socket without having to open the serial device. 213 */ 214#define SIOCGPPPSTATS _IOWR('i', 123, struct ifpppstatsreq) 215#define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq) 216 217#if !defined(ifr_mtu) 218#define ifr_mtu ifr_ifru.ifru_metric 219#endif 220 221#endif /* _IF_PPP_H_ */ 222