libosmo-sigtran 2.1.0.200-e20a Osmocom SIGTRAN library

ss7_combined_linkset.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include <osmocom/core/linuxlist.h>
5
6/***********************************************************************
7 * SS7 Combined Linkset
8 * Set of routes with same destination and priority.
9 ***********************************************************************/
10
11 struct osmo_ss7_instance;
12 struct osmo_ss7_link;
13 struct osmo_ss7_route_label;
14
15#define NUM_EXT_SLS 128
16 typedef uint8_t ext_sls_t; /* range: 0-127, 7 bit */
17
18 struct osmo_ss7_esls_entry {
19 /* ITU Q.704 4.2.1: "normal link set (combined link set)" */
20 struct osmo_ss7_route *normal_rt;
21 /* ITU Q.704 4.2.1: "alternative link set (combined link set)" */
22 struct osmo_ss7_route *alt_rt;
23};
24
25 struct osmo_ss7_combined_linkset {
27 struct llist_head list;
28
30 struct osmo_ss7_route_table *rtable;
31 struct osmo_ss7_esls_entry esls_table[NUM_EXT_SLS];
32
34 struct llist_head routes;
35 unsigned int num_routes;
36 void *last_route_roundrobin_ass;
37 void *last_route_roundrobin_tx;
38
39 struct {
40 uint32_t pc;
41 uint32_t mask;
43 uint32_t priority;
44 } cfg;
45};
46
47 struct osmo_ss7_combined_linkset *
48 ss7_combined_linkset_alloc(struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask, uint32_t prio);
49 void
50 ss7_combined_linkset_free(struct osmo_ss7_combined_linkset *clset);
51 struct osmo_ss7_linkset *
52 ss7_combined_linkset_find_or_create(struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask, uint32_t prio);
53
54 void
55 ss7_combined_linkset_add_route(struct osmo_ss7_combined_linkset *clset, struct osmo_ss7_route *rt);
56 void
57 ss7_combined_linkset_del_route(struct osmo_ss7_route *rt);
58 struct osmo_ss7_route *
59 ss7_combined_linkset_lookup_route(struct osmo_ss7_combined_linkset *clset, const struct osmo_ss7_route_label *rtlabel);
60 bool ss7_combined_linkset_is_available(const struct osmo_ss7_combined_linkset *clset);
61
62#define LOGPCLSET(clset, subsys, level, fmt, args ...) do { \
63 char _pc_str[MAX_PC_STR_LEN]; \
64 char _mask_str[MAX_PC_STR_LEN]; \
65 _LOGSS7((clset)->rtable->inst, subsys, level, \
66 "CombinedLinkset(dpc=%u=%s,mask=0x%x=%s,prio=%u) " fmt, \
67 (clset)->cfg.pc, osmo_ss7_pointcode_print_buf(_pc_str, MAX_PC_STR_LEN, (clset)->rtable->inst, (clset)->cfg.pc), \
68 (clset)->cfg.mask, osmo_ss7_pointcode_print_buf(_mask_str, MAX_PC_STR_LEN, (clset)->rtable->inst, (clset)->cfg.mask), \
69 (clset)->cfg.priority, ## args); \
70 } while (0)
ss7_combined_linkset_lookup_route
struct osmo_ss7_route * ss7_combined_linkset_lookup_route(struct osmo_ss7_combined_linkset *clset, const struct osmo_ss7_route_label *rtlabel)
Definition: ss7_combined_linkset.c:253
ss7_combined_linkset_free
void ss7_combined_linkset_free(struct osmo_ss7_combined_linkset *clset)
Definition: ss7_combined_linkset.c:126
ss7_combined_linkset_find_or_create
struct osmo_ss7_linkset * ss7_combined_linkset_find_or_create(struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask, uint32_t prio)
ss7_combined_linkset_alloc
struct osmo_ss7_combined_linkset * ss7_combined_linkset_alloc(struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask, uint32_t prio)
Definition: ss7_combined_linkset.c:105
ss7_combined_linkset_add_route
void ss7_combined_linkset_add_route(struct osmo_ss7_combined_linkset *clset, struct osmo_ss7_route *rt)
Definition: ss7_combined_linkset.c:134
ss7_combined_linkset_del_route
void ss7_combined_linkset_del_route(struct osmo_ss7_route *rt)
Definition: ss7_combined_linkset.c:142
ss7_combined_linkset_is_available
bool ss7_combined_linkset_is_available(const struct osmo_ss7_combined_linkset *clset)
Definition: ss7_combined_linkset.c:176
ext_sls_t
uint8_t ext_sls_t
Definition: ss7_combined_linkset.h:16
NUM_EXT_SLS
#define NUM_EXT_SLS
Definition: ss7_combined_linkset.h:15
osmo_ss7_combined_linkset
Definition: ss7_combined_linkset.h:25
osmo_ss7_combined_linkset::rtable
struct osmo_ss7_route_table * rtable
osmo_ss7_route_table to which we belong
Definition: ss7_combined_linkset.h:30
osmo_ss7_combined_linkset::last_route_roundrobin_ass
void * last_route_roundrobin_ass
Definition: ss7_combined_linkset.h:36
osmo_ss7_combined_linkset::list
struct llist_head list
member in osmo_ss7_route_table::combined_linksets
Definition: ss7_combined_linkset.h:27
osmo_ss7_combined_linkset::mask
uint32_t mask
Definition: ss7_combined_linkset.h:41
osmo_ss7_combined_linkset::priority
uint32_t priority
lower priority is higher
Definition: ss7_combined_linkset.h:43
osmo_ss7_combined_linkset::routes
struct llist_head routes
list of osmo_ss7_route
Definition: ss7_combined_linkset.h:34
osmo_ss7_combined_linkset::last_route_roundrobin_tx
void * last_route_roundrobin_tx
Definition: ss7_combined_linkset.h:37
osmo_ss7_combined_linkset::cfg
struct osmo_ss7_combined_linkset::@30 cfg
osmo_ss7_combined_linkset::esls_table
struct osmo_ss7_esls_entry esls_table[NUM_EXT_SLS]
Definition: ss7_combined_linkset.h:31
osmo_ss7_combined_linkset::pc
uint32_t pc
Definition: ss7_combined_linkset.h:40
osmo_ss7_combined_linkset::num_routes
unsigned int num_routes
Definition: ss7_combined_linkset.h:35
osmo_ss7_esls_entry
Definition: ss7_combined_linkset.h:18
osmo_ss7_esls_entry::alt_rt
struct osmo_ss7_route * alt_rt
Definition: ss7_combined_linkset.h:22
osmo_ss7_esls_entry::normal_rt
struct osmo_ss7_route * normal_rt
Definition: ss7_combined_linkset.h:20
osmo_ss7_instance
Definition: ss7_instance.h:31
osmo_ss7_link
Definition: ss7_link.h:19
osmo_ss7_linkset
Definition: ss7_linkset.h:13
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_route::clset
struct osmo_ss7_combined_linkset * clset
Definition: ss7_route.h:34