if_ppp.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. #ifndef _NETINET_IF_PPP_H_
  2. #define _NETINET_IF_PPP_H_
  3. /*
  4. * Copyright (C) 2001-2003 by egnite Software GmbH. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  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 copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. *
  34. * -
  35. * Copyright (C) 2002 by Call Direct Cellular Solutions Pty. Ltd. All rights reserved.
  36. *
  37. * Redistribution and use in source and binary forms, with or without
  38. * modification, are permitted provided that the following conditions
  39. * are met:
  40. *
  41. * 1. Redistributions of source code must retain the above copyright
  42. * notice, this list of conditions and the following disclaimer.
  43. * 2. Redistributions in binary form must reproduce the above copyright
  44. * notice, this list of conditions and the following disclaimer in the
  45. * documentation and/or other materials provided with the distribution.
  46. * 3. Neither the name of the copyright holders nor the names of
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY CALL DIRECT CELLULAR SOLUTIONS AND CONTRIBUTORS
  51. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  53. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALL DIRECT
  54. * CELLULAR SOLUTIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  55. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  56. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  57. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  58. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  59. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  60. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  61. * SUCH DAMAGE.
  62. *
  63. * For additional information see http://www.calldirect.com.au/
  64. * -
  65. *
  66. * Portions are
  67. * Copyright (c) 1989 by Carnegie Mellon University.
  68. * All rights reserved.
  69. *
  70. * Redistribution and use in source and binary forms are permitted
  71. * provided that the above copyright notice and this paragraph are
  72. * duplicated in all such forms and that any documentation,
  73. * advertising materials, and other materials related to such
  74. * distribution and use acknowledge that the software was developed
  75. * by Carnegie Mellon University. The name of the
  76. * University may not be used to endorse or promote products derived
  77. * from this software without specific prior written permission.
  78. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  79. * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  80. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  81. */
  82. /*
  83. * $Log$
  84. * Revision 1.4 2008/08/11 07:00:22 haraldkipp
  85. * BSD types replaced by stdint types (feature request #1282721).
  86. *
  87. * Revision 1.3 2004/01/30 11:38:25 haraldkipp
  88. * Handle magic number rejects
  89. *
  90. * Revision 1.2 2003/08/14 15:05:18 haraldkipp
  91. * Caller will do ID increment
  92. *
  93. * Revision 1.1.1.1 2003/05/09 14:41:14 haraldkipp
  94. * Initial using 3.2.1
  95. *
  96. * Revision 1.2 2003/05/06 18:46:33 harald
  97. * Cleanup
  98. *
  99. * Revision 1.1 2003/03/31 14:57:20 harald
  100. * *** empty log message ***
  101. *
  102. */
  103. #include <sys/types.h>
  104. #include <net/if_var.h>
  105. /*!
  106. * \file netinet/if_ppp.h
  107. * \brief PPP interface definitions.
  108. *
  109. */
  110. #define MAX_NAK_LOOPS 10
  111. #define MIN_LCPMRU 128
  112. #define PPP_MRU 1500
  113. /*
  114. * Protocol field values.
  115. */
  116. #define PPP_IP 0x0021 /* Internet Protocol */
  117. #define PPP_AT 0x0029 /* AppleTalk Protocol */
  118. #define PPP_IPX 0x002b /* IPX protocol */
  119. #define PPP_VJC_COMP 0x002d /* VJ compressed TCP */
  120. #define PPP_VJC_UNCOMP 0x002f /* VJ uncompressed TCP */
  121. #define PPP_IPV6 0x0057 /* Internet Protocol Version 6 */
  122. #define PPP_COMP 0x00fd /* compressed packet */
  123. #define PPP_IPCP 0x8021 /* IP Control Protocol */
  124. #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
  125. #define PPP_IPXCP 0x802b /* IPX Control Protocol */
  126. #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
  127. #define PPP_CCP 0x80fd /* Compression Control Protocol */
  128. #define PPP_LCP 0xc021 /* Link Control Protocol */
  129. #define PPP_PAP 0xc023 /* Password Authentication Protocol */
  130. #define PPP_LQR 0xc025 /* Link Quality Report protocol */
  131. #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
  132. #define PPP_CBCP 0xc029 /* Callback Control Protocol */
  133. /*
  134. * LCP options.
  135. */
  136. #define LCP_MRU 1 /*!< \brief Maximum Receive Unit */
  137. #define LCP_ASYNCMAP 2 /*!< \brief Async Control Character Map */
  138. #define LCP_AUTHTYPE 3 /*!< \brief Authentication Type */
  139. #define LCP_QUALITY 4 /*!< \brief Quality Protocol */
  140. #define LCP_MAGICNUMBER 5 /*!< \brief Magic Number */
  141. #define LCP_PCOMPRESSION 7 /*!< \brief Protocol Field Compression */
  142. #define LCP_ACCOMPRESSION 8 /*!< \brief Address/Control Field Compression */
  143. /*
  144. * IPCP Options.
  145. */
  146. #define IPCP_ADDRS 1 /* IP Addresses */
  147. #define IPCP_COMPRESSTYPE 2 /* Compression Type */
  148. #define IPCP_ADDR 3 /* IP Address */
  149. #define IPCP_MS_DNS1 129 /* Primary DNS value */
  150. #define IPCP_MS_WINS1 130 /* Primary WINS value */
  151. #define IPCP_MS_DNS2 131 /* Secondary DNS value */
  152. #define IPCP_MS_WINS2 132 /* Secondary WINS value */
  153. /*!
  154. * \typedef PPPHDR
  155. * \brief PPP header type.
  156. */
  157. typedef struct ppp_header {
  158. uint8_t address; /*!< \brief HDLC Address. */
  159. uint8_t control; /*!< \brief HDLC Control. */
  160. uint16_t prot_type; /*!< \brief Protocol type. */
  161. } PPPHDR;
  162. typedef struct xcphdr {
  163. /*!< \brief Code.
  164. */
  165. uint8_t xch_code;
  166. /*!< \brief Identifier
  167. */
  168. uint8_t xch_id;
  169. /*!< \brief Length
  170. */
  171. uint16_t xch_len;
  172. } XCPHDR;
  173. extern void NutLcpInput(NUTDEVICE * dev, NETBUF * nb);
  174. extern int NutLcpOutput(NUTDEVICE * dev, uint8_t code, uint8_t id, NETBUF * nb);
  175. extern void LcpTxConfReq(NUTDEVICE *dev, uint8_t id, uint8_t rejected);
  176. extern void LcpTxProtRej(NUTDEVICE *dev, uint16_t protocol, NETBUF *nb);
  177. extern void NutPapInput(NUTDEVICE * dev, NETBUF * nb);
  178. extern int NutPapOutput(NUTDEVICE * dev, uint8_t code, uint8_t id, NETBUF * nb);
  179. extern void PapTxAuthReq(NUTDEVICE *dev, uint8_t id);
  180. extern void NutIpcpInput(NUTDEVICE * dev, NETBUF * nb);
  181. extern int NutIpcpOutput(NUTDEVICE * dev, uint8_t code, uint8_t id, NETBUF * nb);
  182. extern void IpcpTxConfReq(NUTDEVICE *dev, uint8_t id);
  183. #endif