diff --git a/src/cmdu.c b/src/cmdu.c index 381cfaa036673bdb230bcfd263bed25e24e06cc0..c06f1855349a45836f4922a25d56b64c63177053 100644 --- a/src/cmdu.c +++ b/src/cmdu.c @@ -391,11 +391,11 @@ int cmdu_parse_tlvs(struct cmdu_buff *c, struct tlv *tv[][16], return 0; } -/* Find a tlv and pulls it from tlv stream. - * This function is destructive. +/* Extracts the first matching tlv from tlv-stream. + * This function is destructive, i.e. it modifies the passed cmdu buffer. * Use cmdu_peek_tlv() for the non-destructive version. */ -struct tlv *cmdu_get_tlv(struct cmdu_buff *c, uint8_t tlv_type) +struct tlv *cmdu_extract_tlv(struct cmdu_buff *c, uint8_t tlv_type) { struct tlv *t, *tmp; int found = 0; diff --git a/src/cmdu.h b/src/cmdu.h index 1f500ff6066b939b61a2070f41072f22c4e8911b..90fcd0d9cac52163a93cad2658e31f71a331390d 100644 --- a/src/cmdu.h +++ b/src/cmdu.h @@ -163,7 +163,7 @@ int cmdu_put_tlv(struct cmdu_buff *c, struct tlv *t); int cmdu_put(struct cmdu_buff *c, uint8_t *bytes, int len); int cmdu_put_eom(struct cmdu_buff *c); -struct tlv *cmdu_get_tlv(struct cmdu_buff *c, uint8_t tlv_type); +struct tlv *cmdu_extract_tlv(struct cmdu_buff *c, uint8_t tlv_type); struct tlv *cmdu_peek_tlv(struct cmdu_buff *c, uint8_t tlv_type); int cmdu_reserve(struct cmdu_buff *c, size_t s); int cmdu_expand(struct cmdu_buff *c, size_t newsize);