libosmo-sigtran  2.1.0.119-5f21.202507022026
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 
11 struct osmo_ss7_instance;
13 struct osmo_ss7_linkset;
14 struct osmo_ss7_as;
15 
16 #define OSMO_SS7_ROUTE_PRIO_DEFAULT 5
17 
20  struct llist_head list;
23  /* Combined linkset this route is part of */
25 
26  struct {
30  struct osmo_ss7_as *as;
31  } dest;
32 
33  struct {
34  /* FIXME: presence? */
35  uint32_t pc;
36  uint32_t mask;
38  char *linkset_name;
40  uint32_t priority;
41  uint8_t qos_class;
43  } cfg;
44 };
45 
46 struct osmo_ss7_route *
47 ss7_route_alloc(struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask, bool dynamic);
48 struct osmo_ss7_route *
49 ss7_route_create(struct osmo_ss7_route_table *rtbl, uint32_t dpc,
50  uint32_t mask, bool dynamic, const char *linkset_name);
51 void ss7_route_destroy(struct osmo_ss7_route *rt);
52 
53 struct osmo_ss7_route *
55 struct osmo_ss7_route *
57  uint32_t mask);
58 
59 int ss7_route_set_linkset(struct osmo_ss7_route *rt, const char *linkset_name);
60 int ss7_route_insert(struct osmo_ss7_route *rt);
61 
62 bool ss7_route_is_available(const struct osmo_ss7_route *rt);
63 #define LOGPRT(rt, subsys, level, fmt, args ...) do { \
64  char _pc_str[MAX_PC_STR_LEN]; \
65  char _mask_str[MAX_PC_STR_LEN]; \
66  _LOGSS7((rt)->rtable->inst, subsys, level, \
67  "RT(dpc=%u=%s,mask=0x%x=%s,prio=%u,via=%s) " fmt, \
68  (rt)->cfg.pc, osmo_ss7_pointcode_print_buf(_pc_str, MAX_PC_STR_LEN, (rt)->rtable->inst, (rt)->cfg.pc), \
69  (rt)->cfg.mask, osmo_ss7_pointcode_print_buf(_mask_str, MAX_PC_STR_LEN, (rt)->rtable->inst, (rt)->cfg.mask), \
70  (rt)->cfg.priority, \
71  (rt)->cfg.linkset_name ? (rt)->cfg.linkset_name : "", \
72  ## args); \
73  } while (0)
uint32_t dpc
Definition: m3ua.h:1
struct osmo_ss7_route * ss7_route_find_dpc(struct osmo_ss7_route_table *rtbl, uint32_t dpc)
int ss7_route_set_linkset(struct osmo_ss7_route *rt, const char *linkset_name)
Set linkset on route entry.
Definition: ss7_route.c:105
struct osmo_ss7_route * ss7_route_find_dpc_mask(struct osmo_ss7_route_table *rtbl, uint32_t dpc, uint32_t mask)
void ss7_route_destroy(struct osmo_ss7_route *rt)
Destroy a given SS7 route.
Definition: ss7_route.c:222
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:196
int ss7_route_insert(struct osmo_ss7_route *rt)
Insert route into its routing table.
Definition: ss7_route.c:146
bool ss7_route_is_available(const struct osmo_ss7_route *rt)
Definition: ss7_route.c:374
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:69
Definition: ss7_as.h:74
Definition: ss7_combined_linkset.h:25
Definition: ss7_instance.h:21
Definition: ss7_linkset.h:13
Definition: ss7_route_table.h:20
Definition: ss7_route.h:18
struct osmo_ss7_route::@33 dest
struct osmo_ss7_as * as
pointer to Application Server
Definition: ss7_route.h:30
struct osmo_ss7_combined_linkset * clset
Definition: ss7_route.h:24
uint8_t qos_class
Definition: ss7_route.h:41
uint32_t pc
Definition: ss7_route.h:35
uint32_t mask
Definition: ss7_route.h:36
struct osmo_ss7_route_table * rtable
osmo_ss7_route_table to which we belong
Definition: ss7_route.h:22
struct llist_head list
member in osmo_ss7_combined_linkset::routes
Definition: ss7_route.h:20
struct osmo_ss7_route::@34 cfg
bool dyn_allocated
Definition: ss7_route.h:42
struct osmo_ss7_linkset * linkset
pointer to linkset (destination) of route
Definition: ss7_route.h:28
uint32_t priority
lower priority is higher
Definition: ss7_route.h:40
char * linkset_name
human-specified linkset name
Definition: ss7_route.h:38