OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [ppp/] [current/] [include/] [chap.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      include/chap.h
4
//
5
//==========================================================================
6
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
7
// -------------------------------------------                              
8
// This file is part of eCos, the Embedded Configurable Operating System.   
9
// Copyright (C) 2003 Free Software Foundation, Inc.                        
10
//
11
// eCos is free software; you can redistribute it and/or modify it under    
12
// the terms of the GNU General Public License as published by the Free     
13
// Software Foundation; either version 2 or (at your option) any later      
14
// version.                                                                 
15
//
16
// eCos is distributed in the hope that it will be useful, but WITHOUT      
17
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
18
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
19
// for more details.                                                        
20
//
21
// You should have received a copy of the GNU General Public License        
22
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
23
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
24
//
25
// As a special exception, if other files instantiate templates or use      
26
// macros or inline functions from this file, or you compile this file      
27
// and link it with other works to produce a work based on this file,       
28
// this file does not by itself cause the resulting work to be covered by   
29
// the GNU General Public License. However the source code for this file    
30
// must still be made available in accordance with section (3) of the GNU   
31
// General Public License v2.                                               
32
//
33
// This exception does not invalidate any other reasons why a work based    
34
// on this file might be covered by the GNU General Public License.         
35
// -------------------------------------------                              
36
// ####ECOSGPLCOPYRIGHTEND####                                              
37
// ####BSDALTCOPYRIGHTBEGIN####                                             
38
// -------------------------------------------                              
39
// Portions of this software may have been derived from FreeBSD, OpenBSD,   
40
// or other sources, and if so are covered by the appropriate copyright     
41
// and license included herein.                                             
42
// -------------------------------------------                              
43
// ####BSDALTCOPYRIGHTEND####                                               
44
//==========================================================================
45
 
46
/*
47
 * chap.h - Challenge Handshake Authentication Protocol definitions.
48
 *
49
 * Copyright (c) 1993 The Australian National University.
50
 * All rights reserved.
51
 *
52
 * Redistribution and use in source and binary forms are permitted
53
 * provided that the above copyright notice and this paragraph are
54
 * duplicated in all such forms and that any documentation,
55
 * advertising materials, and other materials related to such
56
 * distribution and use acknowledge that the software was developed
57
 * by the Australian National University.  The name of the University
58
 * may not be used to endorse or promote products derived from this
59
 * software without specific prior written permission.
60
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
61
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
62
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
63
 *
64
 * Copyright (c) 1991 Gregory M. Christy
65
 * All rights reserved.
66
 *
67
 * Redistribution and use in source and binary forms are permitted
68
 * provided that the above copyright notice and this paragraph are
69
 * duplicated in all such forms and that any documentation,
70
 * advertising materials, and other materials related to such
71
 * distribution and use acknowledge that the software was developed
72
 * by the author.
73
 *
74
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
75
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
76
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
77
 *
78
 * $FreeBSD: src/usr.sbin/pppd/chap.h,v 1.7 1999/08/28 01:19:01 peter Exp $
79
 */
80
 
81
#ifndef __CHAP_INCLUDE__
82
 
83
/* Code + ID + length */
84
#define CHAP_HEADERLEN          4
85
 
86
/*
87
 * CHAP codes.
88
 */
89
 
90
#define CHAP_DIGEST_MD5         5       /* use MD5 algorithm */
91
#define MD5_SIGNATURE_SIZE      16      /* 16 bytes in a MD5 message digest */
92
#define CHAP_MICROSOFT          0x80    /* use Microsoft-compatible alg. */
93
#define MS_CHAP_RESPONSE_LEN    49      /* Response length for MS-CHAP */
94
 
95
#define CHAP_CHALLENGE          1
96
#define CHAP_RESPONSE           2
97
#define CHAP_SUCCESS            3
98
#define CHAP_FAILURE            4
99
 
100
/*
101
 *  Challenge lengths (for challenges we send) and other limits.
102
 */
103
#define MIN_CHALLENGE_LENGTH    32
104
#define MAX_CHALLENGE_LENGTH    64
105
#define MAX_RESPONSE_LENGTH     64      /* sufficient for MD5 or MS-CHAP */
106
 
107
/*
108
 * Each interface is described by a chap structure.
109
 */
110
 
111
typedef struct chap_state {
112
    int unit;                   /* Interface unit number */
113
    int clientstate;            /* Client state */
114
    int serverstate;            /* Server state */
115
    u_char challenge[MAX_CHALLENGE_LENGTH]; /* last challenge string sent */
116
    u_char chal_len;            /* challenge length */
117
    u_char chal_id;             /* ID of last challenge */
118
    u_char chal_type;           /* hash algorithm for challenges */
119
    u_char id;                  /* Current id */
120
    char *chal_name;            /* Our name to use with challenge */
121
    int chal_interval;          /* Time until we challenge peer again */
122
    int timeouttime;            /* Timeout time in seconds */
123
    int max_transmits;          /* Maximum # of challenge transmissions */
124
    int chal_transmits;         /* Number of transmissions of challenge */
125
    int resp_transmits;         /* Number of transmissions of response */
126
    u_char response[MAX_RESPONSE_LENGTH];       /* Response to send */
127
    u_char resp_length;         /* length of response */
128
    u_char resp_id;             /* ID for response messages */
129
    u_char resp_type;           /* hash algorithm for responses */
130
    char *resp_name;            /* Our name to send with response */
131
} chap_state;
132
 
133
 
134
/*
135
 * Client (peer) states.
136
 */
137
#define CHAPCS_INITIAL          0        /* Lower layer down, not opened */
138
#define CHAPCS_CLOSED           1       /* Lower layer up, not opened */
139
#define CHAPCS_PENDING          2       /* Auth us to peer when lower up */
140
#define CHAPCS_LISTEN           3       /* Listening for a challenge */
141
#define CHAPCS_RESPONSE         4       /* Sent response, waiting for status */
142
#define CHAPCS_OPEN             5       /* We've received Success */
143
 
144
/*
145
 * Server (authenticator) states.
146
 */
147
#define CHAPSS_INITIAL          0        /* Lower layer down, not opened */
148
#define CHAPSS_CLOSED           1       /* Lower layer up, not opened */
149
#define CHAPSS_PENDING          2       /* Auth peer when lower up */
150
#define CHAPSS_INITIAL_CHAL     3       /* We've sent the first challenge */
151
#define CHAPSS_OPEN             4       /* We've sent a Success msg */
152
#define CHAPSS_RECHALLENGE      5       /* We've sent another challenge */
153
#define CHAPSS_BADAUTH          6       /* We've sent a Failure msg */
154
 
155
/*
156
 * Timeouts.
157
 */
158
#define CHAP_DEFTIMEOUT         3       /* Timeout time in seconds */
159
#define CHAP_DEFTRANSMITS       10      /* max # times to send challenge */
160
 
161
extern chap_state chap[];
162
 
163
void ChapAuthWithPeer __P((int, char *, int));
164
void ChapAuthPeer __P((int, char *, int));
165
 
166
extern struct protent chap_protent;
167
 
168
#define __CHAP_INCLUDE__
169
#endif /* __CHAP_INCLUDE__ */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.