save loops

Dependencies:   mbed

Committer:
mbedalvaro
Date:
Tue Dec 02 04:39:15 2014 +0000
Revision:
0:df6fdd9b99f0
this new version of skinGames will have a function that stops scanning as the laser reaches the same position (i.e., loops) with a certain precision. It is for extracting contours for Takashita project. It can then save on a file or send on osc

Who changed what in which revision?

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