hostapd: remove version tag from directory
[dragonfly.git] / contrib / hostapd / ieee802_1x.h
blob70b21de7004606d79014c14acedd2ae78052b261
1 /*
2 * hostapd / IEEE 802.1X Authenticator
3 * Copyright (c) 2002-2005, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
12 * See README and COPYING for more details.
15 #ifndef IEEE802_1X_H
16 #define IEEE802_1X_H
18 /* draft-congdon-radius-8021x-20.txt */
20 struct ieee802_1x_eapol_key {
21 u8 type;
22 u16 key_length;
23 u8 replay_counter[8]; /* does not repeat within the life of the keying
24 * material used to encrypt the Key field;
25 * 64-bit NTP timestamp MAY be used here */
26 u8 key_iv[16]; /* cryptographically random number */
27 u8 key_index; /* key flag in the most significant bit:
28 * 0 = broadcast (default key),
29 * 1 = unicast (key mapping key); key index is in the
30 * 7 least significant bits */
31 u8 key_signature[16]; /* HMAC-MD5 message integrity check computed with
32 * MS-MPPE-Send-Key as the key */
34 /* followed by key: if packet body length = 44 + key length, then the
35 * key field (of key_length bytes) contains the key in encrypted form;
36 * if packet body length = 44, key field is absent and key_length
37 * represents the number of least significant octets from
38 * MS-MPPE-Send-Key attribute to be used as the keying material;
39 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
40 } __attribute__ ((packed));
43 void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
44 size_t len);
45 void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta);
46 void ieee802_1x_free_station(struct sta_info *sta);
48 void ieee802_1x_request_identity(struct hostapd_data *hapd,
49 struct sta_info *sta);
50 void ieee802_1x_tx_canned_eap(struct hostapd_data *hapd, struct sta_info *sta,
51 int success);
52 void ieee802_1x_tx_req(struct hostapd_data *hapd, struct sta_info *sta);
53 void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta);
54 void ieee802_1x_send_resp_to_server(struct hostapd_data *hapd,
55 struct sta_info *sta);
56 void ieee802_1x_abort_auth(struct hostapd_data *hapd, struct sta_info *sta);
57 void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd,
58 struct sta_info *sta, int authorized);
59 void ieee802_1x_dump_state(FILE *f, const char *prefix, struct sta_info *sta);
60 int ieee802_1x_init(struct hostapd_data *hapd);
61 void ieee802_1x_deinit(struct hostapd_data *hapd);
62 int ieee802_1x_reconfig(struct hostapd_data *hapd,
63 struct hostapd_config *oldconf,
64 struct hostapd_bss_config *oldbss);
65 int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
66 u8 *buf, size_t len, int ack);
67 u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len);
68 u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
69 int idx);
70 u8 * ieee802_1x_get_key_crypt(struct eapol_state_machine *sm, size_t *len);
71 void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm,
72 int enabled);
73 void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm,
74 int valid);
75 void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, int pre_auth);
76 int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
77 int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
78 char *buf, size_t buflen);
79 void hostapd_get_ntp_timestamp(u8 *buf);
80 void ieee802_1x_finished(struct hostapd_data *hapd, struct sta_info *sta,
81 int success);
82 char *eap_type_text(u8 type);
84 struct radius_class_data;
86 void ieee802_1x_free_radius_class(struct radius_class_data *class);
87 int ieee802_1x_copy_radius_class(struct radius_class_data *dst,
88 struct radius_class_data *src);
90 #endif /* IEEE802_1X_H */