libosmo-sigtran: src/ss7_route.h Source File

libosmo-sigtran 2.2.1.95-893c Osmocom SIGTRAN library

ss7_route.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
7/***********************************************************************
8 * SS7 Routes
9 ***********************************************************************/
10
11struct osmo_ss7_instance;
12struct osmo_ss7_route_table;
13struct osmo_ss7_linkset;
14struct osmo_ss7_as;
15
16#define OSMO_SS7_ROUTE_PRIO_DEFAULT 5
17
18/* ITU Q.704 3.4 Status of signalling routes */
19 enum osmo_ss7_route_status {
20 OSMO_SS7_ROUTE_STATUS_UNAVAILABLE,
21 OSMO_SS7_ROUTE_STATUS_AVAILABLE,
22 OSMO_SS7_ROUTE_STATUS_RESTRICTED,
23};
24extern const struct value_string ss7_route_status_names[];
25 static inline const char *ss7_route_status_name(enum osmo_ss7_route_status val)
26{ return get_value_string(ss7_route_status_names, val); }
27
28 struct osmo_ss7_route {
30 struct llist_head list;
32 struct osmo_ss7_route_table *rtable;
33 /* Combined linkset this route is part of */
34 struct osmo_ss7_combined_linkset *clset;
35
36 enum osmo_ss7_route_status status;
37 /* T10: ITU Q.704 13.5.2 & rfc4666 4.5.3, ETSI TS 102 142 V1.1.1 */
38 struct osmo_timer_list t10_audit_timer;
39
40 struct {
42 struct osmo_ss7_linkset *linkset;
44 struct osmo_ss7_as *as;
45 } dest;
46
47 struct {
48 /* FIXME: presence? */
49 uint32_t pc;
50 uint32_t mask;
52 char *linkset_name;
54 uint32_t priority;
55 uint8_t qos_class;
56 bool dyn_allocated;
57 } cfg;
58};
59
60struct osmo_ss7_route *
61 ss7_route_alloc(struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask, bool dynamic);
62struct osmo_ss7_route *
63 ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc,
64 uint32_t mask, bool dynamic, const char *linkset_name);
65void ss7_route_destroy(struct osmo_ss7_route *rt);
66
67struct osmo_ss7_route *
68ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc);
69struct osmo_ss7_route *
70ss7_route_find_dpc_mask(struct osmo_ss7_route_table *rtbl, uint32_t dpc,
71 uint32_t mask);
72
73int ss7_route_set_linkset(struct osmo_ss7_route *rt, const char *linkset_name);
74int ss7_route_insert(struct osmo_ss7_route *rt);
75
76bool ss7_route_dest_is_available(const struct osmo_ss7_route *rt);
77bool ss7_route_is_available(const struct osmo_ss7_route *rt);
78
79bool ss7_route_is_fully_qualified(const struct osmo_ss7_route *rt);
80 static inline bool ss7_route_is_summary(const struct osmo_ss7_route *rt)
81{
82 return !ss7_route_is_fully_qualified(rt);
83}
84
85void ss7_route_update_route_status(struct osmo_ss7_route *rt, enum osmo_ss7_route_status status);
86
87#define LOGPRT(rt, subsys, level, fmt, args ...) do { \
88 char _pc_str[MAX_PC_STR_LEN]; \
89 char _mask_str[MAX_PC_STR_LEN]; \
90 _LOGSS7((rt)->rtable->inst, subsys, level, \
91 "RT(dpc=%u=%s,mask=0x%x=%s,prio=%u,via=%s,st=%s) " fmt, \
92 (rt)->cfg.pc, osmo_ss7_pointcode_print_buf(_pc_str, MAX_PC_STR_LEN, (rt)->rtable->inst, (rt)->cfg.pc), \
93 (rt)->cfg.mask, osmo_ss7_pointcode_print_buf(_mask_str, MAX_PC_STR_LEN, (rt)->rtable->inst, (rt)->cfg.mask), \
94 (rt)->cfg.priority, \
95 (rt)->cfg.linkset_name ? (rt)->cfg.linkset_name : "", \
96 ss7_route_status_name((rt)->status), \
97 ## args); \
98 } while (0)
dpc
uint32_t dpc
Definition: m3ua.h:1
ss7_route_create
struct osmo_ss7_route * ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc, uint32_t mask, bool dynamic, const char *linkset_name)
Create a new route in the given routing table.
Definition: ss7_route.c:261
ss7_route_alloc
struct osmo_ss7_route * ss7_route_alloc(struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask, bool dynamic)
Allocate a route entry.
Definition: ss7_route.c:130
ss7_route_set_linkset
int ss7_route_set_linkset(struct osmo_ss7_route *rt, const char *linkset_name)
Set linkset on route entry.
Definition: ss7_route.c:170
ss7_route_status_names
const struct value_string ss7_route_status_names[]
Definition: ss7_route.c:44
ss7_route_is_fully_qualified
bool ss7_route_is_fully_qualified(const struct osmo_ss7_route *rt)
Definition: ss7_route.c:458
ss7_route_find_dpc
struct osmo_ss7_route * ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc)
ss7_route_destroy
void ss7_route_destroy(struct osmo_ss7_route *rt)
Destroy a given SS7 route.
Definition: ss7_route.c:287
ss7_route_status_name
static const char * ss7_route_status_name(enum osmo_ss7_route_status val)
Definition: ss7_route.h:25
ss7_route_update_route_status
void ss7_route_update_route_status(struct osmo_ss7_route *rt, enum osmo_ss7_route_status status)
Definition: ss7_route.c:463
ss7_route_find_dpc_mask
struct osmo_ss7_route * ss7_route_find_dpc_mask(struct osmo_ss7_route_table *rtbl, uint32_t dpc, uint32_t mask)
ss7_route_insert
int ss7_route_insert(struct osmo_ss7_route *rt)
Insert route into its routing table.
Definition: ss7_route.c:211
ss7_route_is_available
bool ss7_route_is_available(const struct osmo_ss7_route *rt)
Definition: ss7_route.c:439
ss7_route_is_summary
static bool ss7_route_is_summary(const struct osmo_ss7_route *rt)
Definition: ss7_route.h:80
osmo_ss7_route_status
osmo_ss7_route_status
Definition: ss7_route.h:19
OSMO_SS7_ROUTE_STATUS_AVAILABLE
@ OSMO_SS7_ROUTE_STATUS_AVAILABLE
Definition: ss7_route.h:21
OSMO_SS7_ROUTE_STATUS_UNAVAILABLE
@ OSMO_SS7_ROUTE_STATUS_UNAVAILABLE
Definition: ss7_route.h:20
OSMO_SS7_ROUTE_STATUS_RESTRICTED
@ OSMO_SS7_ROUTE_STATUS_RESTRICTED
Definition: ss7_route.h:22
ss7_route_dest_is_available
bool ss7_route_dest_is_available(const struct osmo_ss7_route *rt)
Definition: ss7_route.c:447
osmo_ss7_as
Definition: ss7_as.h:95
osmo_ss7_combined_linkset
Definition: ss7_combined_linkset.h:25
osmo_ss7_instance
Definition: ss7_instance.h:47
osmo_ss7_linkset
Definition: ss7_linkset.h:13
osmo_ss7_route_table
Definition: ss7_route_table.h:21
osmo_ss7_route
Definition: ss7_route.h:28
osmo_ss7_route::as
struct osmo_ss7_as * as
pointer to Application Server
Definition: ss7_route.h:44
osmo_ss7_route::dest
struct osmo_ss7_route::@36 dest
osmo_ss7_route::clset
struct osmo_ss7_combined_linkset * clset
Definition: ss7_route.h:34
osmo_ss7_route::qos_class
uint8_t qos_class
Definition: ss7_route.h:55
osmo_ss7_route::pc
uint32_t pc
Definition: ss7_route.h:49
osmo_ss7_route::t10_audit_timer
struct osmo_timer_list t10_audit_timer
Definition: ss7_route.h:38
osmo_ss7_route::mask
uint32_t mask
Definition: ss7_route.h:50
osmo_ss7_route::rtable
struct osmo_ss7_route_table * rtable
osmo_ss7_route_table to which we belong
Definition: ss7_route.h:32
osmo_ss7_route::list
struct llist_head list
member in osmo_ss7_combined_linkset::routes
Definition: ss7_route.h:30
osmo_ss7_route::status
enum osmo_ss7_route_status status
Definition: ss7_route.h:36
osmo_ss7_route::dyn_allocated
bool dyn_allocated
Definition: ss7_route.h:56
osmo_ss7_route::cfg
struct osmo_ss7_route::@37 cfg
osmo_ss7_route::linkset
struct osmo_ss7_linkset * linkset
pointer to linkset (destination) of route
Definition: ss7_route.h:42
osmo_ss7_route::priority
uint32_t priority
lower priority is higher
Definition: ss7_route.h:54
osmo_ss7_route::linkset_name
char * linkset_name
human-specified linkset name
Definition: ss7_route.h:52
pc
uint32_t pc
Definition: tcap_as_loadshare.c:2