TRIP Routing Daemon
TRIP (RFC 3219) Location Server Implementation
Loading...
Searching...
No Matches
trib.c File Reference
#include "trib.h"
#include "db/pib.h"
#include "protocol/protocol.h"
#include <time.h>
#include <logging/logging.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for trib.c:

Go to the source code of this file.

Macros

#define _COMPONENT_   "db"
#define INIT_TABLE_CAPACITY   256
#define INIT_ADJ_TRIBS_CAPACITY   32

Functions

entry_tentry_clone (const entry_t *entry)
 Clone entry.
void entry_destroy (entry_t *entry)
 Destroy entry.
void trib_table_deinit (table_t *t)
 Deinitialize table.
trib_ttrib_new (uint32_t local_itad)
 Initialize TRIB structure.
void trib_adj_pair_add (trib_t *trib, table_t *in, table_t *out)
 Add and init pair of tables owned by caller.
void trib_adj_pair_remove (trib_t *trib, table_t *in, table_t *out)
void trib_destroy (trib_t *trib)
 Deinit TRIB structure.
entry_t ** trib_table_find (table_t *t, uint16_t af, const char *prefix)
 Find exact route in table.
const entry_ttrib_table_lookup (const table_t *table, uint16_t af, uint16_t app_proto, const char *address)
 Lookup address in table.
void trib_table_insert (table_t *table, entry_t *entry)
 Add route to table.
void trib_table_insert_or_replace (table_t *table, entry_t *route)
void trib_table_insert_or_replace_if_new (table_t *table, entry_t *route)
void trib_table_clear (table_t *table)
 Destroy all entries and clear table.
void trib_update_local (trib_t *trib)
 Update local routes when ITAD is defined.
void trib_update_adj_out (trib_t *trib, table_t *adj_trib_out)
 Update an Adj-TRIB-Out.
void trib_update_full (trib_t *trib)
 Execute route selection.
size_t get_new_entries (const table_t *table, entry_t ***new_ents_out)
 Return array of new entry references to new.
size_t group_entries_by_attrs (entry_t **entries, size_t entry_size, entry_group_t **groups_out)
 Group array of entry references by attributes.

Variables

const char * entry_type_strs []

Detailed Description

Telephony Routing Information Base, singleton

Function Documentation

◆ get_new_entries()

size_t get_new_entries ( const table_t * table,
entry_t *** new_ents_out )

Return array of new entry references to new.

Allocates array of references and assigns it to new_ents_out

Parameters
tableTable with new entries
new_ents_outWhere to put entry references
Returns
Number of new entries
Here is the caller graph for this function:

◆ group_entries_by_attrs()

size_t group_entries_by_attrs ( entry_t ** entries,
size_t entries_size,
entry_group_t ** groups_out )

Group array of entry references by attributes.

Parameters
entriesInput array
entries_sizeInput array size
groups_outOutput entry reference groups
Returns
Number of groups
Here is the caller graph for this function:

◆ trib_table_lookup()

const entry_t * trib_table_lookup ( const table_t * table,
uint16_t af,
uint16_t app_proto,
const char * address )

Lookup address in table.

Parameters
tableTable
afAddress family
app_protoOptional (=0) app_proto
addressAddress
Here is the caller graph for this function:

◆ trib_update_adj_out()

void trib_update_adj_out ( trib_t * trib,
table_t * adj_trib_out )

Update an Adj-TRIB-Out.

For use when a new peer connets and we have to UPDATE it without triggering a full update

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trib_update_full()

void trib_update_full ( trib_t * trib)

Execute route selection.

Takes Ext-TRIBs-in and locala routes Updates Ext-TRIB, Loc-TRIB, optimized Loc-TRIB and Ext-TRIBs-out

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ entry_type_strs

const char* entry_type_strs[]
Initial value:
= {
"TRIP",
"CONNECTED",
"STATIC"
}