This is the firmware for the LaOS - Laser Open Source project. You can use it to drive a laser cutter. For hardware and more information, look at our wiki: http://wiki.laoslaser.org

Dependencies:   EthernetNetIf mbed

Committer:
fablabtruck
Date:
Fri Jun 08 09:26:40 2012 +0000
Revision:
0:3852426a5068
svn revision 379

Who changed what in which revision?

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