From 8b58faa4c2e1b52802293f4dce9fcc8dc3843b47 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 14 Mar 2022 16:38:15 +0100 Subject: libosmo-gtlv: add TLIV capability During code review, it was indicated that some TLV protocols that we will likely deal with in the near future also employ an I, and instance value of a tag. Add TLIV support. A usage example for a manually implemented TLIV structure is found in tests/libosmo-gtlv/gtlv_test.c. A usage example for a generated TLIV protocol is found in tests/libosmo-gtlv/test_tliv/. Related: SYS#5599 Change-Id: I0a076e54dfba6038cc779cb7c8f3967d212226aa --- tests/libosmo-gtlv/test_tliv/myproto_ies_custom.h | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/libosmo-gtlv/test_tliv/myproto_ies_custom.h (limited to 'tests/libosmo-gtlv/test_tliv/myproto_ies_custom.h') diff --git a/tests/libosmo-gtlv/test_tliv/myproto_ies_custom.h b/tests/libosmo-gtlv/test_tliv/myproto_ies_custom.h new file mode 100644 index 0000000..64e06ff --- /dev/null +++ b/tests/libosmo-gtlv/test_tliv/myproto_ies_custom.h @@ -0,0 +1,50 @@ +/* Definitions for decoded message IEs, to be used by the auto-generated myproto_ies_auto.c. */ +/* + * (C) 2021-2022 by sysmocom - s.f.m.c. GmbH + * All Rights Reserved. + * + * Author: Neels Janosch Hofmeyr + * + * SPDX-License-Identifier: GPL-2.0+ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#pragma once + +#include + +enum myproto_msg_type { + MYPROTO_MSGT_MOO = 1, +}; + +extern const struct value_string myproto_msg_type_names[]; + +enum myproto_iei { + MYPROTO_IEI_BAR = 1, +}; + +enum myproto_iei_bar_inst { + MYPROTO_IEI_BAR_ALPHA = 2, + MYPROTO_IEI_BAR_BETA = 3, + MYPROTO_IEI_BAR_GAMMA = 5, +}; + +extern const struct value_string myproto_iei_names[]; + +struct myproto_ie_bar { + int a; + bool b; +}; -- cgit v1.2.3