EAP common peer/server definitions.
More...
Go to the source code of this file.
|
int | eap_hdr_len_valid (const struct wpabuf *msg, size_t min_payload) |
| Validate EAP header length field. More...
|
|
const u8 * | eap_hdr_validate (int vendor, EapType eap_type, const struct wpabuf *msg, size_t *plen) |
| Validate EAP header. More...
|
|
struct wpabuf * | eap_msg_alloc (int vendor, EapType type, size_t payload_len, u8 code, u8 identifier) |
| Allocate a buffer for an EAP message. More...
|
|
void | eap_update_len (struct wpabuf *msg) |
| Update EAP header length. More...
|
|
u8 | eap_get_id (const struct wpabuf *msg) |
| Get EAP Identifier from wpabuf. More...
|
|
EapType | eap_get_type (const struct wpabuf *msg) |
| Get EAP Type from wpabuf. More...
|
|
int | erp_parse_tlvs (const u8 *pos, const u8 *end, struct erp_tlvs *tlvs, int stop_at_keyname) |
|
EAP common peer/server definitions.
u8 eap_get_id |
( |
const struct wpabuf * |
msg | ) |
|
Get EAP Identifier from wpabuf.
- Parameters
-
msg | Buffer starting with an EAP header |
- Returns
- The Identifier field from the EAP header
EapType eap_get_type |
( |
const struct wpabuf * |
msg | ) |
|
Get EAP Type from wpabuf.
- Parameters
-
msg | Buffer starting with an EAP header |
- Returns
- The EAP Type after the EAP header
int eap_hdr_len_valid |
( |
const struct wpabuf * |
msg, |
|
|
size_t |
min_payload |
|
) |
| |
Validate EAP header length field.
- Parameters
-
msg | EAP frame (starting with EAP header) |
min_payload | Minimum payload length needed |
- Returns
- 1 for valid header, 0 for invalid
This is a helper function that does minimal validation of EAP messages. The length field is verified to be large enough to include the header and not too large to go beyond the end of the buffer.
const u8* eap_hdr_validate |
( |
int |
vendor, |
|
|
EapType |
eap_type, |
|
|
const struct wpabuf * |
msg, |
|
|
size_t * |
plen |
|
) |
| |
Validate EAP header.
- Parameters
-
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 |
- Returns
- Pointer to EAP payload (after type field), or NULL on failure
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.
struct wpabuf* eap_msg_alloc |
( |
int |
vendor, |
|
|
EapType |
type, |
|
|
size_t |
payload_len, |
|
|
u8 |
code, |
|
|
u8 |
identifier |
|
) |
| |
Allocate a buffer for an EAP message.
- Parameters
-
vendor | Vendor-Id (0 = IETF) |
type | EAP type |
payload_len | Payload length in bytes (data after Type) |
code | Message Code (EAP_CODE_*) |
identifier | Identifier |
- Returns
- Pointer to the allocated message buffer or NULL on error
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.
void eap_update_len |
( |
struct wpabuf * |
msg | ) |
|
Update EAP header length.
- Parameters
-
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).