if_ppp.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* From: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp */
  2. /*
  3. * if_ppp.h - Point-to-Point Protocol definitions.
  4. *
  5. * Copyright (c) 1989 Carnegie Mellon University.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the University nor the names of its contributors
  16. * may be used to endorse or promote products derived from this software
  17. * without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY AND
  20. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  21. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  22. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  23. * IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY
  24. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  26. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  28. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  29. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  30. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. */
  33. /*
  34. * ==FILEVERSION 960926==
  35. *
  36. * NOTE TO MAINTAINERS:
  37. * If you modify this file at all, please set the above date.
  38. * if_ppp.h is shipped with a PPP distribution as well as with the kernel;
  39. * if everyone increases the FILEVERSION number above, then scripts
  40. * can do the right thing when deciding whether to install a new if_ppp.h
  41. * file. Don't change the format of that line otherwise, so the
  42. * installation script can recognize it.
  43. */
  44. #ifndef __NET_IF_PPP_H
  45. #define __NET_IF_PPP_H 1
  46. #include <sys/types.h>
  47. #include <stdint.h>
  48. #include <net/if.h>
  49. #include <sys/ioctl.h>
  50. #include <net/ppp_defs.h>
  51. __BEGIN_DECLS
  52. /*
  53. * Packet sizes
  54. */
  55. #define PPP_MTU 1500 /* Default MTU (size of Info field) */
  56. #define PPP_MAXMRU 65000 /* Largest MRU we allow */
  57. #define PPP_VERSION "2.2.0"
  58. #define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */
  59. #define PROTO_IPX 0x002b /* protocol numbers */
  60. #define PROTO_DNA_RT 0x0027 /* DNA Routing */
  61. /*
  62. * Bit definitions for flags.
  63. */
  64. #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
  65. #define SC_COMP_AC 0x00000002 /* header compression (output) */
  66. #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
  67. #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
  68. #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
  69. #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
  70. #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
  71. #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
  72. #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
  73. #define SC_COMP_RUN 0x00001000 /* compressor has been inited */
  74. #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
  75. #define SC_DEBUG 0x00010000 /* enable debug messages */
  76. #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
  77. #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
  78. #define SC_LOG_RAWIN 0x00080000 /* log all chars received */
  79. #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
  80. #define SC_MASK 0x0fE0ffff /* bits that user can change */
  81. /* state bits */
  82. #define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */
  83. #define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */
  84. #define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */
  85. #define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */
  86. #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
  87. #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
  88. #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
  89. #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
  90. #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
  91. #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
  92. /*
  93. * Ioctl definitions.
  94. */
  95. struct npioctl {
  96. int protocol; /* PPP protocol, e.g. PPP_IP */
  97. enum NPmode mode;
  98. };
  99. /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
  100. struct ppp_option_data {
  101. uint8_t *ptr;
  102. uint32_t length;
  103. int transmit;
  104. };
  105. /* 'struct ifreq' is only available from net/if.h under __USE_MISC. */
  106. #ifdef __USE_MISC
  107. struct ifpppstatsreq {
  108. struct ifreq b;
  109. struct ppp_stats stats; /* statistic information */
  110. };
  111. struct ifpppcstatsreq {
  112. struct ifreq b;
  113. struct ppp_comp_stats stats;
  114. };
  115. #define ifr__name b.ifr_ifrn.ifrn_name
  116. #define stats_ptr b.ifr_ifru.ifru_data
  117. #endif
  118. /*
  119. * Ioctl definitions.
  120. */
  121. #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
  122. #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
  123. #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
  124. #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
  125. #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
  126. #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
  127. #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
  128. #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
  129. #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
  130. #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
  131. #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
  132. #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
  133. #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
  134. #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
  135. #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
  136. #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
  137. #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
  138. #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
  139. #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
  140. #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
  141. #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
  142. #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
  143. #if !defined(ifr_mtu)
  144. #define ifr_mtu ifr_ifru.ifru_metric
  145. #endif
  146. __END_DECLS
  147. #endif /* net/if_ppp.h */