pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/30734 )
Change subject: llc: add enum osmo_gprs_llc_{location,prim_sap} ......................................................................
llc: add enum osmo_gprs_llc_{location,prim_sap}
Change-Id: I5606c0b41196f25adbc00cfdce9927daaed9a901 Related: OS#5502 --- M include/osmocom/gprs/llc/llc.h M include/osmocom/gprs/llc/llc_prim.h M src/llc/Makefile.am A src/llc/llc_prim.c 4 files changed, 56 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified msuraev: Looks good to me, but someone else must approve pespin: Looks good to me, approved
diff --git a/include/osmocom/gprs/llc/llc.h b/include/osmocom/gprs/llc/llc.h index ff12884..0f0ab83 100644 --- a/include/osmocom/gprs/llc/llc.h +++ b/include/osmocom/gprs/llc/llc.h @@ -7,6 +7,13 @@
#include <osmocom/core/msgb.h>
+/* Section 7.1.2 LLC layer service primitives */ +enum osmo_gprs_llc_location { + OSMO_GPRS_LLC_LOCATION_UNSET, + OSMO_GPRS_LLC_LOCATION_MS, + OSMO_GPRS_LLC_LOCATION_SGSN, +}; + /* Section 6.2.3 Service Access Point Identifier (SAPI) */ enum osmo_gprs_llc_sapi { OSMO_GPRS_LLC_SAPI_GMM = 1, diff --git a/include/osmocom/gprs/llc/llc_prim.h b/include/osmocom/gprs/llc/llc_prim.h index f58c5fa..dc5f097 100644 --- a/include/osmocom/gprs/llc/llc_prim.h +++ b/include/osmocom/gprs/llc/llc_prim.h @@ -6,6 +6,21 @@ #include <stddef.h>
#include <osmocom/core/prim.h> +#include <osmocom/core/utils.h> + +/* Section 7.1.0 */ +enum osmo_gprs_llc_prim_sap { + OSMO_GPRS_LLC_SAP_LLGM, + OSMO_GPRS_LLC_SAP_LL, + OSMO_GPRS_LLC_SAP_GRR, + OSMO_GPRS_LLC_SAP_BSSGP, +}; + +extern const struct value_string osmo_gprs_llc_prim_sap_names[]; +static inline const char *osmo_gprs_llc_prim_sap_name(enum osmo_gprs_llc_prim_sap val) +{ + return get_value_string(osmo_gprs_llc_prim_sap_names, val); +}
/* TS 04.64 Section 7.1.2 Table 7: LLC layer primitives (GMM/SNDCP/SMS/TOM) */ /* TS 04.65 Section 5.1.2 Table 2: Service primitives used by SNDCP */ diff --git a/src/llc/Makefile.am b/src/llc/Makefile.am index c25841e..317b855 100644 --- a/src/llc/Makefile.am +++ b/src/llc/Makefile.am @@ -26,6 +26,7 @@ libosmo_gprs_llc_la_SOURCES = \ crc24.c \ llc_pdu.c \ + llc_prim.c \ llc_xid.c \ misc.c \ $(NULL) diff --git a/src/llc/llc_prim.c b/src/llc/llc_prim.c new file mode 100644 index 0000000..030494a --- /dev/null +++ b/src/llc/llc_prim.c @@ -0,0 +1,33 @@ +/* GPRS LLC protocol primitive implementation as per 3GPP TS 44.064 */ +/* + * (C) 2022 by sysmocom - s.f.m.c. GmbH info@sysmocom.de + * + * 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> +#include <osmocom/gprs/llc/llc_prim.h> + +const struct value_string osmo_gprs_llc_prim_sap_names[] = { + { OSMO_GPRS_LLC_SAP_LLGM, "LLGM" }, + { OSMO_GPRS_LLC_SAP_LL, "LL" }, + { OSMO_GPRS_LLC_SAP_GRR, "GRR" }, + { OSMO_GPRS_LLC_SAP_BSSGP, "BSSGP" }, + { 0, NULL } +};