~ubuntu-branches/ubuntu/gutsy/wpasupplicant/gutsy

« back to all changes in this revision

Viewing changes to src/eap_server/eap.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2007-08-26 16:06:57 UTC
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20070826160657-mxk5ivjjh65ptxlr
Tags: upstream-0.6.0+0.5.8
ImportĀ upstreamĀ versionĀ 0.6.0+0.5.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * hostapd / EAP Standalone Authenticator state machine (RFC 4137)
3
 
 * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License version 2 as
7
 
 * published by the Free Software Foundation.
8
 
 *
9
 
 * Alternatively, this software may be distributed under the terms of BSD
10
 
 * license.
11
 
 *
12
 
 * See README and COPYING for more details.
13
 
 */
14
 
 
15
 
#ifndef EAP_H
16
 
#define EAP_H
17
 
 
18
 
#include "defs.h"
19
 
#include "eap_common/eap_defs.h"
20
 
#include "eap_server/eap_methods.h"
21
 
 
22
 
struct eap_sm;
23
 
 
24
 
#define EAP_MAX_METHODS 8
25
 
struct eap_user {
26
 
        struct {
27
 
                int vendor;
28
 
                u32 method;
29
 
        } methods[EAP_MAX_METHODS];
30
 
        u8 *password;
31
 
        size_t password_len;
32
 
        int password_hash; /* whether password is hashed with
33
 
                            * nt_password_hash() */
34
 
        int phase2;
35
 
        int force_version;
36
 
};
37
 
 
38
 
enum eapol_bool_var {
39
 
        EAPOL_eapSuccess, EAPOL_eapRestart, EAPOL_eapFail, EAPOL_eapResp,
40
 
        EAPOL_eapReq, EAPOL_eapNoReq, EAPOL_portEnabled, EAPOL_eapTimeout
41
 
};
42
 
 
43
 
struct eapol_callbacks {
44
 
        Boolean (*get_bool)(void *ctx, enum eapol_bool_var variable);
45
 
        void (*set_bool)(void *ctx, enum eapol_bool_var variable,
46
 
                         Boolean value);
47
 
        void (*set_eapReqData)(void *ctx, const u8 *eapReqData,
48
 
                               size_t eapReqDataLen);
49
 
        void (*set_eapKeyData)(void *ctx, const u8 *eapKeyData,
50
 
                               size_t eapKeyDataLen);
51
 
        int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
52
 
                            int phase2, struct eap_user *user);
53
 
        const char * (*get_eap_req_id_text)(void *ctx, size_t *len);
54
 
};
55
 
 
56
 
struct eap_config {
57
 
        void *ssl_ctx;
58
 
        void *eap_sim_db_priv;
59
 
        Boolean backend_auth;
60
 
};
61
 
 
62
 
 
63
 
#ifdef EAP_SERVER
64
 
 
65
 
struct eap_sm * eap_server_sm_init(void *eapol_ctx,
66
 
                                   struct eapol_callbacks *eapol_cb,
67
 
                                   struct eap_config *eap_conf);
68
 
void eap_server_sm_deinit(struct eap_sm *sm);
69
 
int eap_server_sm_step(struct eap_sm *sm);
70
 
void eap_set_eapRespData(struct eap_sm *sm, const u8 *eapRespData,
71
 
                         size_t eapRespDataLen);
72
 
void eap_sm_notify_cached(struct eap_sm *sm);
73
 
void eap_sm_pending_cb(struct eap_sm *sm);
74
 
int eap_sm_method_pending(struct eap_sm *sm);
75
 
 
76
 
#else /* EAP_SERVER */
77
 
 
78
 
static inline struct eap_sm *
79
 
eap_server_sm_init(void *eapol_ctx,
80
 
                   struct eapol_callbacks *eapol_cb,
81
 
                   struct eap_config *eap_conf)
82
 
{
83
 
        return NULL;
84
 
}
85
 
 
86
 
static inline void eap_server_sm_deinit(struct eap_sm *sm)
87
 
{
88
 
}
89
 
 
90
 
static inline int eap_server_sm_step(struct eap_sm *sm)
91
 
{
92
 
        return 0;
93
 
}
94
 
 
95
 
 
96
 
static inline void eap_set_eapRespData(struct eap_sm *sm,
97
 
                                       const u8 *eapRespData,
98
 
                                       size_t eapRespDataLen)
99
 
{
100
 
}
101
 
 
102
 
static inline void eap_sm_notify_cached(struct eap_sm *sm)
103
 
{
104
 
}
105
 
 
106
 
static inline void eap_sm_pending_cb(struct eap_sm *sm)
107
 
{
108
 
}
109
 
 
110
 
static inline int eap_sm_method_pending(struct eap_sm *sm)
111
 
{
112
 
        return 0;
113
 
}
114
 
 
115
 
#endif /* EAP_SERVER */
116
 
 
117
 
#endif /* EAP_H */