libosmo-sigtran 2.2.1.64-e866 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
38 struct {
40 struct osmo_ss7_linkset *linkset;
42 struct osmo_ss7_as *as;
43 } dest;
44
45 struct {
46 /* FIXME: presence? */
47 uint32_t pc;
48 uint32_t mask;
50 char *linkset_name;
52 uint32_t priority;
53 uint8_t qos_class;
54 bool dyn_allocated;
55 } cfg;
56};
57
58struct osmo_ss7_route *
59 ss7_route_alloc(struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask, bool dynamic);
60struct osmo_ss7_route *
61 ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc,
62 uint32_t mask, bool dynamic, const char *linkset_name);
63void ss7_route_destroy(struct osmo_ss7_route *rt);
64
65struct osmo_ss7_route *
66ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc);
67struct osmo_ss7_route *
68ss7_route_find_dpc_mask(struct osmo_ss7_route_table *rtbl, uint32_t dpc,
69 uint32_t mask);
70
71int ss7_route_set_linkset(struct osmo_ss7_route *rt, const char *linkset_name);
72int ss7_route_insert(struct osmo_ss7_route *rt);
73
74bool ss7_route_dest_is_available(const struct osmo_ss7_route *rt);
75bool ss7_route_is_available(const struct osmo_ss7_route *rt);
76
77bool ss7_route_is_fully_qualified(const struct osmo_ss7_route *rt);
78 static inline bool ss7_route_is_summary(const struct osmo_ss7_route *rt)
79{
80 return !ss7_route_is_fully_qualified(rt);
81}
82
83void ss7_route_update_route_status(struct osmo_ss7_route *rt, enum osmo_ss7_route_status status);
84
85#define LOGPRT(rt, subsys, level, fmt, args ...) do { \
86 char _pc_str[MAX_PC_STR_LEN]; \
87 char _mask_str[MAX_PC_STR_LEN]; \
88 _LOGSS7((rt)->rtable->inst, subsys, level, \
89 "RT(dpc=%u=%s,mask=0x%x=%s,prio=%u,via=%s,st=%s) " fmt, \
90 (rt)->cfg.pc, osmo_ss7_pointcode_print_buf(_pc_str, MAX_PC_STR_LEN, (rt)->rtable->inst, (rt)->cfg.pc), \
91 (rt)->cfg.mask, osmo_ss7_pointcode_print_buf(_mask_str, MAX_PC_STR_LEN, (rt)->rtable->inst, (rt)->cfg.mask), \
92 (rt)->cfg.priority, \
93 (rt)->cfg.linkset_name ? (rt)->cfg.linkset_name : "", \
94 ss7_route_status_name((rt)->status), \
95 ## args); \
96 } 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:205
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:77
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:114
ss7_route_status_names
const struct value_string ss7_route_status_names[]
Definition: ss7_route.c:42
ss7_route_is_fully_qualified
bool ss7_route_is_fully_qualified(const struct osmo_ss7_route *rt)
Definition: ss7_route.c:400
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:231
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:405
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:155
ss7_route_is_available
bool ss7_route_is_available(const struct osmo_ss7_route *rt)
Definition: ss7_route.c:381
ss7_route_is_summary
static bool ss7_route_is_summary(const struct osmo_ss7_route *rt)
Definition: ss7_route.h:78
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:389
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:45
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::dest
struct osmo_ss7_route::@35 dest
osmo_ss7_route::as
struct osmo_ss7_as * as
pointer to Application Server
Definition: ss7_route.h:42
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:53
osmo_ss7_route::pc
uint32_t pc
Definition: ss7_route.h:47
osmo_ss7_route::mask
uint32_t mask
Definition: ss7_route.h:48
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:54
osmo_ss7_route::cfg
struct osmo_ss7_route::@36 cfg
osmo_ss7_route::linkset
struct osmo_ss7_linkset * linkset
pointer to linkset (destination) of route
Definition: ss7_route.h:40
osmo_ss7_route::priority
uint32_t priority
lower priority is higher
Definition: ss7_route.h:52
osmo_ss7_route::linkset_name
char * linkset_name
human-specified linkset name
Definition: ss7_route.h:50
pc
uint32_t pc
Definition: tcap_as_loadshare.c:2