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/osmocom/gsm/gsm29205.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 include/osmocom/gsm/gsm29205.h (limited to 'include/osmocom/gsm/gsm29205.h') 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