mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
ie: add ie_parse_oci
This is a very minimal parser, more or less to put the type and length checks into a single location.
This commit is contained in:
parent
224721e7f0
commit
7fed9f758f
20
src/ie.c
20
src/ie.c
@ -2552,3 +2552,23 @@ int ie_parse_owe_transition(const void *data, size_t len,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ie_parse_oci(const void *data, size_t len, const uint8_t **oci)
|
||||||
|
{
|
||||||
|
struct ie_tlv_iter iter;
|
||||||
|
|
||||||
|
ie_tlv_iter_init(&iter, data, len);
|
||||||
|
|
||||||
|
if (!ie_tlv_iter_next(&iter))
|
||||||
|
return -EMSGSIZE;
|
||||||
|
|
||||||
|
if (ie_tlv_iter_get_length(&iter) != 3)
|
||||||
|
return -EMSGSIZE;
|
||||||
|
|
||||||
|
if (ie_tlv_iter_get_tag(&iter) != IE_TYPE_OCI)
|
||||||
|
return -EPROTOTYPE;
|
||||||
|
|
||||||
|
*oci = ie_tlv_iter_get_data(&iter);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
2
src/ie.h
2
src/ie.h
@ -645,3 +645,5 @@ int ie_parse_network_cost(const void *data, size_t len,
|
|||||||
|
|
||||||
int ie_parse_owe_transition(const void *data, size_t len,
|
int ie_parse_owe_transition(const void *data, size_t len,
|
||||||
struct ie_owe_transition_info *info);
|
struct ie_owe_transition_info *info);
|
||||||
|
|
||||||
|
int ie_parse_oci(const void *data, size_t len, const uint8_t **oci);
|
||||||
|
Loading…
Reference in New Issue
Block a user