code that uses Watchdog to reset Mbed every 30seconds. After 30-60mins, the ethernet interface fails to setup() after WatchDog reset.

Dependencies:   mbed

Committer:
eqon
Date:
Thu Jun 07 05:44:29 2012 +0000
Revision:
0:0ce833f21e63

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
eqon 0:0ce833f21e63 1 /*****************************************************************************
eqon 0:0ce833f21e63 2 * lcp.h - Network Link Control 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-11-05 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 * lcp.h - Link Control 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 * $Id: lcp.h,v 1.4 2010/01/18 20:49:43 goldsimon Exp $
eqon 0:0ce833f21e63 52 */
eqon 0:0ce833f21e63 53
eqon 0:0ce833f21e63 54 #ifndef LCP_H
eqon 0:0ce833f21e63 55 #define LCP_H
eqon 0:0ce833f21e63 56 /*
eqon 0:0ce833f21e63 57 * Options.
eqon 0:0ce833f21e63 58 */
eqon 0:0ce833f21e63 59 #define CI_MRU 1 /* Maximum Receive Unit */
eqon 0:0ce833f21e63 60 #define CI_ASYNCMAP 2 /* Async Control Character Map */
eqon 0:0ce833f21e63 61 #define CI_AUTHTYPE 3 /* Authentication Type */
eqon 0:0ce833f21e63 62 #define CI_QUALITY 4 /* Quality Protocol */
eqon 0:0ce833f21e63 63 #define CI_MAGICNUMBER 5 /* Magic Number */
eqon 0:0ce833f21e63 64 #define CI_PCOMPRESSION 7 /* Protocol Field Compression */
eqon 0:0ce833f21e63 65 #define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
eqon 0:0ce833f21e63 66 #define CI_CALLBACK 13 /* callback */
eqon 0:0ce833f21e63 67 #define CI_MRRU 17 /* max reconstructed receive unit; multilink */
eqon 0:0ce833f21e63 68 #define CI_SSNHF 18 /* short sequence numbers for multilink */
eqon 0:0ce833f21e63 69 #define CI_EPDISC 19 /* endpoint discriminator */
eqon 0:0ce833f21e63 70
eqon 0:0ce833f21e63 71 /*
eqon 0:0ce833f21e63 72 * LCP-specific packet types (code numbers).
eqon 0:0ce833f21e63 73 */
eqon 0:0ce833f21e63 74 #define PROTREJ 8 /* Protocol Reject */
eqon 0:0ce833f21e63 75 #define ECHOREQ 9 /* Echo Request */
eqon 0:0ce833f21e63 76 #define ECHOREP 10 /* Echo Reply */
eqon 0:0ce833f21e63 77 #define DISCREQ 11 /* Discard Request */
eqon 0:0ce833f21e63 78 #define CBCP_OPT 6 /* Use callback control protocol */
eqon 0:0ce833f21e63 79
eqon 0:0ce833f21e63 80 /*
eqon 0:0ce833f21e63 81 * The state of options is described by an lcp_options structure.
eqon 0:0ce833f21e63 82 */
eqon 0:0ce833f21e63 83 typedef struct lcp_options {
eqon 0:0ce833f21e63 84 u_int passive : 1; /* Don't die if we don't get a response */
eqon 0:0ce833f21e63 85 u_int silent : 1; /* Wait for the other end to start first */
eqon 0:0ce833f21e63 86 u_int restart : 1; /* Restart vs. exit after close */
eqon 0:0ce833f21e63 87 u_int neg_mru : 1; /* Negotiate the MRU? */
eqon 0:0ce833f21e63 88 u_int neg_asyncmap : 1; /* Negotiate the async map? */
eqon 0:0ce833f21e63 89 u_int neg_upap : 1; /* Ask for UPAP authentication? */
eqon 0:0ce833f21e63 90 u_int neg_chap : 1; /* Ask for CHAP authentication? */
eqon 0:0ce833f21e63 91 u_int neg_magicnumber : 1; /* Ask for magic number? */
eqon 0:0ce833f21e63 92 u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */
eqon 0:0ce833f21e63 93 u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */
eqon 0:0ce833f21e63 94 u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */
eqon 0:0ce833f21e63 95 u_int neg_cbcp : 1; /* Negotiate use of CBCP */
eqon 0:0ce833f21e63 96 #ifdef PPP_MULTILINK
eqon 0:0ce833f21e63 97 u_int neg_mrru : 1; /* Negotiate multilink MRRU */
eqon 0:0ce833f21e63 98 u_int neg_ssnhf : 1; /* Negotiate short sequence numbers */
eqon 0:0ce833f21e63 99 u_int neg_endpoint : 1; /* Negotiate endpoint discriminator */
eqon 0:0ce833f21e63 100 #endif
eqon 0:0ce833f21e63 101 u_short mru; /* Value of MRU */
eqon 0:0ce833f21e63 102 #ifdef PPP_MULTILINK
eqon 0:0ce833f21e63 103 u_short mrru; /* Value of MRRU, and multilink enable */
eqon 0:0ce833f21e63 104 #endif
eqon 0:0ce833f21e63 105 u_char chap_mdtype; /* which MD type (hashing algorithm) */
eqon 0:0ce833f21e63 106 u32_t asyncmap; /* Value of async map */
eqon 0:0ce833f21e63 107 u32_t magicnumber;
eqon 0:0ce833f21e63 108 int numloops; /* Number of loops during magic number neg. */
eqon 0:0ce833f21e63 109 u32_t lqr_period; /* Reporting period for LQR 1/100ths second */
eqon 0:0ce833f21e63 110 #ifdef PPP_MULTILINK
eqon 0:0ce833f21e63 111 struct epdisc endpoint; /* endpoint discriminator */
eqon 0:0ce833f21e63 112 #endif
eqon 0:0ce833f21e63 113 } lcp_options;
eqon 0:0ce833f21e63 114
eqon 0:0ce833f21e63 115 /*
eqon 0:0ce833f21e63 116 * Values for phase from BSD pppd.h based on RFC 1661.
eqon 0:0ce833f21e63 117 */
eqon 0:0ce833f21e63 118 typedef enum {
eqon 0:0ce833f21e63 119 PHASE_DEAD = 0,
eqon 0:0ce833f21e63 120 PHASE_INITIALIZE,
eqon 0:0ce833f21e63 121 PHASE_ESTABLISH,
eqon 0:0ce833f21e63 122 PHASE_AUTHENTICATE,
eqon 0:0ce833f21e63 123 PHASE_CALLBACK,
eqon 0:0ce833f21e63 124 PHASE_NETWORK,
eqon 0:0ce833f21e63 125 PHASE_TERMINATE
eqon 0:0ce833f21e63 126 } LinkPhase;
eqon 0:0ce833f21e63 127
eqon 0:0ce833f21e63 128
eqon 0:0ce833f21e63 129
eqon 0:0ce833f21e63 130 extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */
eqon 0:0ce833f21e63 131 extern lcp_options lcp_wantoptions[];
eqon 0:0ce833f21e63 132 extern lcp_options lcp_gotoptions[];
eqon 0:0ce833f21e63 133 extern lcp_options lcp_allowoptions[];
eqon 0:0ce833f21e63 134 extern lcp_options lcp_hisoptions[];
eqon 0:0ce833f21e63 135 extern ext_accm xmit_accm[];
eqon 0:0ce833f21e63 136
eqon 0:0ce833f21e63 137
eqon 0:0ce833f21e63 138 void lcp_init (int);
eqon 0:0ce833f21e63 139 void lcp_open (int);
eqon 0:0ce833f21e63 140 void lcp_close (int, char *);
eqon 0:0ce833f21e63 141 void lcp_lowerup (int);
eqon 0:0ce833f21e63 142 void lcp_lowerdown(int);
eqon 0:0ce833f21e63 143 void lcp_sprotrej (int, u_char *, int); /* send protocol reject */
eqon 0:0ce833f21e63 144
eqon 0:0ce833f21e63 145 extern struct protent lcp_protent;
eqon 0:0ce833f21e63 146
eqon 0:0ce833f21e63 147 /* Default number of times we receive our magic number from the peer
eqon 0:0ce833f21e63 148 before deciding the link is looped-back. */
eqon 0:0ce833f21e63 149 #define DEFLOOPBACKFAIL 10
eqon 0:0ce833f21e63 150
eqon 0:0ce833f21e63 151 #endif /* LCP_H */