Darran Shepherd / Mbed 2 deprecated Bonjour

Dependencies:   mbed

Committer:
darran
Date:
Fri Jun 18 09:11:35 2010 +0000
Revision:
0:55a05330f8cc

        

Who changed what in which revision?

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