libosmo-sigtran  1.9.0.4-dc82
Osmocom SIGTRAN library
xua_internal.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <osmocom/core/tdef.h>
6 
7 #define M3UA_MSG_SIZE 2048
8 #define M3UA_MSG_HEADROOM 512
9 
10 struct osmo_sccp_addr;
11 struct m3ua_data_hdr;
12 
13 int sua_addr_parse_part(struct osmo_sccp_addr *out,
14  const struct xua_msg_part *param);
15 int sua_addr_parse(struct osmo_sccp_addr *out, struct xua_msg *xua, uint16_t iei);
16 
17 int sua_parse_gt(struct osmo_sccp_gt *gt, const uint8_t *data, unsigned int datalen);
18 
19 struct xua_msg *osmo_sccp_to_xua(struct msgb *msg);
20 struct msgb *osmo_sua_to_sccp(struct xua_msg *xua);
21 
22 int sua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg);
23 
24 int sua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
25 void 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);
28 void 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);
31 void 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 
34 struct osmo_mtp_prim *m3ua_to_xfer_ind(struct xua_msg *xua);
35 int m3ua_hmdc_rx_from_l2(struct osmo_ss7_instance *inst, struct xua_msg *xua);
36 int m3ua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
37 void 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);
40 void 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);
44 void 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 
47 void xua_snm_rx_daud(struct osmo_ss7_asp *asp, struct xua_msg *xua);
48 void xua_snm_rx_duna(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua);
49 void xua_snm_rx_dava(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua);
50 void xua_snm_rx_dupu(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua);
51 void xua_snm_rx_scon(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua);
52 int m3ua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg);
53 
54 struct msgb *m3ua_msgb_alloc(const char *name);
55 struct xua_msg *m3ua_xfer_from_data(const struct m3ua_data_hdr *data_hdr,
56  const uint8_t *data, unsigned int data_len);
57 struct 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 
64 extern const struct xua_msg_class m3ua_msg_class_mgmt;
65 extern const struct xua_msg_class m3ua_msg_class_snm;
66 extern const struct xua_msg_class m3ua_msg_class_rkm;
67 extern const struct xua_msg_class m3ua_msg_class_aspsm;
68 extern const struct xua_msg_class m3ua_msg_class_asptm;
69 
70 extern const struct value_string m3ua_err_names[];
71 extern const struct value_string m3ua_ntfy_type_names[];
72 extern const struct value_string m3ua_ntfy_stchg_names[];
73 extern const struct value_string m3ua_ntfy_other_names[];
74 
75 struct xua_msg *m3ua_encode_notify(const struct osmo_xlm_prim_notify *npar);
76 int m3ua_decode_notify(struct osmo_xlm_prim_notify *npar, void *ctx,
77  const struct xua_msg *xua);
78 int m3ua_rx_rkm(struct osmo_ss7_asp *asp, struct xua_msg *xua);
80 
82  enum osmo_prim_operation op);
83 
84 void 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 
89 void 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: */
100 };
101 
102 extern const struct osmo_tdef ss7_asp_lm_timer_defaults[SS7_ASP_LM_TIMERS_LEN];
103 
104 extern const struct value_string ss7_asp_lm_timer_names[];
105 static 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 
108 extern struct osmo_fsm xua_default_lm_fsm;
109 extern const struct value_string m3ua_rkm_reg_status_vals[];
110 extern 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 
116 int xua_as_transmit_msg(struct osmo_ss7_as *as, struct msgb *msg);
117 
118 int 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 
121 int ipa_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
122 int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg, uint8_t sls);
123 struct osmo_ss7_as *ipa_find_as_for_asp(struct osmo_ss7_asp *asp);
124 
125 int osmo_isup_party_parse(char *out_digits, const uint8_t *in,
126  unsigned int in_num_bytes, bool odd);
127 int osmo_sccp_addr_parse(struct osmo_sccp_addr *out,
128  const uint8_t *addr, unsigned int addrlen);
129 int osmo_sccp_addr_encode(struct msgb *msg, const struct osmo_sccp_addr *in);
130 
131 int ss7_asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg);
uint32_t dpc
Definition: m3ua.h:560
struct msgb * osmo_sua_to_sccp(struct xua_msg *xua)
convert parsed SUA message to SCCP message
Definition: sccp2sua.c:1781
const struct value_string ss7_asp_lm_timer_names[]
Definition: xua_default_lm_fsm.c:96
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:866
int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg, uint8_t sls)
process M3UA message received from socket
Definition: ipa.c:298
struct msgb * m3ua_msgb_alloc(const char *name)
Definition: m3ua.c:313
void xua_snm_rx_dupu(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua)
Definition: xua_snm.c:424
void xua_snm_rx_scon(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua)
Definition: xua_snm.c:458
int m3ua_rx_rkm(struct osmo_ss7_asp *asp, struct xua_msg *xua)
Definition: xua_rkm.c:527
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:305
Definition: xua_internal.h:97
const struct value_string m3ua_err_names[]
Definition: m3ua.c:56
ss7_asp_lm_timer
Definition: xua_internal.h:92
struct osmo_fsm xua_default_lm_fsm
Definition: xua_default_lm_fsm.c:377
struct xua_msg * osmo_sccp_to_xua(struct msgb *msg)
convert SCCP message to a SUA message
Definition: sccp2sua.c:1667
Definition: xua_internal.h:94
struct xua_msg * m3ua_encode_notify(const struct osmo_xlm_prim_notify *npar)
Definition: m3ua.c:378
struct m3ua_data_hdr * data_hdr_from_m3ua(struct xua_msg *xua)
Definition: m3ua.c:518
int m3ua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg)
process M3UA message received from socket
Definition: m3ua.c:688
struct osmo_ss7_as * ipa_find_as_for_asp(struct osmo_ss7_asp *asp)
Definition: ipa.c:134
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:68
int sua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg)
process SUA message received from socket
Definition: sua.c:677
uint8_t sls
Definition: m3ua.h:564
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:917
Definition: xua_msg.h:38
Definition: sigtran_sap.h:66
int xua_as_transmit_msg(struct osmo_ss7_as *as, struct msgb *msg)
Definition: xua_as_fsm.c:152
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:321
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:890
uint8_t smi
Definition: sccp_scmg.h:41
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:93
const struct xua_msg_class m3ua_msg_class_asptm
Definition: m3ua.c:212
int ss7_asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg)
Definition: osmo_ss7_asp.c:1172
void xua_rkm_cleanup_dyn_as_for_asp(struct osmo_ss7_asp *asp)
Definition: xua_rkm.c:587
void xua_snm_rx_daud(struct osmo_ss7_asp *asp, struct xua_msg *xua)
Definition: xua_snm.c:309
const struct osmo_tdef ss7_asp_lm_timer_defaults[SS7_ASP_LM_TIMERS_LEN]
Definition: xua_default_lm_fsm.c:83
void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim)
Definition: xua_asp_fsm.c:108
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:58
struct osmo_mtp_prim * m3ua_to_xfer_ind(struct xua_msg *xua)
Definition: osmo_ss7_hmrt.c:41
Definition: xua_internal.h:95
const struct xua_msg_class m3ua_msg_class_aspsm
Definition: m3ua.c:199
int m3ua_hmdc_rx_from_l2(struct osmo_ss7_instance *inst, struct xua_msg *xua)
Definition: osmo_ss7_hmrt.c:278
const struct value_string m3ua_ntfy_other_names[]
Definition: m3ua.c:94
const struct xua_msg_class m3ua_msg_class_snm
Definition: m3ua.c:176
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:123
Definition: sigtran_sap.h:37
const struct value_string m3ua_rkm_reg_status_vals[]
Definition: xua_rkm.c:35
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
osmo_xlm_prim_type
Definition: sigtran_sap.h:13
static const char * ss7_asp_lm_timer_name(enum ss7_asp_lm_timer val)
Definition: xua_internal.h:105
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:490
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:851
Definition: xua_msg.h:48
Definition: m3ua.h:95
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
Definition: xua_internal.h:99
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:908
const struct xua_msg_class m3ua_msg_class_mgmt
Definition: m3ua.c:230
const struct value_string m3ua_rkm_dereg_status_vals[]
Definition: xua_rkm.c:52
const struct xua_msg_class m3ua_msg_class_rkm
Definition: m3ua.c:260
Definition: mtp_sap.h:36
void xua_snm_rx_duna(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua)
Definition: xua_snm.c:354
Definition: osmo_ss7.h:390
Definition: sccp_sap.h:183
Definition: sccp_sap.h:175
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:337
const struct value_string m3ua_ntfy_type_names[]
Definition: m3ua.c:80
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:374
void xua_snm_rx_dava(struct osmo_ss7_asp *asp, struct osmo_ss7_as *as, struct xua_msg *xua)
Definition: xua_snm.c:389
void mtp_xfer_param_to_m3ua_dh(struct m3ua_data_hdr *mdh, const struct osmo_mtp_transfer_param *param)
Definition: m3ua.c:289
Definition: xua_msg.h:31
uint8_t data[0]
Definition: xua_types.h:72
Definition: osmo_ss7.h:73
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:502
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:875
const struct value_string m3ua_ntfy_stchg_names[]
Definition: m3ua.c:86
void m3ua_dh_to_xfer_param(struct osmo_mtp_transfer_param *param, const struct m3ua_data_hdr *mdh)
Definition: m3ua.c:301
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:169
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
Definition: xua_internal.h:96
Definition: osmo_ss7.h:300
Definition: mtp_sap.h:56
int m3ua_decode_notify(struct osmo_xlm_prim_notify *npar, void *ctx, const struct xua_msg *xua)
Definition: m3ua.c:407