summaryrefslogtreecommitdiffstats
path: root/include/osmocom/gsm/gsm29205.h
blob: 95754567c3b919b59a49a2ef8c717ad1ae2ad810 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*! \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 <osmocom/core/msgb.h>

#include <stdint.h>

#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) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
int osmo_dec_gcr(struct osmo_gcr_parsed *gcr, const uint8_t *elem, uint8_t len) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
bool osmo_gcr_eq(const struct osmo_gcr_parsed *gcr1, const struct osmo_gcr_parsed *gcr2);