ppp_fsm.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. #ifndef _NETINET_PPP_FSM_H_
  2. #define _NETINET_PPP_FSM_H_
  3. /*
  4. * <MFS> Modified for Streamit
  5. * use PPP-stack from 3.9.6
  6. *
  7. * Copyright (C) 2001-2004 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. * Portions are
  39. * Copyright (C) 2002 by Call Direct Cellular Solutions Pty. Ltd. All rights reserved.
  40. *
  41. * Redistribution and use in source and binary forms, with or without
  42. * modification, are permitted provided that the following conditions
  43. * are met:
  44. *
  45. * 1. Redistributions of source code must retain the above copyright
  46. * notice, this list of conditions and the following disclaimer.
  47. * 2. Redistributions in binary form must reproduce the above copyright
  48. * notice, this list of conditions and the following disclaimer in the
  49. * documentation and/or other materials provided with the distribution.
  50. * 3. All advertising materials mentioning features or use of this
  51. * software must display the following acknowledgement:
  52. *
  53. * This product includes software developed by Call Direct Cellular Solutions Pty. Ltd
  54. * and its contributors.
  55. *
  56. * THIS SOFTWARE IS PROVIDED BY CALL DIRECT CELLULAR SOLUTIONS AND CONTRIBUTORS
  57. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  58. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  59. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALL DIRECT
  60. * CELLULAR SOLUTIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  61. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  62. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  63. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  64. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  65. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  66. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  67. * SUCH DAMAGE.
  68. *
  69. * For additional information see http://www.calldirect.com.au/
  70. * -
  71. * Portions are
  72. * Copyright (c) 1989 by Carnegie Mellon University.
  73. * All rights reserved.
  74. *
  75. * Redistribution and use in source and binary forms are permitted
  76. * provided that the above copyright notice and this paragraph are
  77. * duplicated in all such forms and that any documentation,
  78. * advertising materials, and other materials related to such
  79. * distribution and use acknowledge that the software was developed
  80. * by Carnegie Mellon University. The name of the
  81. * University may not be used to endorse or promote products derived
  82. * from this software without specific prior written permission.
  83. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  84. * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  85. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  86. */
  87. /*
  88. * $Log: ppp_fsm.h,v $
  89. * Revision 1.2 2004/03/08 11:19:55 haraldkipp
  90. * HDLC functions moved to async HDLC driver.
  91. *
  92. * Revision 1.1.1.1 2003/05/09 14:41:16 haraldkipp
  93. * Initial using 3.2.1
  94. *
  95. * Revision 1.2 2003/05/06 18:46:46 harald
  96. * Cleanup
  97. *
  98. * Revision 1.1 2003/03/31 14:57:20 harald
  99. * *** empty log message ***
  100. *
  101. */
  102. /*!
  103. * \file netinet/ppp_fsm.h
  104. * \brief PPP state machine definitions.
  105. */
  106. /*
  107. * Link states.
  108. */
  109. #define PPPS_INITIAL 0 /*!< \brief Down, hasn't been opened */
  110. #define PPPS_STARTING 1 /*!< \brief Down, been opened */
  111. #define PPPS_CLOSED 2 /*!< \brief Up, hasn't been opened */
  112. #define PPPS_STOPPED 3 /*!< \brief Open, waiting for down event */
  113. #define PPPS_CLOSING 4 /*!< \brief Terminating the connection, not open */
  114. #define PPPS_STOPPING 5 /*!< \brief Peer is going down */
  115. #define PPPS_REQSENT 6 /*!< \brief We've sent a Config Request */
  116. #define PPPS_ACKRCVD 7 /*!< \brief We've received a Config Ack */
  117. #define PPPS_ACKSENT 8 /*!< \brief We've sent a Config Ack */
  118. #define PPPS_OPENED 9 /*!< \brief Connection available */
  119. #define XCP_CONFREQ 1 /*!< \brief LCP/IPCP Configure-Request Code */
  120. #define XCP_CONFACK 2 /*!< \brief LCP/IPCP Configure-Ack Code */
  121. #define XCP_CONFNAK 3 /*!< \brief LCP/IPCP Configure-Nack Code */
  122. #define XCP_CONFREJ 4 /*!< \brief LCP/IPCP Configure-Reject Code */
  123. #define XCP_TERMREQ 5 /*!< \brief LCP/IPCP Terminate-Request Code */
  124. #define XCP_TERMACK 6 /*!< \brief LCP/IPCP Terminate-Ack Code */
  125. #define XCP_CODEREJ 7 /*!< \brief LCP/IPCP Code-Reject Code */
  126. #define LCP_PROTREJ 8 /*!< \brief LCP Protocol-Reject Code */
  127. #define LCP_ERQ 9 /*!< \brief LCP Echo-Request Code */
  128. #define LCP_ERP 10 /*!< \brief LCP Echo-Response Code */
  129. #define LCP_DRQ 11 /*!< \brief LCP Discard-Request Code */
  130. #define CHAP_CHALLENGE 1
  131. #define CHAP_RESPONSE 2
  132. #define CHAP_SUCCESS 3
  133. #define CHAP_FAILURE 4
  134. /*
  135. * PAP client states.
  136. */
  137. #define PAPCS_INITIAL 0 /*!< \brief Connection down */
  138. #define PAPCS_CLOSED 1 /*!< \brief Connection up, haven't requested auth */
  139. #define PAPCS_PENDING 2 /*!< \brief Connection down, have requested auth */
  140. #define PAPCS_AUTHREQ 3 /*!< \brief We've sent an Authenticate-Request */
  141. #define PAPCS_OPEN 4 /*!< \brief We've received an Ack */
  142. #define PAPCS_BADAUTH 5 /*!< \brief We've received a Nak */
  143. /*
  144. * CHAP client states.
  145. */
  146. #define CHAPCS_INITIAL 6 /*!< \brief Connection down */
  147. #define CHAPCS_CLOSED 7 /*!< \brief Connection up, haven't requested auth */
  148. #define CHAPCS_PENDING 8 /*!< \brief Connection down, have requested auth */
  149. #define CHAPCS_AUTHREQ 9 /*!< \brief We've sent an Authenticate-Request */
  150. #define CHAPCS_OPEN 10 /*!< \brief We've received an Ack */
  151. #define CHAPCS_BADAUTH 11 /*!< \brief We've received a Nak */
  152. typedef struct {
  153. u_char xcpo_type;
  154. u_char xcpo_len;
  155. union {
  156. u_short us;
  157. u_long ul;
  158. u_char uc[1];
  159. } xcpo_;
  160. } XCPOPT;
  161. __BEGIN_DECLS
  162. extern void LcpOpen(NUTDEVICE * dev);
  163. extern void LcpClose(NUTDEVICE *dev);
  164. extern void LcpLowerUp(NUTDEVICE *dev);
  165. extern void LcpLowerDown(NUTDEVICE *dev);
  166. extern void PapLowerUp(NUTDEVICE *dev);
  167. extern void PapLowerDown(NUTDEVICE *dev);
  168. extern void IpcpOpen(NUTDEVICE * dev);
  169. extern void IpcpClose(NUTDEVICE * dev);
  170. extern void IpcpLowerUp(NUTDEVICE *dev);
  171. extern void IpcpLowerDown(NUTDEVICE *dev);
  172. extern void PppOpen(NUTDEVICE *dev);
  173. extern void PppClose(NUTDEVICE *dev);
  174. extern int NutPppInitStateMachine(NUTDEVICE * dev);
  175. __END_DECLS
  176. #endif