libosmo-sigtran 2.1.0.134-a6b3
Osmocom SIGTRAN library
ss7_route.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <osmocom/core/linuxlist.h>

Go to the source code of this file.

Data Structures

struct  osmo_ss7_route
 

Macros

#define OSMO_SS7_ROUTE_PRIO_DEFAULT   5
 
#define LOGPRT(rt, subsys, level, fmt, args ...)
 

Enumerations

enum  osmo_ss7_route_status { OSMO_SS7_ROUTE_STATUS_UNAVAILABLE , OSMO_SS7_ROUTE_STATUS_AVAILABLE , OSMO_SS7_ROUTE_STATUS_RESTRICTED }
 

Functions

static const char * ss7_route_status_name (enum osmo_ss7_route_status val)
 
struct osmo_ss7_routess7_route_alloc (struct osmo_ss7_route_table *rtbl, uint32_t pc, uint32_t mask, bool dynamic)
 Allocate a route entry. More...
 
struct osmo_ss7_routess7_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. More...
 
void ss7_route_destroy (struct osmo_ss7_route *rt)
 Destroy a given SS7 route. More...
 
struct osmo_ss7_routess7_route_find_dpc (struct osmo_ss7_route_table *rtbl, uint32_t dpc)
 
struct osmo_ss7_routess7_route_find_dpc_mask (struct osmo_ss7_route_table *rtbl, uint32_t dpc, uint32_t mask)
 
int ss7_route_set_linkset (struct osmo_ss7_route *rt, const char *linkset_name)
 Set linkset on route entry. More...
 
int ss7_route_insert (struct osmo_ss7_route *rt)
 Insert route into its routing table. More...
 
bool ss7_route_dest_is_available (const struct osmo_ss7_route *rt)
 
bool ss7_route_is_available (const struct osmo_ss7_route *rt)
 
bool ss7_route_is_fully_qualified (const struct osmo_ss7_route *rt)
 
static bool ss7_route_is_summary (const struct osmo_ss7_route *rt)
 
void ss7_route_update_route_status (struct osmo_ss7_route *rt, enum osmo_ss7_route_status status)
 

Variables

const struct value_string ss7_route_status_names []
 

Macro Definition Documentation

◆ LOGPRT

#define LOGPRT (   rt,
  subsys,
  level,
  fmt,
  args ... 
)
Value:
do { \
char _pc_str[MAX_PC_STR_LEN]; \
char _mask_str[MAX_PC_STR_LEN]; \
_LOGSS7((rt)->rtable->inst, subsys, level, \
"RT(dpc=%u=%s,mask=0x%x=%s,prio=%u,via=%s,st=%s) " fmt, \
(rt)->cfg.pc, osmo_ss7_pointcode_print_buf(_pc_str, MAX_PC_STR_LEN, (rt)->rtable->inst, (rt)->cfg.pc), \
(rt)->cfg.mask, osmo_ss7_pointcode_print_buf(_mask_str, MAX_PC_STR_LEN, (rt)->rtable->inst, (rt)->cfg.mask), \
(rt)->cfg.priority, \
(rt)->cfg.linkset_name ? (rt)->cfg.linkset_name : "", \
ss7_route_status_name((rt)->status), \
## args); \
} while (0)
const char * osmo_ss7_pointcode_print_buf(char *buf, size_t buf_len, const struct osmo_ss7_instance *inst, uint32_t pc)
Definition: ss7_instance.c:559
#define MAX_PC_STR_LEN
Definition: ss7_internal.h:12
static const char * ss7_route_status_name(enum osmo_ss7_route_status val)
Definition: ss7_route.h:25

◆ OSMO_SS7_ROUTE_PRIO_DEFAULT

#define OSMO_SS7_ROUTE_PRIO_DEFAULT   5

Enumeration Type Documentation

◆ osmo_ss7_route_status

Enumerator
OSMO_SS7_ROUTE_STATUS_UNAVAILABLE 
OSMO_SS7_ROUTE_STATUS_AVAILABLE 
OSMO_SS7_ROUTE_STATUS_RESTRICTED 

Function Documentation

◆ 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.

Parameters
[in]rtblRouting Table where the route belongs
[in]pcPoint Code of the destination of the route
[in]maskMask of the destination Point Code pc
[in]dynamicWhether the route is dynamic
Returns
Allocated route (not yet inserted into its rtbl), NULL on error

The returned route has no linkset associated yet, user must associate it using API ss7_route_set_linkset() before inserting the route into its routing table.

Fields priority and qos_class may be set before inserting the route into its routing table:

  • A default priority of 0 is configured on the route.
  • A default qos-class of 0 is configured on the route.

Use API ss7_route_insert() to insert the route into its routing table.

The route entry allocated with this API can be destroyed/freed at any point using API ss7_route_destroy(), regardless of it being already inserted or not in its routing table.

Dynamic routes are not configured by the user (VTY), and hence cannot be removed by the user. Dynamic routes are not stored in the config and hence they don't show up in eg "show running-config"; they can be listed using specific VTY commands like "show cs7 instance 0 route".

References osmo_ss7_instance::cfg, osmo_ss7_route::cfg, osmo_ss7_route::dyn_allocated, osmo_ss7_route_table::inst, osmo_ss7_route::list, osmo_ss7_route::mask, NULL, osmo_ss7_pc_normalize(), OSMO_SS7_ROUTE_PRIO_DEFAULT, OSMO_SS7_ROUTE_STATUS_AVAILABLE, osmo_ss7_route::pc, osmo_ss7_instance::pc_fmt, osmo_ss7_route::priority, osmo_ss7_route::rtable, ss7_initialized, and osmo_ss7_route::status.

Referenced by DEFUN_ATTR(), and ss7_route_create().

◆ ss7_route_create()

struct osmo_ss7_route * ss7_route_create ( struct osmo_ss7_route_table rtbl,
uint32_t  pc,
uint32_t  mask,
bool  dynamic,
const char *  linkset_name 
)

Create a new route in the given routing table.

Parameters
[in]rtblRouting Table in which the route is to be created
[in]pcPoint Code of the destination of the route
[in]maskMask of the destination Point Code pc
[in]dynamicWhether the route is dynamic
[in]linkset_namestring name of the linkset to be used
Returns
callee-allocated + initialized route, NULL on error

The route allocated and returned by this API is already inserted into the routing table, with priority and qos-class set to 0. If you plan to use different values for priority and qos-class, avoid using this API and use ss7_route_alloc() + ss7_route_set_linkset() + ss7_route_insert() instead.

References osmo_ss7_route::linkset_name, osmo_ss7_route::mask, NULL, osmo_ss7_route::pc, ss7_route_alloc(), ss7_route_insert(), ss7_route_set_linkset(), and ss7_route_table_find_route_by_dpc_mask().

Referenced by _rout_key(), handle_rkey_reg(), ipa_add_route(), osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_add_clnt(), and xua_snm_srm_pc_available_single().

◆ ss7_route_dest_is_available()

◆ ss7_route_destroy()

◆ ss7_route_find_dpc()

struct osmo_ss7_route * ss7_route_find_dpc ( struct osmo_ss7_route_table rtbl,
uint32_t  dpc 
)

◆ 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.

Parameters
[in]rtRoute to be inserted into its routing table
Returns
0 on success, negative on error

A route is only really used once it has been inserted into its routing table.

References osmo_ss7_route::cfg, osmo_ss7_route::clset, osmo_ss7_route::dyn_allocated, osmo_ss7_route::linkset_name, osmo_ss7_route::list, LOGPRT, osmo_ss7_route::mask, osmo_ss7_route::pc, osmo_ss7_route::priority, osmo_ss7_combined_linkset::routes, osmo_ss7_route::rtable, ss7_combined_linkset_add_route(), ss7_combined_linkset_alloc(), ss7_route_inserted(), and ss7_route_table_find_combined_linkset().

Referenced by DEFUN_ATTR(), and ss7_route_create().

◆ ss7_route_is_available()

◆ ss7_route_is_fully_qualified()

◆ ss7_route_is_summary()

static bool ss7_route_is_summary ( const struct osmo_ss7_route rt)
inlinestatic

◆ ss7_route_set_linkset()

int ss7_route_set_linkset ( struct osmo_ss7_route rt,
const char *  linkset_name 
)

Set linkset on route entry.

Parameters
[in]rtRoute to be configured
[in]linkset_namestring name of the linkset to be used
Returns
0 on success, negative on error.

References osmo_ss7_route::as, osmo_ss7_route::cfg, osmo_ss7_route::dest, osmo_ss7_route_table::inst, osmo_ss7_route::linkset, osmo_ss7_route::linkset_name, LOGPRT, NULL, osmo_ss7_as_find_by_name(), osmo_ss7_route_name(), osmo_ss7_route::rtable, ss7_linkset_find_by_name(), and ss7_route_inserted().

Referenced by DEFUN_ATTR(), and ss7_route_create().

◆ ss7_route_status_name()

static const char * ss7_route_status_name ( enum osmo_ss7_route_status  val)
inlinestatic

◆ ss7_route_update_route_status()

void ss7_route_update_route_status ( struct osmo_ss7_route rt,
enum osmo_ss7_route_status  status 
)

Variable Documentation

◆ ss7_route_status_names

const struct value_string ss7_route_status_names[]
extern

Referenced by ss7_route_status_name().