![](/media/cache/profiles/3f4243a6f681f2920ac3e95a63517274.50x50_q85.jpg)
code that uses Watchdog to reset Mbed every 30seconds. After 30-60mins, the ethernet interface fails to setup() after WatchDog reset.
EthernetNetIf/LPC1768/lwip/netif/ppp/pap.h@0:0ce833f21e63, 2012-06-07 (annotated)
- Committer:
- eqon
- Date:
- Thu Jun 07 05:44:29 2012 +0000
- Revision:
- 0:0ce833f21e63
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
eqon | 0:0ce833f21e63 | 1 | /***************************************************************************** |
eqon | 0:0ce833f21e63 | 2 | * pap.h - PPP Password Authentication Protocol header file. |
eqon | 0:0ce833f21e63 | 3 | * |
eqon | 0:0ce833f21e63 | 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. |
eqon | 0:0ce833f21e63 | 5 | * portions Copyright (c) 1997 Global Election Systems Inc. |
eqon | 0:0ce833f21e63 | 6 | * |
eqon | 0:0ce833f21e63 | 7 | * The authors hereby grant permission to use, copy, modify, distribute, |
eqon | 0:0ce833f21e63 | 8 | * and license this software and its documentation for any purpose, provided |
eqon | 0:0ce833f21e63 | 9 | * that existing copyright notices are retained in all copies and that this |
eqon | 0:0ce833f21e63 | 10 | * notice and the following disclaimer are included verbatim in any |
eqon | 0:0ce833f21e63 | 11 | * distributions. No written agreement, license, or royalty fee is required |
eqon | 0:0ce833f21e63 | 12 | * for any of the authorized uses. |
eqon | 0:0ce833f21e63 | 13 | * |
eqon | 0:0ce833f21e63 | 14 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR |
eqon | 0:0ce833f21e63 | 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
eqon | 0:0ce833f21e63 | 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
eqon | 0:0ce833f21e63 | 17 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
eqon | 0:0ce833f21e63 | 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
eqon | 0:0ce833f21e63 | 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
eqon | 0:0ce833f21e63 | 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
eqon | 0:0ce833f21e63 | 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
eqon | 0:0ce833f21e63 | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
eqon | 0:0ce833f21e63 | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
eqon | 0:0ce833f21e63 | 24 | * |
eqon | 0:0ce833f21e63 | 25 | ****************************************************************************** |
eqon | 0:0ce833f21e63 | 26 | * REVISION HISTORY |
eqon | 0:0ce833f21e63 | 27 | * |
eqon | 0:0ce833f21e63 | 28 | * 03-01-01 Marc Boucher <marc@mbsi.ca> |
eqon | 0:0ce833f21e63 | 29 | * Ported to lwIP. |
eqon | 0:0ce833f21e63 | 30 | * 97-12-04 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc. |
eqon | 0:0ce833f21e63 | 31 | * Original derived from BSD codes. |
eqon | 0:0ce833f21e63 | 32 | *****************************************************************************/ |
eqon | 0:0ce833f21e63 | 33 | /* |
eqon | 0:0ce833f21e63 | 34 | * upap.h - User/Password Authentication Protocol definitions. |
eqon | 0:0ce833f21e63 | 35 | * |
eqon | 0:0ce833f21e63 | 36 | * Copyright (c) 1989 Carnegie Mellon University. |
eqon | 0:0ce833f21e63 | 37 | * All rights reserved. |
eqon | 0:0ce833f21e63 | 38 | * |
eqon | 0:0ce833f21e63 | 39 | * Redistribution and use in source and binary forms are permitted |
eqon | 0:0ce833f21e63 | 40 | * provided that the above copyright notice and this paragraph are |
eqon | 0:0ce833f21e63 | 41 | * duplicated in all such forms and that any documentation, |
eqon | 0:0ce833f21e63 | 42 | * advertising materials, and other materials related to such |
eqon | 0:0ce833f21e63 | 43 | * distribution and use acknowledge that the software was developed |
eqon | 0:0ce833f21e63 | 44 | * by Carnegie Mellon University. The name of the |
eqon | 0:0ce833f21e63 | 45 | * University may not be used to endorse or promote products derived |
eqon | 0:0ce833f21e63 | 46 | * from this software without specific prior written permission. |
eqon | 0:0ce833f21e63 | 47 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
eqon | 0:0ce833f21e63 | 48 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
eqon | 0:0ce833f21e63 | 49 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
eqon | 0:0ce833f21e63 | 50 | */ |
eqon | 0:0ce833f21e63 | 51 | |
eqon | 0:0ce833f21e63 | 52 | #ifndef PAP_H |
eqon | 0:0ce833f21e63 | 53 | #define PAP_H |
eqon | 0:0ce833f21e63 | 54 | |
eqon | 0:0ce833f21e63 | 55 | #if PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ |
eqon | 0:0ce833f21e63 | 56 | |
eqon | 0:0ce833f21e63 | 57 | /* |
eqon | 0:0ce833f21e63 | 58 | * Packet header = Code, id, length. |
eqon | 0:0ce833f21e63 | 59 | */ |
eqon | 0:0ce833f21e63 | 60 | #define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short)) |
eqon | 0:0ce833f21e63 | 61 | |
eqon | 0:0ce833f21e63 | 62 | |
eqon | 0:0ce833f21e63 | 63 | /* |
eqon | 0:0ce833f21e63 | 64 | * UPAP codes. |
eqon | 0:0ce833f21e63 | 65 | */ |
eqon | 0:0ce833f21e63 | 66 | #define UPAP_AUTHREQ 1 /* Authenticate-Request */ |
eqon | 0:0ce833f21e63 | 67 | #define UPAP_AUTHACK 2 /* Authenticate-Ack */ |
eqon | 0:0ce833f21e63 | 68 | #define UPAP_AUTHNAK 3 /* Authenticate-Nak */ |
eqon | 0:0ce833f21e63 | 69 | |
eqon | 0:0ce833f21e63 | 70 | /* |
eqon | 0:0ce833f21e63 | 71 | * Each interface is described by upap structure. |
eqon | 0:0ce833f21e63 | 72 | */ |
eqon | 0:0ce833f21e63 | 73 | typedef struct upap_state { |
eqon | 0:0ce833f21e63 | 74 | int us_unit; /* Interface unit number */ |
eqon | 0:0ce833f21e63 | 75 | const char *us_user; /* User */ |
eqon | 0:0ce833f21e63 | 76 | int us_userlen; /* User length */ |
eqon | 0:0ce833f21e63 | 77 | const char *us_passwd; /* Password */ |
eqon | 0:0ce833f21e63 | 78 | int us_passwdlen; /* Password length */ |
eqon | 0:0ce833f21e63 | 79 | int us_clientstate; /* Client state */ |
eqon | 0:0ce833f21e63 | 80 | int us_serverstate; /* Server state */ |
eqon | 0:0ce833f21e63 | 81 | u_char us_id; /* Current id */ |
eqon | 0:0ce833f21e63 | 82 | int us_timeouttime; /* Timeout (seconds) for auth-req retrans. */ |
eqon | 0:0ce833f21e63 | 83 | int us_transmits; /* Number of auth-reqs sent */ |
eqon | 0:0ce833f21e63 | 84 | int us_maxtransmits; /* Maximum number of auth-reqs to send */ |
eqon | 0:0ce833f21e63 | 85 | int us_reqtimeout; /* Time to wait for auth-req from peer */ |
eqon | 0:0ce833f21e63 | 86 | } upap_state; |
eqon | 0:0ce833f21e63 | 87 | |
eqon | 0:0ce833f21e63 | 88 | /* |
eqon | 0:0ce833f21e63 | 89 | * Client states. |
eqon | 0:0ce833f21e63 | 90 | */ |
eqon | 0:0ce833f21e63 | 91 | #define UPAPCS_INITIAL 0 /* Connection down */ |
eqon | 0:0ce833f21e63 | 92 | #define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */ |
eqon | 0:0ce833f21e63 | 93 | #define UPAPCS_PENDING 2 /* Connection down, have requested auth */ |
eqon | 0:0ce833f21e63 | 94 | #define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */ |
eqon | 0:0ce833f21e63 | 95 | #define UPAPCS_OPEN 4 /* We've received an Ack */ |
eqon | 0:0ce833f21e63 | 96 | #define UPAPCS_BADAUTH 5 /* We've received a Nak */ |
eqon | 0:0ce833f21e63 | 97 | |
eqon | 0:0ce833f21e63 | 98 | /* |
eqon | 0:0ce833f21e63 | 99 | * Server states. |
eqon | 0:0ce833f21e63 | 100 | */ |
eqon | 0:0ce833f21e63 | 101 | #define UPAPSS_INITIAL 0 /* Connection down */ |
eqon | 0:0ce833f21e63 | 102 | #define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */ |
eqon | 0:0ce833f21e63 | 103 | #define UPAPSS_PENDING 2 /* Connection down, have requested auth */ |
eqon | 0:0ce833f21e63 | 104 | #define UPAPSS_LISTEN 3 /* Listening for an Authenticate */ |
eqon | 0:0ce833f21e63 | 105 | #define UPAPSS_OPEN 4 /* We've sent an Ack */ |
eqon | 0:0ce833f21e63 | 106 | #define UPAPSS_BADAUTH 5 /* We've sent a Nak */ |
eqon | 0:0ce833f21e63 | 107 | |
eqon | 0:0ce833f21e63 | 108 | |
eqon | 0:0ce833f21e63 | 109 | extern upap_state upap[]; |
eqon | 0:0ce833f21e63 | 110 | |
eqon | 0:0ce833f21e63 | 111 | void upap_authwithpeer (int, char *, char *); |
eqon | 0:0ce833f21e63 | 112 | void upap_authpeer (int); |
eqon | 0:0ce833f21e63 | 113 | |
eqon | 0:0ce833f21e63 | 114 | extern struct protent pap_protent; |
eqon | 0:0ce833f21e63 | 115 | |
eqon | 0:0ce833f21e63 | 116 | #endif /* PAP_SUPPORT */ |
eqon | 0:0ce833f21e63 | 117 | |
eqon | 0:0ce833f21e63 | 118 | #endif /* PAP_H */ |