Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

Committer:
mbedalvaro
Date:
Thu Apr 17 08:04:14 2014 +0000
Revision:
47:199042980678
Parent:
31:5f039cbddee8
publishing for sharing with Ken Iwasaki

Who changed what in which revision?

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