ppp.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. #ifndef _DEV_PPP_H_
  2. #define _DEV_PPP_H_
  3. /*
  4. * <MFS> Modified for Streamit
  5. * use PPP-stack from 3.9.6
  6. *
  7. * Copyright (C) 2001-2003 by egnite Software GmbH. 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. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * 3. Neither the name of the copyright holders nor the names of
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
  23. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  25. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
  26. * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  27. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  28. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  29. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  30. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  31. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  32. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33. * SUCH DAMAGE.
  34. *
  35. * For additional information see http://www.ethernut.de/
  36. * -
  37. *
  38. * Copyright (C) 2002 by Call Direct Cellular Solutions Pty. Ltd. All rights reserved.
  39. *
  40. * Redistribution and use in source and binary forms, with or without
  41. * modification, are permitted provided that the following conditions
  42. * are met:
  43. *
  44. * 1. Redistributions of source code must retain the above copyright
  45. * notice, this list of conditions and the following disclaimer.
  46. * 2. Redistributions in binary form must reproduce the above copyright
  47. * notice, this list of conditions and the following disclaimer in the
  48. * documentation and/or other materials provided with the distribution.
  49. * 3. Neither the name of the copyright holders nor the names of
  50. * contributors may be used to endorse or promote products derived
  51. * from this software without specific prior written permission.
  52. *
  53. * THIS SOFTWARE IS PROVIDED BY CALL DIRECT CELLULAR SOLUTIONS AND CONTRIBUTORS
  54. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  55. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  56. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALL DIRECT
  57. * CELLULAR SOLUTIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  58. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  59. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  60. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  61. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  62. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  63. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  64. * SUCH DAMAGE.
  65. *
  66. * For additional information see http://www.calldirect.com.au/
  67. */
  68. /*
  69. * $Log: ppp.h,v $
  70. * Revision 1.3 2003/08/14 15:05:55 haraldkipp
  71. * Distinguish negotiated and final magic
  72. *
  73. * Revision 1.2 2003/07/24 16:13:58 haraldkipp
  74. * Never request a rejected DNS
  75. *
  76. * Revision 1.1.1.1 2003/05/09 14:41:08 haraldkipp
  77. * Initial using 3.2.1
  78. *
  79. * Revision 1.2 2003/05/06 18:43:30 harald
  80. * Cleanup
  81. *
  82. * Revision 1.1 2003/03/31 14:53:23 harald
  83. * Prepare release 3.1
  84. *
  85. */
  86. #include <sys/device.h>
  87. #include <dev/netbuf.h>
  88. /*!
  89. * \file dev/ppp.h
  90. * \brief PPP device definitions.
  91. */
  92. /*
  93. * Reject flags. Not completed, more will follow.
  94. */
  95. #define REJ_IPCP_DNS1 0x00000100
  96. #define REJ_IPCP_DNS2 0x00000200
  97. #ifdef __cplusplus
  98. extern "C" {
  99. #endif
  100. /*!
  101. * \addtogroup xgPPP
  102. */
  103. /*@{*/
  104. #define PPP_PFC 0x01
  105. #define PPP_ACFC 0x02
  106. #define LCP_DEFOPT_ASYNCMAP 0x000A0000UL
  107. /*!
  108. * \brief PPP interface type.
  109. */
  110. typedef struct _PPPDCB PPPDCB;
  111. /*!
  112. * \struct _PPPDCB ppp.h dev/ppp.h
  113. * \brief PPP interface structure.
  114. *
  115. * Contains information about the PPP device.
  116. */
  117. struct _PPPDCB {
  118. /*! \brief PPP State event queue.
  119. * The state machine posts an event to this queue when the
  120. * network interface becomes ready.
  121. */
  122. HANDLE dcb_state_chg;
  123. /*! \brief Current state of the link layer.
  124. */
  125. u_char dcb_lcp_state;
  126. /*! \brief ID of our last request.
  127. */
  128. u_char dcb_reqid;
  129. /*! \brief ID of our last reject.
  130. */
  131. u_char dcb_rejid;
  132. /*! \brief Flag to remember ack received.
  133. */
  134. u_char dcb_acked;
  135. /*! \brief Maximum local receive unit.
  136. */
  137. u_short dcb_loc_mru;
  138. /*! \brief Maximum remote receive unit.
  139. */
  140. u_short dcb_rem_mru;
  141. /*! \brief Asynch control character map.
  142. * TODO: Pass to ahdlc driver.
  143. */
  144. u_long dcb_accm;
  145. /*! \brief Compression flags.
  146. * TODO: Pass to ahdlc driver. dcb_useACFC dcb_usePFC
  147. */
  148. u_char dcb_compr;
  149. /*! \brief Authentication type.
  150. */
  151. u_short dcb_auth;
  152. /*! \brief Magic number to negotiate.
  153. */
  154. u_long dcb_neg_magic;
  155. /*! \brief Local magic number.
  156. * Used to detect loopback conditions.
  157. */
  158. u_long dcb_loc_magic;
  159. /*! \brief Remote magic number.
  160. * Used to detect loopback conditions.
  161. */
  162. u_long dcb_rem_magic;
  163. /*! \brief User authentication.
  164. */
  165. u_char *dcb_user;
  166. /*! \brief Password authentication.
  167. */
  168. u_char *dcb_pass;
  169. /*! \brief Local IP address.
  170. */
  171. u_long dcb_local_ip;
  172. /*! \brief Remote IP address.
  173. */
  174. u_long dcb_remote_ip;
  175. /*! \brief Negotiated IP mask.
  176. */
  177. u_long dcb_ip_mask;
  178. /*! \brief Negotiated primary DNS.
  179. */
  180. u_long dcb_ip_dns1;
  181. /*! \brief Negotiated secondary DNS.
  182. */
  183. u_long dcb_ip_dns2;
  184. /*! \brief Rejected items.
  185. */
  186. u_long dcb_rejects;
  187. /*! \brief LCP/IPCP retransmit counter.
  188. */
  189. u_char dcb_retries;
  190. /*! \brief LCP NAK counter, avoids endless loops.
  191. */
  192. u_char dcb_lcp_naks;
  193. /*! \brief Identifier of our last LCP request.
  194. */
  195. u_char dcb_lcp_reqid;
  196. /*! \brief Current state of the network layer.
  197. */
  198. u_char dcb_ipcp_state;
  199. /*! \brief LCP NAK counter, avoids endless loops.
  200. */
  201. u_char dcb_ipcp_naks;
  202. /*! \brief Current authentication state.
  203. */
  204. u_char dcb_auth_state;
  205. /*! \brief File descriptor of physical device.
  206. */
  207. int dcb_fd;
  208. };
  209. /*
  210. * Available devices.
  211. */
  212. extern NUTDEVICE devPpp;
  213. #define LCP_OPEN 1
  214. #define LCP_CLOSE 2
  215. #define LCP_LOWERUP 3
  216. #define LCP_LOWERDOWN 4
  217. extern int NutPppInit(NUTDEVICE *dev);
  218. extern int NutPppIOCtl(NUTDEVICE * dev, int req, void *conf);
  219. extern NUTFILE *NutPppOpen(NUTDEVICE * dev, CONST char *name, int mode, int acc);
  220. extern int NutPppClose(NUTFILE *fp);
  221. extern int PPPPutPacket(NUTDEVICE * dev, NETBUF * nb);
  222. #ifdef __cplusplus
  223. }
  224. #endif
  225. #endif