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