00001
00016 #ifndef EAP_TLV_H
00017 #define EAP_TLV_H
00018
00019
00020 #define EAP_TLV_RESULT_TLV 3
00021 #define EAP_TLV_NAK_TLV 4
00022 #define EAP_TLV_CRYPTO_BINDING_TLV 5
00023 #define EAP_TLV_CONNECTION_BINDING_TLV 6
00024 #define EAP_TLV_VENDOR_SPECIFIC_TLV 7
00025 #define EAP_TLV_URI_TLV 8
00026 #define EAP_TLV_EAP_PAYLOAD_TLV 9
00027 #define EAP_TLV_INTERMEDIATE_RESULT_TLV 10
00028 #define EAP_TLV_PAC_TLV 11
00029 #define EAP_TLV_CRYPTO_BINDING_TLV_ 12
00030
00031 #define EAP_TLV_RESULT_SUCCESS 1
00032 #define EAP_TLV_RESULT_FAILURE 2
00033
00034 #define EAP_TLV_TYPE_MANDATORY 0x8000
00035
00036 #ifdef _MSC_VER
00037 #pragma pack(push, 1)
00038 #endif
00039
00040 struct eap_tlv_hdr {
00041 u16 tlv_type;
00042 u16 length;
00043 } STRUCT_PACKED;
00044
00045 struct eap_tlv_nak_tlv {
00046 u16 tlv_type;
00047 u16 length;
00048 u32 vendor_id;
00049 u16 nak_type;
00050 } STRUCT_PACKED;
00051
00052 struct eap_tlv_result_tlv {
00053 u16 tlv_type;
00054 u16 length;
00055 u16 status;
00056 } STRUCT_PACKED;
00057
00058 struct eap_tlv_intermediate_result_tlv {
00059 u16 tlv_type;
00060 u16 length;
00061 u16 status;
00062 } STRUCT_PACKED;
00063
00064 struct eap_tlv_crypto_binding__tlv {
00065 u16 tlv_type;
00066 u16 length;
00067 u8 reserved;
00068 u8 version;
00069 u8 received_version;
00070 u8 subtype;
00071 u8 nonce[32];
00072 u8 compound_mac[20];
00073 } STRUCT_PACKED;
00074
00075 struct eap_tlv_pac_ack_tlv {
00076 u16 tlv_type;
00077 u16 length;
00078 u16 pac_type;
00079 u16 pac_len;
00080 u16 result;
00081 } STRUCT_PACKED;
00082
00083 #ifdef _MSC_VER
00084 #pragma pack(pop)
00085 #endif
00086
00087 #define EAP_TLV_CRYPTO_BINDING_SUBTYPE_REQUEST 0
00088 #define EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE 1
00089
00090
00091 u8 * eap_tlv_build_nak(int id, u16 nak_type, size_t *resp_len);
00092 u8 * eap_tlv_build_result(int id, u16 status, size_t *resp_len);
00093 int eap_tlv_process(struct eap_sm *sm, struct eap_method_ret *ret,
00094 const struct eap_hdr *hdr, u8 **resp, size_t *resp_len);
00095
00096 #endif
00097