EAP common peer/server definitions. More...
#include "wpabuf.h"
Go to the source code of this file.
Functions | |
const u8 * | eap_hdr_validate (int vendor, EapType eap_type, const struct wpabuf *msg, size_t *plen) |
Validate EAP header. | |
struct wpabuf * | eap_msg_alloc (int vendor, EapType type, size_t payload_len, u8 code, u8 identifier) |
Allocate a buffer for an EAP message. | |
void | eap_update_len (struct wpabuf *msg) |
Update EAP header length. | |
u8 | eap_get_id (const struct wpabuf *msg) |
Get EAP Identifier from wpabuf. | |
EapType | eap_get_type (const struct wpabuf *msg) |
Get EAP Type from wpabuf. |
EAP common peer/server definitions.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
Alternatively, this software may be distributed under the terms of BSD license.
See README and COPYING for more details.
Definition in file eap_common.h.
u8 eap_get_id | ( | const struct wpabuf * | msg | ) |
Get EAP Identifier from wpabuf.
msg | Buffer starting with an EAP header |
Definition at line 166 of file eap_common.c.
EapType eap_get_type | ( | const struct wpabuf * | msg | ) |
Get EAP Type from wpabuf.
msg | Buffer starting with an EAP header |
Definition at line 184 of file eap_common.c.
const u8* eap_hdr_validate | ( | int | vendor, | |
EapType | eap_type, | |||
const struct wpabuf * | msg, | |||
size_t * | plen | |||
) |
Validate EAP header.
vendor | Expected EAP Vendor-Id (0 = IETF) | |
eap_type | Expected EAP type number | |
msg | EAP frame (starting with EAP header) | |
plen | Pointer to variable to contain the returned payload length |
This is a helper function for EAP method implementations. This is usually called in the beginning of struct eap_method::process() function to verify that the received EAP request packet has a valid header. This function is able to process both legacy and expanded EAP headers and in most cases, the caller can just use the returned payload pointer (into *plen) for processing the payload regardless of whether the packet used the expanded EAP header or not.
Definition at line 39 of file eap_common.c.
struct wpabuf* eap_msg_alloc | ( | int | vendor, | |
EapType | type, | |||
size_t | payload_len, | |||
u8 | code, | |||
u8 | identifier | |||
) | [read] |
Allocate a buffer for an EAP message.
vendor | Vendor-Id (0 = IETF) | |
type | EAP type | |
payload_len | Payload length in bytes (data after Type) | |
code | Message Code (EAP_CODE_*) | |
identifier | Identifier |
This function can be used to allocate a buffer for an EAP message and fill in the EAP header. This function is automatically using expanded EAP header if the selected Vendor-Id is not IETF. In other words, most EAP methods do not need to separately select which header type to use when using this function to allocate the message buffers. The returned buffer has room for payload_len bytes and has the EAP header and Type field already filled in.
Definition at line 110 of file eap_common.c.
void eap_update_len | ( | struct wpabuf * | msg | ) |
Update EAP header length.
msg | EAP message from eap_msg_alloc |
This function updates the length field in the EAP header to match with the current length for the buffer. This allows eap_msg_alloc() to be used to allocate a larger buffer than the exact message length (e.g., if exact message length is not yet known).
Definition at line 150 of file eap_common.c.