fixeria has submitted this change. (
https://gerrit.osmocom.org/c/libosmo-gprs/+/29399 )
Change subject: llc: add definitions from 3GPP TS 44.064 section 6.4
......................................................................
llc: add definitions from 3GPP TS 44.064 section 6.4
Change-Id: I6d0e1a878fb80c57a901da08798620a6ea4471a4
---
M include/osmocom/gprs/llc/llc.h
M src/llc/Makefile.am
A src/llc/llc_pdu.c
3 files changed, 92 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
neels: 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 53e6352..5e8860c 100644
--- a/include/osmocom/gprs/llc/llc.h
+++ b/include/osmocom/gprs/llc/llc.h
@@ -16,6 +16,44 @@
OSMO_GPRS_LLC_SAPI_SNDCP12 = 11,
};
+/* Section 6.3.0 Control field formats */
+enum osmo_gprs_llc_frame_fmt {
+ OSMO_GPRS_LLC_FMT_I, /* 6.3.1 Information transfer format - I */
+ OSMO_GPRS_LLC_FMT_S, /* 6.3.2 Supervisory format - S */
+ OSMO_GPRS_LLC_FMT_UI, /* 6.3.3 Unconfirmed Information format - UI */
+ OSMO_GPRS_LLC_FMT_U, /* 6.3.4 Unnumbered format - U */
+};
+
+extern const struct value_string osmo_gprs_llc_frame_fmt_names[];
+
+#define osmo_gprs_llc_frame_fmt_name(val) \
+ get_value_string(osmo_gprs_llc_frame_fmt_names, val)
+
+/* Section 6.4 Commands and responses */
+enum osmo_gprs_llc_frame_func {
+ /* 6.4.1 Unnumbered (U) frames */
+ OSMO_GPRS_LLC_FUNC_SABM, /* 6.4.1.1 */
+ OSMO_GPRS_LLC_FUNC_DISC, /* 6.4.1.2 */
+ OSMO_GPRS_LLC_FUNC_UA, /* 6.4.1.3 */
+ OSMO_GPRS_LLC_FUNC_DM, /* 6.4.1.4 */
+ OSMO_GPRS_LLC_FUNC_FRMR, /* 6.4.1.5 */
+ OSMO_GPRS_LLC_FUNC_XID, /* 6.4.1.6 */
+ OSMO_GPRS_LLC_FUNC_NULL, /* 6.4.1.7 */
+ /* 6.4.2 Unconfirmed Information (UI) frame */
+ OSMO_GPRS_LLC_FUNC_UI, /* 6.4.2.1 */
+ OSMO_GPRS_LLC_FUNC_UI_DUMMY, /* 6.4.2.2 */
+ /* 6.4.3 Combined Information (I) and Supervisory (S) frames */
+ OSMO_GPRS_LLC_FUNC_RR, /* 6.4.3.1 */
+ OSMO_GPRS_LLC_FUNC_ACK, /* 6.4.3.2 */
+ OSMO_GPRS_LLC_FUNC_SACK, /* 6.4.3.3 */
+ OSMO_GPRS_LLC_FUNC_RNR, /* 6.4.3.4 */
+};
+
+extern const struct value_string osmo_gprs_llc_frame_func_names[];
+
+#define osmo_gprs_llc_frame_func_name(val) \
+ get_value_string(osmo_gprs_llc_frame_func_names, val)
+
/* Section 6.4.1.6 / Table 6 */
enum osmo_gprs_llc_xid_type {
OSMO_GPRS_LLC_XID_T_VERSION = 0,
diff --git a/src/llc/Makefile.am b/src/llc/Makefile.am
index 5f9fac3..5a4ad72 100644
--- a/src/llc/Makefile.am
+++ b/src/llc/Makefile.am
@@ -22,6 +22,7 @@
$(NULL)
libosmo_gprs_llc_la_SOURCES = \
+ llc_pdu.c \
$(NULL)
# TODO: -export-symbols-regex '^osmo_'
diff --git a/src/llc/llc_pdu.c b/src/llc/llc_pdu.c
new file mode 100644
index 0000000..0a98416
--- /dev/null
+++ b/src/llc/llc_pdu.c
@@ -0,0 +1,53 @@
+/* GPRS LLC protocol implementation as per 3GPP TS 44.064 */
+
+/* (C) 2009-2010 by Harald Welte <laforge(a)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_frame_fmt_names[] = {
+ { OSMO_GPRS_LLC_FMT_I, "I" },
+ { OSMO_GPRS_LLC_FMT_S, "U" },
+ { OSMO_GPRS_LLC_FMT_UI, "UI" },
+ { OSMO_GPRS_LLC_FMT_U, "U" },
+ { 0, NULL }
+};
+
+const struct value_string osmo_gprs_llc_frame_func_names[] = {
+ /* 6.4.1 Unnumbered (U) frames */
+ { OSMO_GPRS_LLC_FUNC_SABM, "SABM" },
+ { OSMO_GPRS_LLC_FUNC_DISC, "DISC" },
+ { OSMO_GPRS_LLC_FUNC_UA, "UA" },
+ { OSMO_GPRS_LLC_FUNC_DM, "DM" },
+ { OSMO_GPRS_LLC_FUNC_FRMR, "FRMR" },
+ { OSMO_GPRS_LLC_FUNC_XID, "XID" },
+ { OSMO_GPRS_LLC_FUNC_NULL, "NULL" },
+ /* 6.4.2 Unconfirmed Information (UI) frame */
+ { OSMO_GPRS_LLC_FUNC_UI, "UI" },
+ { OSMO_GPRS_LLC_FUNC_UI_DUMMY, "UI Dummy" },
+ /* 6.4.3 Combined Information (I) and Supervisory (S) frames */
+ { OSMO_GPRS_LLC_FUNC_RR, "RR" },
+ { OSMO_GPRS_LLC_FUNC_ACK, "ACK" },
+ { OSMO_GPRS_LLC_FUNC_SACK, "SACK" },
+ { OSMO_GPRS_LLC_FUNC_RNR, "RNR" },
+ { 0, NULL }
+};
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-gprs/+/29399
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I6d0e1a878fb80c57a901da08798620a6ea4471a4
Gerrit-Change-Number: 29399
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged