libosmo-sigtran  1.3.0
Osmocom SIGTRAN library
xua_internal.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 struct osmo_sccp_addr;
7 struct m3ua_data_hdr;
8 
9 int sua_addr_parse_part(struct osmo_sccp_addr *out,
10  const struct xua_msg_part *param);
11 int sua_addr_parse(struct osmo_sccp_addr *out, struct xua_msg *xua, uint16_t iei);
12 
13 int sua_parse_gt(struct osmo_sccp_gt *gt, const uint8_t *data, unsigned int datalen);
14 
15 struct xua_msg *osmo_sccp_to_xua(struct msgb *msg);
16 struct msgb *osmo_sua_to_sccp(struct xua_msg *xua);
17 
18 int sua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg);
19 
20 int sua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
21 
22 struct osmo_mtp_prim *m3ua_to_xfer_ind(struct xua_msg *xua);
23 int m3ua_hmdc_rx_from_l2(struct osmo_ss7_instance *inst, struct xua_msg *xua);
24 int m3ua_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
25 int m3ua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg);
26 
27 struct msgb *m3ua_msgb_alloc(const char *name);
28 struct xua_msg *m3ua_xfer_from_data(const struct m3ua_data_hdr *data_hdr,
29  const uint8_t *data, unsigned int data_len);
30 struct m3ua_data_hdr *data_hdr_from_m3ua(struct xua_msg *xua);
32  const struct m3ua_data_hdr *mdh);
34  const struct osmo_mtp_transfer_param *param);
35 
36 
37 extern const struct xua_msg_class m3ua_msg_class_mgmt;
38 extern const struct xua_msg_class m3ua_msg_class_snm;
39 extern const struct xua_msg_class m3ua_msg_class_rkm;
40 extern const struct xua_msg_class m3ua_msg_class_aspsm;
41 extern const struct xua_msg_class m3ua_msg_class_asptm;
42 
43 extern const struct value_string m3ua_err_names[];
44 extern const struct value_string m3ua_ntfy_type_names[];
45 extern const struct value_string m3ua_ntfy_stchg_names[];
46 extern const struct value_string m3ua_ntfy_other_names[];
47 
48 struct xua_msg *m3ua_encode_notify(const struct osmo_xlm_prim_notify *npar);
49 int m3ua_decode_notify(struct osmo_xlm_prim_notify *npar, void *ctx,
50  const struct xua_msg *xua);
51 int m3ua_rx_rkm(struct osmo_ss7_asp *asp, struct xua_msg *xua);
53 
55  enum osmo_prim_operation op);
56 
57 void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim);
59  enum osmo_xlm_prim_type prim_type,
60  enum osmo_prim_operation op);
61 
62 extern struct osmo_fsm xua_default_lm_fsm;
63 extern const struct value_string m3ua_rkm_reg_status_vals[];
64 extern const struct value_string m3ua_rkm_dereg_status_vals[];
65 
66 #define CS7_STR "ITU-T Signaling System 7\n"
67 #define PC_STR "Point Code\n"
68 #define INST_STR "An instance of the SS7 stack\n"
69 
70 int xua_as_transmit_msg(struct osmo_ss7_as *as, struct msgb *msg);
71 
72 
73 int ipa_tx_xua_as(struct osmo_ss7_as *as, struct xua_msg *xua);
74 int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg);
75 
76 int osmo_isup_party_parse(char *out_digits, const uint8_t *in,
77  unsigned int in_num_bytes, bool odd);
78 int osmo_sccp_addr_parse(struct osmo_sccp_addr *out,
79  const uint8_t *addr, unsigned int addrlen);
80 int osmo_sccp_addr_encode(struct msgb *msg, const struct osmo_sccp_addr *in);
81 
82 int ss7_asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg);
T_WAIT_NOTIFY
@ T_WAIT_NOTIFY
Definition: xua_default_lm_fsm.c:81
sua_addr_parse
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:492
data_hdr_from_m3ua
struct m3ua_data_hdr * data_hdr_from_m3ua(struct xua_msg *xua)
Definition: m3ua.c:518
osmo_ss7_asp_use_default_lm
int osmo_ss7_asp_use_default_lm(struct osmo_ss7_asp *asp, int log_level)
Definition: xua_default_lm_fsm.c:367
lm_wait_asp_up
static void lm_wait_asp_up(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_default_lm_fsm.c:148
M3UA_RKM_REG_SUCCESS
@ M3UA_RKM_REG_SUCCESS
Definition: m3ua.h:121
xua_default_lm_fsm
struct osmo_fsm xua_default_lm_fsm
Definition: xua_default_lm_fsm.c:331
osmo_xlm_prim::u
union osmo_xlm_prim::@31 u
osmo_xlm_prim::oph
struct osmo_prim_hdr oph
Definition: sigtran_sap.h:67
osmo_xlm_prim_notify::status_info
uint16_t status_info
Definition: sigtran_sap.h:40
OSMO_XLM_PRIM_M_SCTP_RELEASE
@ OSMO_XLM_PRIM_M_SCTP_RELEASE
Definition: sigtran_sap.h:15
osmo_ss7_as
Definition: osmo_ss7.h:297
XUA_ASP_E_M_ASP_ACTIVE_REQ
@ XUA_ASP_E_M_ASP_ACTIVE_REQ
Definition: xua_asp_fsm.h:11
XUA_SAP_LM
@ XUA_SAP_LM
Definition: sigtran_sap.h:9
M3UA_NOTIFY_T_STATCHG
#define M3UA_NOTIFY_T_STATCHG
Definition: m3ua.h:107
m3ua_dh_to_xfer_param
void m3ua_dh_to_xfer_param(struct osmo_mtp_transfer_param *param, const struct m3ua_data_hdr *mdh)
Definition: m3ua.c:300
osmo_ss7_as::fi
struct osmo_fsm_inst * fi
AS FSM.
Definition: osmo_ss7.h:303
restart_asp
static void restart_asp(struct osmo_fsm_inst *fi)
Definition: xua_default_lm_fsm.c:124
osmo_sccp_addr
Definition: sccp_sap.h:151
osmo_ss7_routing_key::l_rk_id
uint32_t l_rk_id
Definition: osmo_ss7.h:250
M3UA_NOTIFY_I_AS_INACT
#define M3UA_NOTIFY_I_AS_INACT
Definition: m3ua.h:111
lm_timer
lm_timer
Definition: xua_default_lm_fsm.c:79
xua_xlm_prim_alloc
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:90
m3ua_to_xfer_ind
struct osmo_mtp_prim * m3ua_to_xfer_ind(struct xua_msg *xua)
Definition: osmo_ss7_hmrt.c:40
osmo_xlm_prim::rk_reg
struct osmo_xlm_prim_rk_reg rk_reg
Definition: sigtran_sap.h:71
osmo_xlm_prim_rk_reg::traf_mode
enum osmo_ss7_as_traffic_mode traf_mode
Definition: sigtran_sap.h:53
osmo_xlm_prim_rk_reg::status
uint32_t status
Definition: sigtran_sap.h:56
S_ACTIVE
@ S_ACTIVE
Definition: xua_default_lm_fsm.c:53
lm_timer_cb
static int lm_timer_cb(struct osmo_fsm_inst *fi)
Definition: xua_default_lm_fsm.c:160
ipa_tx_xua_as
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:57
osmo_ss7_asp::lm_priv
void * lm_priv
Definition: osmo_ss7.h:405
osmo_ss7_asp_restart
int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp)
Definition: osmo_ss7.c:1375
lm_event
lm_event
Definition: xua_default_lm_fsm.c:56
osmo_xlm_prim_notify
Definition: sigtran_sap.h:37
osmo_ss7_as::mode
enum osmo_ss7_as_traffic_mode mode
Definition: osmo_ss7.h:316
xua_asp_send_xlm_prim
void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim)
Definition: xua_asp_fsm.c:105
m3ua_msg_class_snm
const struct xua_msg_class m3ua_msg_class_snm
Definition: m3ua.c:175
m3ua_ntfy_other_names
const struct value_string m3ua_ntfy_other_names[]
Definition: m3ua.c:93
m3ua_msgb_alloc
struct msgb * m3ua_msgb_alloc(const char *name)
Definition: m3ua.c:315
sigtran_sap.h
osmo_ss7_asp::inst
struct osmo_ss7_instance * inst
Definition: osmo_ss7.h:384
lm_event_names
static const struct value_string lm_event_names[]
Definition: xua_default_lm_fsm.c:67
osmo_ss7_as::cfg
struct osmo_ss7_as::@25 cfg
OSMO_XLM_PRIM_M_NOTIFY
@ OSMO_XLM_PRIM_M_NOTIFY
Definition: sigtran_sap.h:20
m3ua_rx_rkm
int m3ua_rx_rkm(struct osmo_ss7_asp *asp, struct xua_msg *xua)
Definition: xua_rkm.c:521
data
uint8_t data[0]
Definition: xua_types.h:5
LM_E_NOTIFY_IND
@ LM_E_NOTIFY_IND
Definition: xua_default_lm_fsm.c:59
m3ua_tx_xua_as
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
S_WAIT_ASP_UP
@ S_WAIT_ASP_UP
Definition: xua_default_lm_fsm.c:47
xua_internal.h
osmo_isup_party_parse
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:72
M3UA_NOTIFY_I_AS_PEND
#define M3UA_NOTIFY_I_AS_PEND
Definition: m3ua.h:113
osmo_ss7_instance
Definition: osmo_ss7.h:71
default_layer_manager
static const struct osmo_xua_layer_manager default_layer_manager
Definition: xua_default_lm_fsm.c:363
osmo_ss7_as::asps
struct osmo_ss7_asp * asps[16]
Definition: osmo_ss7.h:328
osmo_xlm_sap_down
int osmo_xlm_sap_down(struct osmo_ss7_asp *asp, struct osmo_prim_hdr *oph)
Definition: xua_rkm.c:554
sua_tx_xua_as
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:302
lm_idle
static void lm_idle(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_default_lm_fsm.c:135
OSMO_XLM_PRIM_M_AS_ACTIVE
@ OSMO_XLM_PRIM_M_AS_ACTIVE
Definition: sigtran_sap.h:26
lm_state
lm_state
Definition: xua_default_lm_fsm.c:43
find_first_as_in_asp
static struct osmo_ss7_as * find_first_as_in_asp(struct osmo_ss7_asp *asp)
Definition: xua_default_lm_fsm.c:90
m3ua_err_names
const struct value_string m3ua_err_names[]
Definition: m3ua.c:55
osmo_ss7_asp::lm
const struct osmo_xua_layer_manager * lm
Definition: osmo_ss7.h:404
osmo_xlm_prim_type
osmo_xlm_prim_type
Definition: sigtran_sap.h:13
m3ua_encode_notify
struct xua_msg * m3ua_encode_notify(const struct osmo_xlm_prim_notify *npar)
Definition: m3ua.c:380
lm_event_map
static const struct osmo_prim_event_map lm_event_map[]
Definition: xua_default_lm_fsm.c:318
lm_active
static void lm_active(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_default_lm_fsm.c:255
sua_rx_msg
int sua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg)
process SUA message received from socket
Definition: sua.c:647
xua_as_transmit_msg
int xua_as_transmit_msg(struct osmo_ss7_as *as, struct msgb *msg)
Definition: xua_as_fsm.c:132
OSMO_XLM_PRIM_M_SCTP_ESTABLISH
@ OSMO_XLM_PRIM_M_SCTP_ESTABLISH
Definition: sigtran_sap.h:14
OSMO_XLM_PRIM_M_RK_REG
@ OSMO_XLM_PRIM_M_RK_REG
Definition: sigtran_sap.h:30
osmo_ss7_asp::name
char * name
Definition: osmo_ss7.h:417
OSMO_XLM_PRIM_M_AS_INACTIVE
@ OSMO_XLM_PRIM_M_AS_INACTIVE
Definition: sigtran_sap.h:27
osmo_sccp_to_xua
struct xua_msg * osmo_sccp_to_xua(struct msgb *msg)
convert SCCP message to a SUA message
Definition: sccp2sua.c:1315
T_WAIT_NOTIFY_RKM
@ T_WAIT_NOTIFY_RKM
Definition: xua_default_lm_fsm.c:82
m3ua_msg_class_mgmt
const struct xua_msg_class m3ua_msg_class_mgmt
Definition: m3ua.c:229
m3ua_rx_msg
int m3ua_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg)
process M3UA message received from socket
Definition: m3ua.c:725
m3ua_rkm_dereg_status_vals
const struct value_string m3ua_rkm_dereg_status_vals[]
Definition: xua_rkm.c:52
osmo_ss7_as_find_by_l_rk_id
struct osmo_ss7_as * osmo_ss7_as_find_by_l_rk_id(struct osmo_ss7_instance *inst, uint32_t l_rk_id)
Find Application Server by given local routing key ID.
Definition: osmo_ss7.c:894
osmo_xua_layer_manager
Definition: osmo_ss7.h:479
m3ua.h
sua_parse_gt
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:334
m3ua_xfer_from_data
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
osmo_mtp_transfer_param
Definition: mtp_sap.h:36
osmo_xua_layer_manager::prim_cb
osmo_prim_cb prim_cb
Definition: osmo_ss7.h:480
sua_addr_parse_part
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:371
osmo_ss7.h
xua_msg_part
Definition: xua_msg.h:38
osmo_ss7_asp::fi
struct osmo_fsm_inst * fi
ASP FSM.
Definition: osmo_ss7.h:387
lm_rkm_reg
static void lm_rkm_reg(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_default_lm_fsm.c:230
lm_states
static const struct osmo_fsm_state lm_states[]
Definition: xua_default_lm_fsm.c:285
M3UA_NOTIFY_I_AS_ACT
#define M3UA_NOTIFY_I_AS_ACT
Definition: m3ua.h:112
S_RKM_REG
@ S_RKM_REG
Definition: xua_default_lm_fsm.c:51
m3ua_msg_class_asptm
const struct xua_msg_class m3ua_msg_class_asptm
Definition: m3ua.c:211
xua_msg.h
osmo_ss7_instance::as_list
struct llist_head as_list
list of osmo_ss7_as
Definition: osmo_ss7.h:77
xua_rkm_cleanup_dyn_as_for_asp
void xua_rkm_cleanup_dyn_as_for_asp(struct osmo_ss7_asp *asp)
Definition: xua_rkm.c:581
ss7_asp_rx_unknown
int ss7_asp_rx_unknown(struct osmo_ss7_asp *asp, int ppid_mux, struct msgb *msg)
Definition: osmo_ss7.c:2187
lm_fsm_priv::asp
struct osmo_ss7_asp * asp
Definition: xua_default_lm_fsm.c:87
m3ua_ntfy_stchg_names
const struct value_string m3ua_ntfy_stchg_names[]
Definition: m3ua.c:85
osmo_sccp_gt
Definition: sccp_sap.h:143
OSMO_XLM_PRIM_M_AS_STATUS
@ OSMO_XLM_PRIM_M_AS_STATUS
Definition: sigtran_sap.h:19
m3ua_msg_class_aspsm
const struct xua_msg_class m3ua_msg_class_aspsm
Definition: m3ua.c:198
ipa_rx_msg
int ipa_rx_msg(struct osmo_ss7_asp *asp, struct msgb *msg)
process M3UA message received from socket
Definition: ipa.c:292
xua_asp_fsm.h
xua_asp_send_xlm_prim_simple
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:120
lm_allstate
static void lm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_default_lm_fsm.c:276
m3ua_hmdc_rx_from_l2
int m3ua_hmdc_rx_from_l2(struct osmo_ss7_instance *inst, struct xua_msg *xua)
Definition: osmo_ss7_hmrt.c:269
osmo_ss7_as::list
struct llist_head list
entry in 'ref osmo_ss7_instance.as_list
Definition: osmo_ss7.h:299
default_lm_prim_cb
static int default_lm_prim_cb(struct osmo_prim_hdr *oph, void *_asp)
Definition: xua_default_lm_fsm.c:344
osmo_xlm_prim::notify
struct osmo_xlm_prim_notify notify
Definition: sigtran_sap.h:69
LM_E_AS_STATUS_IND
@ LM_E_AS_STATUS_IND
Definition: xua_default_lm_fsm.c:62
osmo_sccp_addr_encode
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:224
osmo_ss7_asp::cfg
struct osmo_ss7_asp::@27 cfg
osmo_ss7_as::routing_key
struct osmo_ss7_routing_key routing_key
Definition: osmo_ss7.h:315
osmo_mtp_prim
Definition: mtp_sap.h:56
S_WAIT_NOTIFY
@ S_WAIT_NOTIFY
Definition: xua_default_lm_fsm.c:49
LM_E_SCTP_DISC_IND
@ LM_E_SCTP_DISC_IND
Definition: xua_default_lm_fsm.c:64
m3ua_rkm_reg_status_vals
const struct value_string m3ua_rkm_reg_status_vals[]
Definition: xua_rkm.c:35
m3ua_decode_notify
int m3ua_decode_notify(struct osmo_xlm_prim_notify *npar, void *ctx, const struct xua_msg *xua)
Definition: m3ua.c:409
LM_E_SCTP_EST_IND
@ LM_E_SCTP_EST_IND
Definition: xua_default_lm_fsm.c:57
lm_wait_notify
static void lm_wait_notify(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_default_lm_fsm.c:203
lm_fsm_priv
Definition: xua_default_lm_fsm.c:86
S_IDLE
@ S_IDLE
Definition: xua_default_lm_fsm.c:45
osmo_sccp_addr_parse
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:118
T_WAIT_ASP_UP
@ T_WAIT_ASP_UP
Definition: xua_default_lm_fsm.c:80
osmo_xlm_prim_rk_reg::key
struct osmo_ss7_routing_key key
Definition: sigtran_sap.h:52
handle_reg_conf
static int handle_reg_conf(struct osmo_fsm_inst *fi, uint32_t l_rk_id, uint32_t rctx)
Definition: xua_default_lm_fsm.c:106
osmo_xlm_prim_notify::status_type
uint16_t status_type
Definition: sigtran_sap.h:39
OSMO_XLM_PRIM_M_ASP_UP
@ OSMO_XLM_PRIM_M_ASP_UP
Definition: sigtran_sap.h:22
LM_E_AS_ACTIVE_IND
@ LM_E_AS_ACTIVE_IND
Definition: xua_default_lm_fsm.c:61
xua_xlm_prim_alloc
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:90
osmo_ss7_asp
Definition: osmo_ss7.h:381
osmo_sua_to_sccp
struct msgb * osmo_sua_to_sccp(struct xua_msg *xua)
convert parsed SUA message to SCCP message
Definition: sccp2sua.c:1413
S
#define S(x)
Definition: xua_default_lm_fsm.c:41
xua_msg_class
Definition: xua_msg.h:48
m3ua_msg_class_rkm
const struct xua_msg_class m3ua_msg_class_rkm
Definition: m3ua.c:259
osmo_xlm_prim
Definition: sigtran_sap.h:66
xua_default_lm_fsm
struct osmo_fsm xua_default_lm_fsm
Definition: xua_default_lm_fsm.c:331
osmo_ss7_routing_key::context
uint32_t context
Definition: osmo_ss7.h:249
m3ua_data_hdr
Definition: m3ua.h:95
xua_msg
Definition: xua_msg.h:31
LM_E_ASP_UP_CONF
@ LM_E_ASP_UP_CONF
Definition: xua_default_lm_fsm.c:58
LM_E_RKM_REG_CONF
@ LM_E_RKM_REG_CONF
Definition: xua_default_lm_fsm.c:63
osmo_xlm_prim_name
char * osmo_xlm_prim_name(struct osmo_prim_hdr *oph)
Definition: sccp_sap.c:81
XUA_ASP_E_M_ASP_UP_REQ
@ XUA_ASP_E_M_ASP_UP_REQ
Definition: xua_asp_fsm.h:10
m3ua_ntfy_type_names
const struct value_string m3ua_ntfy_type_names[]
Definition: m3ua.c:79
mtp_xfer_param_to_m3ua_dh
void mtp_xfer_param_to_m3ua_dh(struct m3ua_data_hdr *mdh, const struct osmo_mtp_transfer_param *param)
Definition: m3ua.c:288
LM_E_AS_INACTIVE_IND
@ LM_E_AS_INACTIVE_IND
Definition: xua_default_lm_fsm.c:60
T_WAIT_RK_REG_RESP
@ T_WAIT_RK_REG_RESP
Definition: xua_default_lm_fsm.c:83