ppp_fsm.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #ifndef _NETINET_PPP_FSM_H_
  2. #define _NETINET_PPP_FSM_H_
  3. /*
  4. * Copyright (C) 2001-2004 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. * Portions are
  36. * Copyright (C) 2002 by Call Direct Cellular Solutions Pty. Ltd. All rights reserved.
  37. *
  38. * Redistribution and use in source and binary forms, with or without
  39. * modification, are permitted provided that the following conditions
  40. * are met:
  41. *
  42. * 1. Redistributions of source code must retain the above copyright
  43. * notice, this list of conditions and the following disclaimer.
  44. * 2. Redistributions in binary form must reproduce the above copyright
  45. * notice, this list of conditions and the following disclaimer in the
  46. * documentation and/or other materials provided with the distribution.
  47. * 3. All advertising materials mentioning features or use of this
  48. * software must display the following acknowledgement:
  49. *
  50. * This product includes software developed by Call Direct Cellular Solutions Pty. Ltd
  51. * and its contributors.
  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. * Portions are
  69. * Copyright (c) 1989 by Carnegie Mellon University.
  70. * All rights reserved.
  71. *
  72. * Redistribution and use in source and binary forms are permitted
  73. * provided that the above copyright notice and this paragraph are
  74. * duplicated in all such forms and that any documentation,
  75. * advertising materials, and other materials related to such
  76. * distribution and use acknowledge that the software was developed
  77. * by Carnegie Mellon University. The name of the
  78. * University may not be used to endorse or promote products derived
  79. * from this software without specific prior written permission.
  80. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  81. * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  82. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  83. */
  84. /*
  85. * $Log$
  86. * Revision 1.4 2008/08/11 07:00:23 haraldkipp
  87. * BSD types replaced by stdint types (feature request #1282721).
  88. *
  89. * Revision 1.3 2008/04/01 10:14:04 haraldkipp
  90. * Bug #1902993 fixed. XCPOPT must be declared packed to work on 32-bit
  91. * targets.
  92. *
  93. * Revision 1.2 2004/03/08 11:19:55 haraldkipp
  94. * HDLC functions moved to async HDLC driver.
  95. *
  96. * Revision 1.1.1.1 2003/05/09 14:41:16 haraldkipp
  97. * Initial using 3.2.1
  98. *
  99. * Revision 1.2 2003/05/06 18:46:46 harald
  100. * Cleanup
  101. *
  102. * Revision 1.1 2003/03/31 14:57:20 harald
  103. * *** empty log message ***
  104. *
  105. */
  106. #include <stdint.h>
  107. /*!
  108. * \file netinet/ppp_fsm.h
  109. * \brief PPP state machine definitions.
  110. */
  111. /*
  112. * Link states.
  113. */
  114. #define PPPS_INITIAL 0 /*!< \brief Down, hasn't been opened */
  115. #define PPPS_STARTING 1 /*!< \brief Down, been opened */
  116. #define PPPS_CLOSED 2 /*!< \brief Up, hasn't been opened */
  117. #define PPPS_STOPPED 3 /*!< \brief Open, waiting for down event */
  118. #define PPPS_CLOSING 4 /*!< \brief Terminating the connection, not open */
  119. #define PPPS_STOPPING 5 /*!< \brief Peer is going down */
  120. #define PPPS_REQSENT 6 /*!< \brief We've sent a Config Request */
  121. #define PPPS_ACKRCVD 7 /*!< \brief We've received a Config Ack */
  122. #define PPPS_ACKSENT 8 /*!< \brief We've sent a Config Ack */
  123. #define PPPS_OPENED 9 /*!< \brief Connection available */
  124. #define XCP_CONFREQ 1 /*!< \brief LCP/IPCP Configure-Request Code */
  125. #define XCP_CONFACK 2 /*!< \brief LCP/IPCP Configure-Ack Code */
  126. #define XCP_CONFNAK 3 /*!< \brief LCP/IPCP Configure-Nack Code */
  127. #define XCP_CONFREJ 4 /*!< \brief LCP/IPCP Configure-Reject Code */
  128. #define XCP_TERMREQ 5 /*!< \brief LCP/IPCP Terminate-Request Code */
  129. #define XCP_TERMACK 6 /*!< \brief LCP/IPCP Terminate-Ack Code */
  130. #define XCP_CODEREJ 7 /*!< \brief LCP/IPCP Code-Reject Code */
  131. #define LCP_PROTREJ 8 /*!< \brief LCP Protocol-Reject Code */
  132. #define LCP_ERQ 9 /*!< \brief LCP Echo-Request Code */
  133. #define LCP_ERP 10 /*!< \brief LCP Echo-Response Code */
  134. #define LCP_DRQ 11 /*!< \brief LCP Discard-Request Code */
  135. /*
  136. * PAP client states.
  137. */
  138. #define PAPCS_INITIAL 0 /*!< \brief Connection down */
  139. #define PAPCS_CLOSED 1 /*!< \brief Connection up, haven't requested auth */
  140. #define PAPCS_PENDING 2 /*!< \brief Connection down, have requested auth */
  141. #define PAPCS_AUTHREQ 3 /*!< \brief We've sent an Authenticate-Request */
  142. #define PAPCS_OPEN 4 /*!< \brief We've received an Ack */
  143. #define PAPCS_BADAUTH 5 /*!< \brief We've received a Nak */
  144. typedef struct NUT_PACKED_TYPE {
  145. uint8_t xcpo_type;
  146. uint8_t xcpo_len;
  147. union {
  148. uint16_t us;
  149. uint32_t ul;
  150. uint8_t uc[1];
  151. } xcpo_;
  152. } XCPOPT;
  153. extern void LcpOpen(NUTDEVICE * dev);
  154. extern void LcpClose(NUTDEVICE *dev);
  155. extern void LcpLowerUp(NUTDEVICE *dev);
  156. extern void LcpLowerDown(NUTDEVICE *dev);
  157. extern void PapLowerUp(NUTDEVICE *dev);
  158. extern void PapLowerDown(NUTDEVICE *dev);
  159. extern void IpcpOpen(NUTDEVICE * dev);
  160. extern void IpcpClose(NUTDEVICE * dev);
  161. extern void IpcpLowerUp(NUTDEVICE *dev);
  162. extern void IpcpLowerDown(NUTDEVICE *dev);
  163. extern void PppOpen(NUTDEVICE *dev);
  164. extern void PppClose(NUTDEVICE *dev);
  165. extern int NutPppInitStateMachine(NUTDEVICE * dev);
  166. #endif