libosmo-sigtran 2.2.1.64-e866 Osmocom SIGTRAN library

mtp_sap.h
Go to the documentation of this file.
1#pragma once
2
3/* MTP User SAP description in accordance with ITU Q.701 */
4
5/* (C) 2017 by Harald Welte <laforge@gnumonks.org>
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#include <stdint.h>
24#include <osmocom/core/prim.h>
25#include <osmocom/sigtran/sigtran_sap.h>
26
27 enum osmo_mtp_prim_type {
28 OSMO_MTP_PRIM_TRANSFER,
29 OSMO_MTP_PRIM_PAUSE,
30 OSMO_MTP_PRIM_RESUME,
31 OSMO_MTP_PRIM_STATUS,
32};
33 extern const struct value_string osmo_mtp_prim_type_names[];
34 static inline const char *osmo_mtp_prim_type_name(enum osmo_mtp_prim_type val)
35{
36 return get_value_string(osmo_mtp_prim_type_names, val);
37}
38
39/* ITU Q.704 14.2 Service information octet. See enum mtp_si_ni00 in mtp.h. */
40#define MTP_SIO(service, net_ind) ((((net_ind) & 0x3) << 6) | ((service) & 0xF))
41
42 struct osmo_mtp_transfer_param {
43 uint32_t opc;
44 uint32_t dpc;
45 uint8_t sls;
46 uint8_t sio;
47};
48
49 struct osmo_mtp_pause_param {
50 uint32_t affected_dpc;
51};
52
53 struct osmo_mtp_resume_param {
54 uint32_t affected_dpc;
55};
56
57 struct osmo_mtp_status_param {
58 uint32_t affected_dpc;
59 uint32_t cause; /* enum mtp_unavail_cause */
60 bool congestion_level_present;
61 uint8_t congestion_level;
62};
63
64 struct osmo_mtp_prim {
65 struct osmo_prim_hdr oph;
66 union {
67 struct osmo_mtp_transfer_param transfer;
68 struct osmo_mtp_pause_param pause;
69 struct osmo_mtp_resume_param resume;
70 struct osmo_mtp_status_param status;
71 } u;
72};
73
74#define msgb_mtp_prim(msg) ((struct osmo_mtp_prim *)(msg)->l1h)
75
76 char *osmo_mtp_prim_name(const struct osmo_prim_hdr *oph);
77
78 struct osmo_mtp_prim *osmo_mtp_prim_xfer_req_prepend(const struct osmo_mtp_transfer_param *param,
79 struct msgb *msg);
osmo_mtp_prim_type_names
const struct value_string osmo_mtp_prim_type_names[]
Definition: mtp_sap.c:35
osmo_mtp_prim_xfer_req_prepend
struct osmo_mtp_prim * osmo_mtp_prim_xfer_req_prepend(const struct osmo_mtp_transfer_param *param, struct msgb *msg)
Wrap MTP payload into an MTP-TRANSFER.req primitive.
Definition: mtp_sap.c:147
osmo_mtp_prim_type_name
static const char * osmo_mtp_prim_type_name(enum osmo_mtp_prim_type val)
Definition: mtp_sap.h:34
osmo_mtp_prim_type
osmo_mtp_prim_type
Definition: mtp_sap.h:27
OSMO_MTP_PRIM_RESUME
@ OSMO_MTP_PRIM_RESUME
Definition: mtp_sap.h:30
OSMO_MTP_PRIM_TRANSFER
@ OSMO_MTP_PRIM_TRANSFER
Definition: mtp_sap.h:28
OSMO_MTP_PRIM_PAUSE
@ OSMO_MTP_PRIM_PAUSE
Definition: mtp_sap.h:29
OSMO_MTP_PRIM_STATUS
@ OSMO_MTP_PRIM_STATUS
Definition: mtp_sap.h:31
osmo_mtp_prim_name
char * osmo_mtp_prim_name(const struct osmo_prim_hdr *oph)
Definition: mtp_sap.c:60
sigtran_sap.h
osmo_mtp_pause_param
Definition: mtp_sap.h:49
osmo_mtp_pause_param::affected_dpc
uint32_t affected_dpc
Definition: mtp_sap.h:50
osmo_mtp_prim
Definition: mtp_sap.h:64
osmo_mtp_prim::status
struct osmo_mtp_status_param status
Definition: mtp_sap.h:70
osmo_mtp_prim::resume
struct osmo_mtp_resume_param resume
Definition: mtp_sap.h:69
osmo_mtp_prim::u
union osmo_mtp_prim::@0 u
osmo_mtp_prim::transfer
struct osmo_mtp_transfer_param transfer
Definition: mtp_sap.h:67
osmo_mtp_prim::pause
struct osmo_mtp_pause_param pause
Definition: mtp_sap.h:68
osmo_mtp_prim::oph
struct osmo_prim_hdr oph
Definition: mtp_sap.h:65
osmo_mtp_resume_param
Definition: mtp_sap.h:53
osmo_mtp_resume_param::affected_dpc
uint32_t affected_dpc
Definition: mtp_sap.h:54
osmo_mtp_status_param
Definition: mtp_sap.h:57
osmo_mtp_status_param::cause
uint32_t cause
Definition: mtp_sap.h:59
osmo_mtp_status_param::affected_dpc
uint32_t affected_dpc
Definition: mtp_sap.h:58
osmo_mtp_status_param::congestion_level_present
bool congestion_level_present
Definition: mtp_sap.h:60
osmo_mtp_status_param::congestion_level
uint8_t congestion_level
Definition: mtp_sap.h:61
osmo_mtp_transfer_param
Definition: mtp_sap.h:42
osmo_mtp_transfer_param::dpc
uint32_t dpc
Definition: mtp_sap.h:44
osmo_mtp_transfer_param::opc
uint32_t opc
Definition: mtp_sap.h:43
osmo_mtp_transfer_param::sls
uint8_t sls
Definition: mtp_sap.h:45
osmo_mtp_transfer_param::sio
uint8_t sio
Definition: mtp_sap.h:46