libosmo-sigtran 2.0.0.50-b59d
Osmocom SIGTRAN library
xua_internal.h
Go to the documentation of this file.
1#pragma once
2
3#include <osmocom/core/tdef.h>
5#include "xua_msg.h"
6
7#define M3UA_MSG_SIZE 2048
8#define M3UA_MSG_HEADROOM 512
9
10struct osmo_sccp_addr;
11struct m3ua_data_hdr;
12
14 const struct xua_msg_part *param);
15int sua_addr_parse(struct osmo_sccp_addr *out, struct xua_msg *xua, uint16_t iei);
16
17int sua_parse_gt(struct osmo_sccp_gt *gt, const uint8_t *data, unsigned int datalen);
18
19struct xua_msg *osmo_sccp_to_xua(struct msgb *msg);
20struct msgb *osmo_sua_to_sccp(struct xua_msg *xua);
21
22int sua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg);
23
24int sua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
25void sua_tx_snm_available(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx,
26 const uint32_t *aff_pc, unsigned int num_aff_pc, const uint32_t *aff_ssn,
27 const uint32_t *smi, const char *info_string, bool available);
28void sua_tx_snm_congestion(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx,
29 const uint32_t *aff_pc, unsigned int num_aff_pc, const uint32_t *ssn,
30 const uint8_t cong_level, const char *info_string);
31void sua_tx_dupu(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx,
32 uint32_t dpc, uint16_t user, uint16_t cause, const char *info_str);
33
34struct osmo_mtp_prim *m3ua_to_xfer_ind(struct xua_msg *xua);
35int m3ua_hmdc_rx_from_l2(struct osmo_ss7_instance *inst, struct xua_msg *xua);
36int m3ua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
37void m3ua_tx_snm_available(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx,
38 const uint32_t *aff_pc, unsigned int num_aff_pc,
39 const char *info_string, bool available);
40void m3ua_tx_snm_congestion(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx,
41 const uint32_t *aff_pc, unsigned int num_aff_pc,
42 const uint32_t *concerned_dpc, const uint8_t *cong_level,
43 const char *info_string);
44void m3ua_tx_dupu(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx,
45 uint32_t dpc, uint16_t user, uint16_t cause, const char *info_str);
46
47void xua_snm_rx_daud(struct osmo_ss7_asp *asp, struct xua_msg *xua);
48void xua_snm_rx_duna(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua);
49void xua_snm_rx_dava(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua);
50void xua_snm_rx_dupu(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua);
51void xua_snm_rx_scon(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua);
52int m3ua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg);
53
54struct msgb *m3ua_msgb_alloc(const char *name);
55struct xua_msg *m3ua_xfer_from_data(const struct m3ua_data_hdr *data_hdr,
56 const uint8_t *data, unsigned int data_len);
57struct m3ua_data_hdr *data_hdr_from_m3ua(struct xua_msg *xua);
59 const struct m3ua_data_hdr *mdh);
61 const struct osmo_mtp_transfer_param *param);
62
63
64extern const struct xua_msg_class m3ua_msg_class_mgmt;
65extern const struct xua_msg_class m3ua_msg_class_snm;
66extern const struct xua_msg_class m3ua_msg_class_rkm;
67extern const struct xua_msg_class m3ua_msg_class_aspsm;
68extern const struct xua_msg_class m3ua_msg_class_asptm;
69
70extern const struct value_string m3ua_err_names[];
71extern const struct value_string m3ua_ntfy_type_names[];
72extern const struct value_string m3ua_ntfy_stchg_names[];
73extern const struct value_string m3ua_ntfy_other_names[];
74
75struct xua_msg *m3ua_encode_notify(const struct osmo_xlm_prim_notify *npar);
76int m3ua_decode_notify(struct osmo_xlm_prim_notify *npar, void *ctx,
77 const struct xua_msg *xua);
78int m3ua_rx_rkm(struct osmo_ss7_asp *asp, struct xua_msg *xua);
80
82 enum osmo_prim_operation op);
83
84void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim);
86 enum osmo_xlm_prim_type prim_type,
87 enum osmo_prim_operation op);
88
89void xua_snm_pc_available(struct osmo_ss7_as *as, const uint32_t *aff_pc,
90 unsigned int num_aff_pc, const char *info_str, bool available);
91
93 /* 0 kept unused on purpose since it's handled specially by osmo_fsm */
98 /* This must remain the last item: */
101
102extern const struct osmo_tdef ss7_asp_lm_timer_defaults[SS7_ASP_LM_TIMERS_LEN];
103
104extern const struct value_string ss7_asp_lm_timer_names[];
105static inline const char *ss7_asp_lm_timer_name(enum ss7_asp_lm_timer val)
106{ return get_value_string(ss7_asp_lm_timer_names, val); }
107
108extern struct osmo_fsm xua_default_lm_fsm;
109extern const struct value_string m3ua_rkm_reg_status_vals[];
110extern const struct value_string m3ua_rkm_dereg_status_vals[];
111
112#define CS7_STR "ITU-T Signaling System 7\n"
113#define PC_STR "Point Code\n"
114#define INST_STR "An instance of the SS7 stack\n"
115
116int xua_as_transmit_msg(struct osmo_ss7_as *as, struct msgb *msg);
117
118int xua_find_as_for_asp(struct osmo_ss7_as **as, const struct osmo_ss7_asp *asp,
119 const struct xua_msg_part *rctx_ie);
120
121int ipa_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
122int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg, uint8_t sls);
123struct osmo_ss7_as *ipa_find_as_for_asp(struct osmo_ss7_asp *asp);
124
125int osmo_isup_party_parse(char *out_digits, const uint8_t *in,
126 unsigned int in_num_bytes, bool odd);
128 const uint8_t *addr, unsigned int addrlen);
129int osmo_sccp_addr_encode(struct msgb *msg, const struct osmo_sccp_addr *in);
130
131int ss7_asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg);
uint8_t sls
Definition: m3ua.h:5
uint32_t dpc
Definition: m3ua.h:1
uint8_t smi
Definition: sccp_scmg.h:3
osmo_xlm_prim_type
Definition: sigtran_sap.h:13
Definition: m3ua.h:95
Definition: mtp_sap.h:56
Definition: mtp_sap.h:36
Definition: sccp_sap.h:183
Definition: sccp_sap.h:175
Definition: ss7_as.h:31
Definition: ss7_asp.h:28
Definition: ss7_instance.h:20
Definition: sigtran_sap.h:37
Definition: sigtran_sap.h:66
Definition: xua_msg.h:48
Definition: xua_msg.h:38
Definition: xua_msg.h:31
const struct value_string m3ua_rkm_reg_status_vals[]
Definition: xua_rkm.c:40
const struct value_string m3ua_ntfy_type_names[]
Definition: m3ua.c:82
void xua_snm_rx_scon(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua)
Definition: xua_snm.c:461
const struct value_string m3ua_err_names[]
Definition: m3ua.c:58
struct osmo_ss7_as * ipa_find_as_for_asp(struct osmo_ss7_asp *asp)
Definition: ipa.c:136
void xua_snm_rx_dupu(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua)
Definition: xua_snm.c:427
int sua_addr_parse(struct osmo_sccp_addr *out, struct xua_msg *xua, uint16_t iei)
parse SCCP address from given xUA message IE
Definition: sua.c:509
int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg, uint8_t sls)
process M3UA message received from socket
Definition: ipa.c:300
void m3ua_tx_dupu(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx, uint32_t dpc, uint16_t user, uint16_t cause, const char *info_str)
Transmit SSNM DUPU message indicating user unavailability.
Definition: m3ua.c:944
int xua_find_as_for_asp(struct osmo_ss7_as **as, const struct osmo_ss7_asp *asp, const struct xua_msg_part *rctx_ie)
Find the AS for given ASP + optional routing context IE.
Definition: xua_shared.c:71
struct osmo_xlm_prim * xua_xlm_prim_alloc(enum osmo_xlm_prim_type prim_type, enum osmo_prim_operation op)
Definition: xua_asp_fsm.c:97
struct xua_msg * m3ua_xfer_from_data(const struct m3ua_data_hdr *data_hdr, const uint8_t *data, unsigned int data_len)
Definition: m3ua.c:323
void m3ua_tx_snm_available(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx, const uint32_t *aff_pc, unsigned int num_aff_pc, const char *info_string, bool available)
Transmit SSNM DUNA/DAVA message indicating [un]availability of certain point code[s].
Definition: m3ua.c:887
struct osmo_mtp_prim * m3ua_to_xfer_ind(struct xua_msg *xua)
Definition: osmo_ss7_hmrt.c:47
void sua_tx_snm_available(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx, const uint32_t *aff_pc, unsigned int num_aff_pc, const uint32_t *aff_ssn, const uint32_t *smi, const char *info_string, bool available)
Transmit SSNM DUNA/DAVA message indicating [un]availability of certain point code[s].
Definition: sua.c:873
int m3ua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua)
Send a given xUA message via a given M3UA Application Server.
Definition: m3ua.c:513
const struct value_string m3ua_ntfy_stchg_names[]
Definition: m3ua.c:88
const struct xua_msg_class m3ua_msg_class_snm
Definition: m3ua.c:178
int m3ua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg)
process M3UA message received from socket
Definition: m3ua.c:724
int osmo_isup_party_parse(char *out_digits, const uint8_t *in, unsigned int in_num_bytes, bool odd)
Parse ISUP style address of BCD digets.
Definition: sccp2sua.c:73
struct m3ua_data_hdr * data_hdr_from_m3ua(struct xua_msg *xua)
Definition: m3ua.c:541
int m3ua_decode_notify(struct osmo_xlm_prim_notify *npar, void *ctx, const struct xua_msg *xua)
Definition: m3ua.c:430
int ipa_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua)
Send a given xUA message via a given IPA "Application Server".
Definition: ipa.c:60
void xua_snm_rx_dava(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua)
Definition: xua_snm.c:392
void xua_rkm_cleanup_dyn_as_for_asp(struct osmo_ss7_asp *asp)
Definition: xua_rkm.c:596
const struct osmo_tdef ss7_asp_lm_timer_defaults[SS7_ASP_LM_TIMERS_LEN]
Definition: xua_default_lm_fsm.c:86
const struct value_string m3ua_rkm_dereg_status_vals[]
Definition: xua_rkm.c:57
int ss7_asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg)
Definition: osmo_ss7_asp.c:1175
static const char * ss7_asp_lm_timer_name(enum ss7_asp_lm_timer val)
Definition: xua_internal.h:105
int sua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg)
process SUA message received from socket
Definition: sua.c:684
void mtp_xfer_param_to_m3ua_dh(struct m3ua_data_hdr *mdh, const struct osmo_mtp_transfer_param *param)
Definition: m3ua.c:291
struct osmo_fsm xua_default_lm_fsm
Definition: xua_default_lm_fsm.c:380
void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim)
Definition: xua_asp_fsm.c:112
int sua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua)
Send a given xUA message via a given SUA Application Server.
Definition: sua.c:308
void sua_tx_snm_congestion(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx, const uint32_t *aff_pc, unsigned int num_aff_pc, const uint32_t *ssn, const uint8_t cong_level, const char *info_string)
Transmit SSNM SCON message indicating congestion.
Definition: sua.c:897
const struct xua_msg_class m3ua_msg_class_rkm
Definition: m3ua.c:262
int sua_addr_parse_part(struct osmo_sccp_addr *out, const struct xua_msg_part *param)
parse SCCP address from given xUA message part
Definition: sua.c:377
int m3ua_hmdc_rx_from_l2(struct osmo_ss7_instance *inst, struct xua_msg *xua)
Definition: osmo_ss7_hmrt.c:284
struct xua_msg * m3ua_encode_notify(const struct osmo_xlm_prim_notify *npar)
Definition: m3ua.c:401
const struct value_string ss7_asp_lm_timer_names[]
Definition: xua_default_lm_fsm.c:99
const struct xua_msg_class m3ua_msg_class_aspsm
Definition: m3ua.c:201
const struct xua_msg_class m3ua_msg_class_asptm
Definition: m3ua.c:214
struct xua_msg * osmo_sccp_to_xua(struct msgb *msg)
convert SCCP message to a SUA message
Definition: sccp2sua.c:1667
const struct value_string m3ua_ntfy_other_names[]
Definition: m3ua.c:96
void xua_snm_pc_available(struct osmo_ss7_as *as, const uint32_t *aff_pc, unsigned int num_aff_pc, const char *info_str, bool available)
Definition: xua_snm.c:172
int m3ua_rx_rkm(struct osmo_ss7_asp *asp, struct xua_msg *xua)
Definition: xua_rkm.c:536
struct msgb * osmo_sua_to_sccp(struct xua_msg *xua)
convert parsed SUA message to SCCP message
Definition: sccp2sua.c:1781
struct msgb * m3ua_msgb_alloc(const char *name)
Definition: m3ua.c:315
void m3ua_dh_to_xfer_param(struct osmo_mtp_transfer_param *param, const struct m3ua_data_hdr *mdh)
Definition: m3ua.c:303
const struct xua_msg_class m3ua_msg_class_mgmt
Definition: m3ua.c:232
ss7_asp_lm_timer
Definition: xua_internal.h:92
@ SS7_ASP_LM_T_WAIT_ASP_UP
Definition: xua_internal.h:94
@ SS7_ASP_LM_TIMERS_LEN
Definition: xua_internal.h:99
@ SS7_ASP_LM_T_WAIT_NOTIFY
Definition: xua_internal.h:95
@ SS7_ASP_LM_T_WAIT_RK_REG_RESP
Definition: xua_internal.h:97
@ SS7_ASP_LM_T_WAIT_NOTIY_RKM
Definition: xua_internal.h:96
int osmo_sccp_addr_encode(struct msgb *msg, const struct osmo_sccp_addr *in)
encode a SCCP address from parsed format to wire format
Definition: sccp2sua.c:225
void m3ua_tx_snm_congestion(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx, const uint32_t *aff_pc, unsigned int num_aff_pc, const uint32_t *concerned_dpc, const uint8_t *cong_level, const char *info_string)
Transmit SSNM SCON message indicating congestion.
Definition: m3ua.c:911
int sua_parse_gt(struct osmo_sccp_gt *gt, const uint8_t *data, unsigned int datalen)
Decode SUA Global Title according to RFC3868 Section 3.10.2.3.
Definition: sua.c:340
int osmo_sccp_addr_parse(struct osmo_sccp_addr *out, const uint8_t *addr, unsigned int addrlen)
Parse wire-encoded SCCP address into osmo_sccp_addr.
Definition: sccp2sua.c:119
void xua_asp_send_xlm_prim_simple(struct osmo_ss7_asp *asp, enum osmo_xlm_prim_type prim_type, enum osmo_prim_operation op)
Definition: xua_asp_fsm.c:127
void xua_snm_rx_duna(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua)
Definition: xua_snm.c:357
void sua_tx_dupu(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx, uint32_t dpc, uint16_t user, uint16_t cause, const char *info_str)
Transmit SSNM DUPU message indicating user unavailability.
Definition: sua.c:924
void xua_snm_rx_daud(struct osmo_ss7_asp *asp, struct xua_msg *xua)
Definition: xua_snm.c:312
int xua_as_transmit_msg(struct osmo_ss7_as *as, struct msgb *msg)
Definition: xua_as_fsm.c:123
uint8_t data[0]
Definition: xua_types.h:5