From a78b22ba203d9674bb797623b9c1dd985b523663 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 13 Apr 2018 03:36:49 +0200 Subject: add tlv_parse2(), capable of multiple instances of the same IE Allow passing multiple struct tlv_parsed in an array, to allow parsing as many repeated IEs as are expected by the caller. From tlv_parse(), call tlv_parse2() with dec_multiple = 1 to yield the previous behavior. tlv_parse() remains valid API. An example of multiple IEs is the BSSMAP Handover Request, containing Cell Identifier (Serving) and Cell Identifier (Target), both defined by 3GPP TS 48.008 3.2.2.17 with identical IE tags; both are mandatory. Related: OS#2283 (inter-BSC HO, BSC side) Change-Id: Id04008eaf0a1cafdbdc11b7efc556e3035b1c84d --- include/osmocom/gsm/tlv.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/osmocom/gsm/tlv.h b/include/osmocom/gsm/tlv.h index 8654893b..996f6aac 100644 --- a/include/osmocom/gsm/tlv.h +++ b/include/osmocom/gsm/tlv.h @@ -433,6 +433,9 @@ int tlv_parse_one(uint8_t *o_tag, uint16_t *o_len, const uint8_t **o_val, const uint8_t *buf, int buf_len); int tlv_parse(struct tlv_parsed *dec, const struct tlv_definition *def, const uint8_t *buf, int buf_len, uint8_t lv_tag, uint8_t lv_tag2); +int tlv_parse2(struct tlv_parsed *dec, int dec_multiples, + const struct tlv_definition *def, const uint8_t *buf, int buf_len, + uint8_t lv_tag, uint8_t lv_tag2); /* take a master (src) tlv def and fill up all empty slots in 'dst' */ void tlv_def_patch(struct tlv_definition *dst, const struct tlv_definition *src); -- cgit v1.2.3