RTRlib
Loading...
Searching...
No Matches
pfx.h File Reference
#include "rtrlib/lib/ip.h"
#include "rtrlib/pfx/trie/trie-pfx.h"
#include <inttypes.h>

Go to the source code of this file.

Typedefs

typedef void(* pfx_for_each_fp) (const struct pfx_record *pfx_record, void *data)
 A function pointer that is called for each record in the pfx_table.
 

Enumerations

enum  pfx_rtvals { PFX_SUCCESS = 0 , PFX_ERROR = -1 , PFX_DUPLICATE_RECORD = -2 , PFX_RECORD_NOT_FOUND = -3 }
 Possible return values for pfx_ functions. More...
 
enum  pfxv_state { BGP_PFXV_STATE_VALID , BGP_PFXV_STATE_NOT_FOUND , BGP_PFXV_STATE_INVALID }
 Validation states returned from pfx_validate_origin. More...
 

Functions

void pfx_table_init (struct pfx_table *pfx_table, pfx_update_fp update_fp)
 Initializes the pfx_table struct.
 
void pfx_table_free (struct pfx_table *pfx_table)
 Frees all memory associated with the pfx_table.
 
int pfx_table_add (struct pfx_table *pfx_table, const struct pfx_record *pfx_record)
 Adds a pfx_record to a pfx_table.
 
int pfx_table_remove (struct pfx_table *pfx_table, const struct pfx_record *pfx_record)
 Removes a pfx_record from a pfx_table.
 
int pfx_table_src_remove (struct pfx_table *pfx_table, const struct rtr_socket *socket)
 Removes all entries in the pfx_table that match the passed socket_id value from a pfx_table.
 
int pfx_table_validate (struct pfx_table *pfx_table, const uint32_t asn, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, enum pfxv_state *result)
 Validates the origin of a BGP-Route.
 
int pfx_table_validate_r (struct pfx_table *pfx_table, struct pfx_record **reason, unsigned int *reason_len, const uint32_t asn, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, enum pfxv_state *result)
 Validates the origin of a BGP-Route and returns a list of pfx_record that decided the result.
 
void pfx_table_for_each_ipv4_record (struct pfx_table *pfx_table, pfx_for_each_fp fp, void *data)
 Iterates over all IPv4 records in the pfx_table.
 
void pfx_table_for_each_ipv6_record (struct pfx_table *pfx_table, pfx_for_each_fp fp, void *data)
 Iterates over all IPv6 records in the pfx_table.