fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29480 )
Change subject: llc: add value-string for enum osmo_gprs_llc_xid_type ......................................................................
llc: add value-string for enum osmo_gprs_llc_xid_type
Change-Id: I90b6a1aa4e13984f4c43245df1308d0c3f82636f --- M include/osmocom/gprs/llc/llc.h M src/llc/Makefile.am A src/llc/llc_xid.c 3 files changed, 50 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h index 7a4ac03..7c4ea45 100644 --- a/include/osmocom/gprs/llc/llc.h +++ b/include/osmocom/gprs/llc/llc.h @@ -85,6 +85,13 @@ OSMO_GPRS_LLC_XID_T_RESET = 12, };
+extern const struct value_string osmo_gprs_llc_xid_type_names[]; + +static inline const char *osmo_gprs_llc_xid_type_name(enum osmo_gprs_llc_xid_type val) +{ + return get_value_string(osmo_gprs_llc_xid_type_names, val); +} + /* Section 4.5.2 Logical Link States + Annex C.2 */ enum osmo_gprs_llc_lle_state { OSMO_GPRS_LLC_LLES_UNASSIGNED = 1, /* No TLLI yet */ diff --git a/src/llc/Makefile.am b/src/llc/Makefile.am index a301a89..6c0e680 100644 --- a/src/llc/Makefile.am +++ b/src/llc/Makefile.am @@ -24,6 +24,7 @@ libosmo_gprs_llc_la_SOURCES = \ crc24.c \ llc_pdu.c \ + llc_xid.c \ misc.c \ $(NULL)
diff --git a/src/llc/llc_xid.c b/src/llc/llc_xid.c new file mode 100644 index 0000000..1705e5d --- /dev/null +++ b/src/llc/llc_xid.c @@ -0,0 +1,42 @@ +/* GPRS LLC protocol implementation as per 3GPP TS 44.064 */ + +/* (C) 2009-2010 by Harald Welte laforge@gnumonks.org + * (C) 2022 by Sysmocom s.f.m.c. GmbH + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#include <osmocom/core/utils.h> + +#include <osmocom/gprs/llc/llc.h> + +const struct value_string osmo_gprs_llc_xid_type_names[] = { + { OSMO_GPRS_LLC_XID_T_VERSION, "LLC-Version" }, + { OSMO_GPRS_LLC_XID_T_IOV_UI, "IOV-UI" }, + { OSMO_GPRS_LLC_XID_T_IOV_I, "IOV-I" }, + { OSMO_GPRS_LLC_XID_T_T200, "T200" }, + { OSMO_GPRS_LLC_XID_T_N200, "N200" }, + { OSMO_GPRS_LLC_XID_T_N201_U, "N201-U" }, + { OSMO_GPRS_LLC_XID_T_N201_I, "N201-I" }, + { OSMO_GPRS_LLC_XID_T_mD, "mD" }, + { OSMO_GPRS_LLC_XID_T_mU, "mU" }, + { OSMO_GPRS_LLC_XID_T_kD, "kD" }, + { OSMO_GPRS_LLC_XID_T_kU, "kU" }, + { OSMO_GPRS_LLC_XID_T_L3_PAR, "L3-Params" }, + { OSMO_GPRS_LLC_XID_T_RESET, "Reset" }, + { 0, NULL } +};