Version of http://mbed.org/cookbook/NetServicesTribute with setting set the same for LPC2368
Dependents: UDPSocketExample 24LCxx_I2CApp WeatherPlatform_pachube HvZServerLib ... more
lwip/netif/ppp/chap.h@0:350011bf8be7, 2010-11-23 (annotated)
- Committer:
- simon
- Date:
- Tue Nov 23 14:15:36 2010 +0000
- Revision:
- 0:350011bf8be7
Experimental version for testing UDP
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 0:350011bf8be7 | 1 | /***************************************************************************** |
simon | 0:350011bf8be7 | 2 | * chap.h - Network Challenge Handshake Authentication Protocol header file. |
simon | 0:350011bf8be7 | 3 | * |
simon | 0:350011bf8be7 | 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. |
simon | 0:350011bf8be7 | 5 | * portions Copyright (c) 1998 Global Election Systems Inc. |
simon | 0:350011bf8be7 | 6 | * |
simon | 0:350011bf8be7 | 7 | * The authors hereby grant permission to use, copy, modify, distribute, |
simon | 0:350011bf8be7 | 8 | * and license this software and its documentation for any purpose, provided |
simon | 0:350011bf8be7 | 9 | * that existing copyright notices are retained in all copies and that this |
simon | 0:350011bf8be7 | 10 | * notice and the following disclaimer are included verbatim in any |
simon | 0:350011bf8be7 | 11 | * distributions. No written agreement, license, or royalty fee is required |
simon | 0:350011bf8be7 | 12 | * for any of the authorized uses. |
simon | 0:350011bf8be7 | 13 | * |
simon | 0:350011bf8be7 | 14 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR |
simon | 0:350011bf8be7 | 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
simon | 0:350011bf8be7 | 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
simon | 0:350011bf8be7 | 17 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
simon | 0:350011bf8be7 | 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
simon | 0:350011bf8be7 | 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
simon | 0:350011bf8be7 | 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
simon | 0:350011bf8be7 | 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
simon | 0:350011bf8be7 | 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
simon | 0:350011bf8be7 | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
simon | 0:350011bf8be7 | 24 | * |
simon | 0:350011bf8be7 | 25 | ****************************************************************************** |
simon | 0:350011bf8be7 | 26 | * REVISION HISTORY |
simon | 0:350011bf8be7 | 27 | * |
simon | 0:350011bf8be7 | 28 | * 03-01-01 Marc Boucher <marc@mbsi.ca> |
simon | 0:350011bf8be7 | 29 | * Ported to lwIP. |
simon | 0:350011bf8be7 | 30 | * 97-12-03 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc. |
simon | 0:350011bf8be7 | 31 | * Original built from BSD network code. |
simon | 0:350011bf8be7 | 32 | ******************************************************************************/ |
simon | 0:350011bf8be7 | 33 | /* |
simon | 0:350011bf8be7 | 34 | * chap.h - Challenge Handshake Authentication Protocol definitions. |
simon | 0:350011bf8be7 | 35 | * |
simon | 0:350011bf8be7 | 36 | * Copyright (c) 1993 The Australian National University. |
simon | 0:350011bf8be7 | 37 | * All rights reserved. |
simon | 0:350011bf8be7 | 38 | * |
simon | 0:350011bf8be7 | 39 | * Redistribution and use in source and binary forms are permitted |
simon | 0:350011bf8be7 | 40 | * provided that the above copyright notice and this paragraph are |
simon | 0:350011bf8be7 | 41 | * duplicated in all such forms and that any documentation, |
simon | 0:350011bf8be7 | 42 | * advertising materials, and other materials related to such |
simon | 0:350011bf8be7 | 43 | * distribution and use acknowledge that the software was developed |
simon | 0:350011bf8be7 | 44 | * by the Australian National University. The name of the University |
simon | 0:350011bf8be7 | 45 | * may not be used to endorse or promote products derived from this |
simon | 0:350011bf8be7 | 46 | * software without specific prior written permission. |
simon | 0:350011bf8be7 | 47 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
simon | 0:350011bf8be7 | 48 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
simon | 0:350011bf8be7 | 49 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
simon | 0:350011bf8be7 | 50 | * |
simon | 0:350011bf8be7 | 51 | * Copyright (c) 1991 Gregory M. Christy |
simon | 0:350011bf8be7 | 52 | * All rights reserved. |
simon | 0:350011bf8be7 | 53 | * |
simon | 0:350011bf8be7 | 54 | * Redistribution and use in source and binary forms are permitted |
simon | 0:350011bf8be7 | 55 | * provided that the above copyright notice and this paragraph are |
simon | 0:350011bf8be7 | 56 | * duplicated in all such forms and that any documentation, |
simon | 0:350011bf8be7 | 57 | * advertising materials, and other materials related to such |
simon | 0:350011bf8be7 | 58 | * distribution and use acknowledge that the software was developed |
simon | 0:350011bf8be7 | 59 | * by the author. |
simon | 0:350011bf8be7 | 60 | * |
simon | 0:350011bf8be7 | 61 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
simon | 0:350011bf8be7 | 62 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
simon | 0:350011bf8be7 | 63 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
simon | 0:350011bf8be7 | 64 | * |
simon | 0:350011bf8be7 | 65 | * $Id: chap.h,v 1.6 2010/01/24 13:19:34 goldsimon Exp $ |
simon | 0:350011bf8be7 | 66 | */ |
simon | 0:350011bf8be7 | 67 | |
simon | 0:350011bf8be7 | 68 | #ifndef CHAP_H |
simon | 0:350011bf8be7 | 69 | #define CHAP_H |
simon | 0:350011bf8be7 | 70 | |
simon | 0:350011bf8be7 | 71 | /* Code + ID + length */ |
simon | 0:350011bf8be7 | 72 | #define CHAP_HEADERLEN 4 |
simon | 0:350011bf8be7 | 73 | |
simon | 0:350011bf8be7 | 74 | /* |
simon | 0:350011bf8be7 | 75 | * CHAP codes. |
simon | 0:350011bf8be7 | 76 | */ |
simon | 0:350011bf8be7 | 77 | |
simon | 0:350011bf8be7 | 78 | #define CHAP_DIGEST_MD5 5 /* use MD5 algorithm */ |
simon | 0:350011bf8be7 | 79 | #define MD5_SIGNATURE_SIZE 16 /* 16 bytes in a MD5 message digest */ |
simon | 0:350011bf8be7 | 80 | #define CHAP_MICROSOFT 0x80 /* use Microsoft-compatible alg. */ |
simon | 0:350011bf8be7 | 81 | #define MS_CHAP_RESPONSE_LEN 49 /* Response length for MS-CHAP */ |
simon | 0:350011bf8be7 | 82 | |
simon | 0:350011bf8be7 | 83 | #define CHAP_CHALLENGE 1 |
simon | 0:350011bf8be7 | 84 | #define CHAP_RESPONSE 2 |
simon | 0:350011bf8be7 | 85 | #define CHAP_SUCCESS 3 |
simon | 0:350011bf8be7 | 86 | #define CHAP_FAILURE 4 |
simon | 0:350011bf8be7 | 87 | |
simon | 0:350011bf8be7 | 88 | /* |
simon | 0:350011bf8be7 | 89 | * Challenge lengths (for challenges we send) and other limits. |
simon | 0:350011bf8be7 | 90 | */ |
simon | 0:350011bf8be7 | 91 | #define MIN_CHALLENGE_LENGTH 32 |
simon | 0:350011bf8be7 | 92 | #define MAX_CHALLENGE_LENGTH 64 |
simon | 0:350011bf8be7 | 93 | #define MAX_RESPONSE_LENGTH 64 /* sufficient for MD5 or MS-CHAP */ |
simon | 0:350011bf8be7 | 94 | |
simon | 0:350011bf8be7 | 95 | /* |
simon | 0:350011bf8be7 | 96 | * Each interface is described by a chap structure. |
simon | 0:350011bf8be7 | 97 | */ |
simon | 0:350011bf8be7 | 98 | |
simon | 0:350011bf8be7 | 99 | typedef struct chap_state { |
simon | 0:350011bf8be7 | 100 | int unit; /* Interface unit number */ |
simon | 0:350011bf8be7 | 101 | int clientstate; /* Client state */ |
simon | 0:350011bf8be7 | 102 | int serverstate; /* Server state */ |
simon | 0:350011bf8be7 | 103 | u_char challenge[MAX_CHALLENGE_LENGTH]; /* last challenge string sent */ |
simon | 0:350011bf8be7 | 104 | u_char chal_len; /* challenge length */ |
simon | 0:350011bf8be7 | 105 | u_char chal_id; /* ID of last challenge */ |
simon | 0:350011bf8be7 | 106 | u_char chal_type; /* hash algorithm for challenges */ |
simon | 0:350011bf8be7 | 107 | u_char id; /* Current id */ |
simon | 0:350011bf8be7 | 108 | char *chal_name; /* Our name to use with challenge */ |
simon | 0:350011bf8be7 | 109 | int chal_interval; /* Time until we challenge peer again */ |
simon | 0:350011bf8be7 | 110 | int timeouttime; /* Timeout time in seconds */ |
simon | 0:350011bf8be7 | 111 | int max_transmits; /* Maximum # of challenge transmissions */ |
simon | 0:350011bf8be7 | 112 | int chal_transmits; /* Number of transmissions of challenge */ |
simon | 0:350011bf8be7 | 113 | int resp_transmits; /* Number of transmissions of response */ |
simon | 0:350011bf8be7 | 114 | u_char response[MAX_RESPONSE_LENGTH]; /* Response to send */ |
simon | 0:350011bf8be7 | 115 | u_char resp_length; /* length of response */ |
simon | 0:350011bf8be7 | 116 | u_char resp_id; /* ID for response messages */ |
simon | 0:350011bf8be7 | 117 | u_char resp_type; /* hash algorithm for responses */ |
simon | 0:350011bf8be7 | 118 | char *resp_name; /* Our name to send with response */ |
simon | 0:350011bf8be7 | 119 | } chap_state; |
simon | 0:350011bf8be7 | 120 | |
simon | 0:350011bf8be7 | 121 | |
simon | 0:350011bf8be7 | 122 | /* |
simon | 0:350011bf8be7 | 123 | * Client (peer) states. |
simon | 0:350011bf8be7 | 124 | */ |
simon | 0:350011bf8be7 | 125 | #define CHAPCS_INITIAL 0 /* Lower layer down, not opened */ |
simon | 0:350011bf8be7 | 126 | #define CHAPCS_CLOSED 1 /* Lower layer up, not opened */ |
simon | 0:350011bf8be7 | 127 | #define CHAPCS_PENDING 2 /* Auth us to peer when lower up */ |
simon | 0:350011bf8be7 | 128 | #define CHAPCS_LISTEN 3 /* Listening for a challenge */ |
simon | 0:350011bf8be7 | 129 | #define CHAPCS_RESPONSE 4 /* Sent response, waiting for status */ |
simon | 0:350011bf8be7 | 130 | #define CHAPCS_OPEN 5 /* We've received Success */ |
simon | 0:350011bf8be7 | 131 | |
simon | 0:350011bf8be7 | 132 | /* |
simon | 0:350011bf8be7 | 133 | * Server (authenticator) states. |
simon | 0:350011bf8be7 | 134 | */ |
simon | 0:350011bf8be7 | 135 | #define CHAPSS_INITIAL 0 /* Lower layer down, not opened */ |
simon | 0:350011bf8be7 | 136 | #define CHAPSS_CLOSED 1 /* Lower layer up, not opened */ |
simon | 0:350011bf8be7 | 137 | #define CHAPSS_PENDING 2 /* Auth peer when lower up */ |
simon | 0:350011bf8be7 | 138 | #define CHAPSS_INITIAL_CHAL 3 /* We've sent the first challenge */ |
simon | 0:350011bf8be7 | 139 | #define CHAPSS_OPEN 4 /* We've sent a Success msg */ |
simon | 0:350011bf8be7 | 140 | #define CHAPSS_RECHALLENGE 5 /* We've sent another challenge */ |
simon | 0:350011bf8be7 | 141 | #define CHAPSS_BADAUTH 6 /* We've sent a Failure msg */ |
simon | 0:350011bf8be7 | 142 | |
simon | 0:350011bf8be7 | 143 | extern chap_state chap[]; |
simon | 0:350011bf8be7 | 144 | |
simon | 0:350011bf8be7 | 145 | void ChapAuthWithPeer (int, char *, u_char); |
simon | 0:350011bf8be7 | 146 | void ChapAuthPeer (int, char *, u_char); |
simon | 0:350011bf8be7 | 147 | |
simon | 0:350011bf8be7 | 148 | extern struct protent chap_protent; |
simon | 0:350011bf8be7 | 149 | |
simon | 0:350011bf8be7 | 150 | #endif /* CHAP_H */ |