Updated through tag hostap_2_5 from git://w1.fi/hostap.git
[mech_eap.git] / libeap / src / eap_common / eap_common.h
1 /*
2  * EAP common peer/server definitions
3  * Copyright (c) 2004-2014, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8
9 #ifndef EAP_COMMON_H
10 #define EAP_COMMON_H
11
12 #include "wpabuf.h"
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18
19 struct erp_tlvs {
20         const u8 *keyname;
21         const u8 *domain;
22         u8 keyname_len;
23         u8 domain_len;
24 };
25
26 int eap_hdr_len_valid(const struct wpabuf *msg, size_t min_payload);
27 const u8 * eap_hdr_validate(int vendor, EapType eap_type,
28                             const struct wpabuf *msg, size_t *plen);
29 struct wpabuf * eap_msg_alloc(int vendor, EapType type, size_t payload_len,
30                               u8 code, u8 identifier);
31 void eap_update_len(struct wpabuf *msg);
32 u8 eap_get_id(const struct wpabuf *msg);
33 EapType eap_get_type(const struct wpabuf *msg);
34 int erp_parse_tlvs(const u8 *pos, const u8 *end, struct erp_tlvs *tlvs,
35                    int stop_at_keyname);
36
37 #ifdef __cplusplus
38 }
39 #endif
40
41 #endif /* EAP_COMMON_H */