From 7918f84aeb65c4b833ccf86b9daa6ab76f06c031 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 10 Dec 2018 10:57:59 +0100 Subject: LCLS, TS 29.205: add GCR routines Add functions to encode and decode Global Call Reference as per 3GPP TS 29.205 Table B 2.1.9.1 add corresponding tests. Change-Id: Iee95aa4e5c056645b6cb5667e4a067097d52dfbf Related: OS#2487 --- include/Makefile.am | 1 + include/osmocom/gsm/gsm0808_utils.h | 2 +- include/osmocom/gsm/gsm29205.h | 41 +++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 include/osmocom/gsm/gsm29205.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am index 366fd70b..ccf9e108 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -86,6 +86,7 @@ nobase_include_HEADERS = \ osmocom/coding/gsm0503_interleaving.h \ osmocom/coding/gsm0503_coding.h \ osmocom/gsm/gsm0808.h \ + osmocom/gsm/gsm29205.h \ osmocom/gsm/gsm0808_utils.h \ osmocom/gsm/gsm23003.h \ osmocom/gsm/gsm29118.h \ diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h index 90ff6771..5d5803be 100644 --- a/include/osmocom/gsm/gsm0808_utils.h +++ b/include/osmocom/gsm/gsm0808_utils.h @@ -62,7 +62,7 @@ struct gsm0808_cell_id_list2 { struct osmo_lcls { enum gsm0808_lcls_config config; /**< §3.2.2.116 Configuration */ enum gsm0808_lcls_control control; /**< §3.2.2.117 Connection Status Control */ - struct gsm29205_gcr *gcr; /**< §3.2.2.115 Global Call Reference */ + struct osmo_gcr_parsed *gcr; /**< §3.2.2.115 Global Call Reference */ bool corr_needed; /**< §3.2.2.118 Correlation-Not-Needed */ }; diff --git a/include/osmocom/gsm/gsm29205.h b/include/osmocom/gsm/gsm29205.h new file mode 100644 index 00000000..0c3c153e --- /dev/null +++ b/include/osmocom/gsm/gsm29205.h @@ -0,0 +1,41 @@ +/*! \defgroup gsm29205 3GPP TS 29.205 + * @{ + * \file gsm29205.h */ +/* + * (C) 2018 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 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, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#pragma once + +#include + +#include + +#define OSMO_GCR_MIN_LEN 13 + +/*! Parsed representation of Global Call Reference, 3GPP TS 29.205 Table B 2.1.9.1. */ +struct osmo_gcr_parsed { + uint8_t net[5]; /** Network ID, ITU-T Q.1902.3 */ + uint8_t net_len; /** length (3-5 octets) of gsm29205_gcr#net */ + uint16_t node; /** Node ID */ + uint8_t cr[5]; /** Call Reference ID */ +}; + +uint8_t osmo_enc_gcr(struct msgb *msg, const struct osmo_gcr_parsed *g); +int osmo_dec_gcr(struct osmo_gcr_parsed *gcr, const uint8_t *elem, uint8_t len); -- cgit v1.2.3