llc: add definitions from 3GPP TS 44.064 section 6.4

Change-Id: I6d0e1a878fb80c57a901da08798620a6ea4471a4
This commit is contained in:
Vadim Yanitskiy 2022-09-09 00:24:48 +07:00
parent 8ab2897836
commit fcd76ba2d1
3 changed files with 92 additions and 0 deletions

View File

@ -16,6 +16,44 @@ enum osmo_gprs_llc_sapi {
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,

View File

@ -22,6 +22,7 @@ lib_LTLIBRARIES = \
$(NULL)
libosmo_gprs_llc_la_SOURCES = \
llc_pdu.c \
$(NULL)
# TODO: -export-symbols-regex '^osmo_'

53
src/llc/llc_pdu.c Normal file
View File

@ -0,0 +1,53 @@
/* 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_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 }
};