blob: b2174b3a4565f1ca1a6c814f08d995ac6744f221 [file] [log] [blame]
Neels Hofmeyrc6848f42020-09-18 18:00:50 +02001/*! \addtogroup bsslap
2 * @{
3 * \file bsslap.h
4 * Message encoding and decoding for 3GPP TS 48.071 BSS LCS Assistance Protocol (BSSLAP).
5 */
6/*
7 * (C) 2020 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
8 * All Rights Reserved
9 *
10 * Author: Neels Hofmeyr <neels@hofmeyr.de>
11 *
12 * SPDX-License-Identifier: GPL-2.0+
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 *
28 */
29#pragma once
30
31#include <osmocom/gsm/protocol/gsm_48_071.h>
32#include <osmocom/gsm/protocol/gsm_49_031.h>
33
34struct msgb;
35
36struct osmo_bsslap_err {
37 int rc;
38 enum bsslap_msgt msg_type;
39 enum bsslap_iei iei;
40 enum lcs_cause cause;
41 char *logmsg;
42};
43
44extern const struct value_string osmo_bsslap_msgt_names[];
45static inline const char *osmo_bsslap_msgt_name(enum bsslap_msgt val)
46{ return get_value_string(osmo_bsslap_msgt_names, val); }
47
48extern const struct value_string osmo_bsslap_iei_names[];
49static inline const char *osmo_bsslap_iei_name(enum bsslap_iei val)
50{ return get_value_string(osmo_bsslap_iei_names, val); }
51
52int osmo_bsslap_enc(struct msgb *msg, const struct bsslap_pdu *pdu);
53int osmo_bsslap_dec(struct bsslap_pdu *pdu,
54 struct osmo_bsslap_err **err, void *err_ctx,
55 const uint8_t *data, size_t len);
56
57/*! @} */