ソースの整理中ですが、利用はできます。 大きなファイルはできないかもしれません。

Dependencies:   EthernetInterface HttpServer TextLCD expatlib mbed-rpc mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Fork of giken9_HTMLServer_Sample by Yasushi TAUCHI

Committer:
yueee_yt
Date:
Wed Mar 12 04:19:54 2014 +0000
Revision:
0:7766f6712673
???????????????

Who changed what in which revision?

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