libosmo-sigtran 2.1.0.194-89e3 Osmocom SIGTRAN library

ss7_instance.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include <stdbool.h>
5#include <osmocom/core/linuxlist.h>
6#include <osmocom/core/rate_ctr.h>
7
8#include <osmocom/sigtran/protocol/mtp.h>
9
10/***********************************************************************
11 * SS7 Instances
12 ***********************************************************************/
13
14struct osmo_ss7_user;
15struct osmo_ss7_route_table;
16struct osmo_ss7_route_label;
17struct osmo_sccp_instance;
18
19 enum ss7_instance_ctr {
20 SS7_INST_CTR_PKT_RX_TOTAL,
21 SS7_INST_CTR_PKT_RX_UNKNOWN,
22 SS7_INST_CTR_PKT_RX_NI_MISMATCH,
23 SS7_INST_CTR_PKT_TX_TOTAL,
24};
25
26 struct osmo_ss7_pc_fmt {
27 char delimiter;
28 uint8_t component_len[3];
29};
30
31 struct osmo_ss7_instance {
33 struct llist_head list;
35 struct llist_head linksets;
37 struct llist_head as_list;
39 struct llist_head asp_list;
41 struct llist_head rtable_list;
43 struct llist_head xua_servers;
44 /* array for faster lookup of user (indexed by service
45 * indicator) */
46 struct osmo_ss7_user *user[16];
47
48 struct osmo_ss7_route_table *rtable_system;
49
50 struct osmo_sccp_instance *sccp;
51
52 struct rate_ctr_group *ctrg;
53
54 struct {
55 uint32_t id;
56 char *name;
57 char *description;
58 uint32_t primary_pc;
59 /* capability PCs */
60 enum mtp_network_indicator network_indicator;
61 struct osmo_ss7_pc_fmt pc_fmt;
62 bool permit_dyn_rkm_alloc;
63 struct llist_head sccp_address_book;
64 uint32_t secondary_pc;
65 /* How many bits from ITU OPC/DPC field (starting from least-significant-bit)
66 * to skip for routing decisions (always takes 6 bits).
67 * range 0-8, defaults to 0, which means take least significant 6 bits. */
68 uint8_t opc_shift;
69 uint8_t dpc_shift;
70 /* How many bits from ITU SLS field (starting from least-significant-bit)
71 * to skip for routing decisions.
72 * range 0-3, defaults to 0, which means take all 4 bits. */
73 uint8_t sls_shift;
74 } cfg;
75};
76
77struct osmo_ss7_instance *
78 ss7_instance_alloc(void *ctx, uint32_t id);
79
80uint32_t ss7_find_free_l_rk_id(struct osmo_ss7_instance *inst);
81struct osmo_ss7_route *
82 ss7_instance_lookup_route(struct osmo_ss7_instance *inst, const struct osmo_ss7_route_label *rtlabel);
83
84#define _LOGSS7(inst, subsys, level, fmt, args ...) \
85 LOGP(subsys, level, "%u: " fmt, inst ? (inst)->cfg.id : 0, ## args)
86#define LOGSS7(inst, level, fmt, args ...) \
87 _LOGSS7(inst, DLSS7, level, fmt, ## args)
mtp.h
mtp_network_indicator
mtp_network_indicator
Definition: mtp.h:39
ss7_instance_lookup_route
struct osmo_ss7_route * ss7_instance_lookup_route(struct osmo_ss7_instance *inst, const struct osmo_ss7_route_label *rtlabel)
Find a SS7 route for given destination point code in given SS7.
Definition: ss7_instance.c:234
ss7_find_free_l_rk_id
uint32_t ss7_find_free_l_rk_id(struct osmo_ss7_instance *inst)
Definition: ss7_instance.c:221
ss7_instance_ctr
ss7_instance_ctr
Definition: ss7_instance.h:19
SS7_INST_CTR_PKT_RX_NI_MISMATCH
@ SS7_INST_CTR_PKT_RX_NI_MISMATCH
Definition: ss7_instance.h:22
SS7_INST_CTR_PKT_RX_TOTAL
@ SS7_INST_CTR_PKT_RX_TOTAL
Definition: ss7_instance.h:20
SS7_INST_CTR_PKT_RX_UNKNOWN
@ SS7_INST_CTR_PKT_RX_UNKNOWN
Definition: ss7_instance.h:21
SS7_INST_CTR_PKT_TX_TOTAL
@ SS7_INST_CTR_PKT_TX_TOTAL
Definition: ss7_instance.h:23
ss7_instance_alloc
struct osmo_ss7_instance * ss7_instance_alloc(void *ctx, uint32_t id)
Definition: ss7_instance.c:67
osmo_sccp_instance
Definition: sccp_instance.h:47
osmo_ss7_instance
Definition: ss7_instance.h:31
osmo_ss7_instance::sccp
struct osmo_sccp_instance * sccp
Definition: ss7_instance.h:50
osmo_ss7_instance::secondary_pc
uint32_t secondary_pc
Definition: ss7_instance.h:64
osmo_ss7_instance::rtable_system
struct osmo_ss7_route_table * rtable_system
Definition: ss7_instance.h:48
osmo_ss7_instance::ctrg
struct rate_ctr_group * ctrg
Definition: ss7_instance.h:52
osmo_ss7_instance::user
struct osmo_ss7_user * user[16]
Definition: ss7_instance.h:46
osmo_ss7_instance::dpc_shift
uint8_t dpc_shift
Definition: ss7_instance.h:69
osmo_ss7_instance::linksets
struct llist_head linksets
list of osmo_ss7_linkset
Definition: ss7_instance.h:35
osmo_ss7_instance::cfg
struct osmo_ss7_instance::@31 cfg
osmo_ss7_instance::name
char * name
Definition: ss7_instance.h:56
osmo_ss7_instance::primary_pc
uint32_t primary_pc
Definition: ss7_instance.h:58
osmo_ss7_instance::pc_fmt
struct osmo_ss7_pc_fmt pc_fmt
Definition: ss7_instance.h:61
osmo_ss7_instance::as_list
struct llist_head as_list
list of osmo_ss7_as
Definition: ss7_instance.h:37
osmo_ss7_instance::rtable_list
struct llist_head rtable_list
list of osmo_ss7_route_table
Definition: ss7_instance.h:41
osmo_ss7_instance::description
char * description
Definition: ss7_instance.h:57
osmo_ss7_instance::id
uint32_t id
Definition: ss7_instance.h:55
osmo_ss7_instance::sls_shift
uint8_t sls_shift
Definition: ss7_instance.h:73
osmo_ss7_instance::asp_list
struct llist_head asp_list
list of osmo_ss7_asp
Definition: ss7_instance.h:39
osmo_ss7_instance::permit_dyn_rkm_alloc
bool permit_dyn_rkm_alloc
Definition: ss7_instance.h:62
osmo_ss7_instance::network_indicator
enum mtp_network_indicator network_indicator
Definition: ss7_instance.h:60
osmo_ss7_instance::sccp_address_book
struct llist_head sccp_address_book
Definition: ss7_instance.h:63
osmo_ss7_instance::opc_shift
uint8_t opc_shift
Definition: ss7_instance.h:68
osmo_ss7_instance::list
struct llist_head list
member of global list of instances
Definition: ss7_instance.h:33
osmo_ss7_instance::xua_servers
struct llist_head xua_servers
list of osmo_xua_servers
Definition: ss7_instance.h:43
osmo_ss7_pc_fmt
Definition: ss7_instance.h:26
osmo_ss7_pc_fmt::delimiter
char delimiter
Definition: ss7_instance.h:27
osmo_ss7_pc_fmt::component_len
uint8_t component_len[3]
Definition: ss7_instance.h:28
osmo_ss7_route_label
Definition: ss7_route_table.h:14
osmo_ss7_route_table
Definition: ss7_route_table.h:21
osmo_ss7_route
Definition: ss7_route.h:28
osmo_ss7_user
Definition: ss7_user.h:15