RTRlib
Loading...
Searching...
No Matches
aspa.h
Go to the documentation of this file.
1/*
2 * This file is part of RTRlib.
3 *
4 * This file is subject to the terms and conditions of the MIT license.
5 * See the file LICENSE in the top level directory for more details.
6 *
7 * Website: http://rtrlib.realmv6.org/
8 */
9
20#ifndef RTR_ASPA_H
21#define RTR_ASPA_H
22
25#include "rtrlib/rtr/rtr.h"
26
27#include <stdint.h>
28#include <stdio.h>
29#include <stdlib.h>
30
40 uint32_t customer_asn;
42 uint32_t *provider_asns;
43};
44
45// MARK: - ASPA Table
46
47struct aspa_table;
48
52enum __attribute__((__packed__)) aspa_operation_type {
54 ASPA_REMOVE = 0,
55
57 ASPA_ADD = 1
58};
59
69typedef void (*aspa_update_fp)(struct aspa_table *aspa_table, const struct aspa_record record,
70 const struct rtr_socket *rtr_socket, const enum aspa_operation_type operation_type);
71
83struct aspa_table {
84 pthread_rwlock_t lock;
85 pthread_rwlock_t update_lock;
88};
89
106
114
121void aspa_table_free(struct aspa_table *aspa_table, bool notify);
122
133
134// MARK: - AS_PATH Verification
135
137
146
162 enum aspa_direction direction);
163
169size_t aspa_collapse_as_path(uint32_t as_path[], size_t len);
170
171#endif /* RTR_ASPA_H */
void aspa_table_free(struct aspa_table *aspa_table, bool notify)
Frees the memory associated with the aspa_table.
aspa_status
Possible return values for aspa_* functions.
Definition aspa.h:93
aspa_verification_result
AS_PATH verification result.
Definition aspa.h:141
void(* aspa_update_fp)(struct aspa_table *aspa_table, const struct aspa_record record, const struct rtr_socket *rtr_socket, const enum aspa_operation_type operation_type)
A function pointer that is called if an record was added to the aspa_table or was removed from the as...
Definition aspa.h:69
void aspa_table_init(struct aspa_table *aspa_table, aspa_update_fp update_fp)
Initializes the aspa_table struct.
size_t aspa_collapse_as_path(uint32_t as_path[], size_t len)
Collapses an AS_PATH in-place, replacing in-series repetitions with single occurences.
enum aspa_verification_result aspa_verify_as_path(struct aspa_table *aspa_table, uint32_t as_path[], size_t len, enum aspa_direction direction)
Verifies an AS_PATH .
aspa_direction
Definition aspa.h:136
enum aspa_status aspa_table_src_remove(struct aspa_table *aspa_table, struct rtr_socket *rtr_socket, bool notify)
Removes all records in the aspa_table that originated from the socket.
@ ASPA_RECORD_NOT_FOUND
aspa_record wasn't found in the aspa_table.
Definition aspa.h:104
@ ASPA_SUCCESS
Operation was successful.
Definition aspa.h:95
@ ASPA_DUPLICATE_RECORD
The supplied aspa_record already exists in the aspa_table.
Definition aspa.h:101
@ ASPA_ERROR
Error occurred.
Definition aspa.h:98
@ ASPA_AS_PATH_INVALID
Definition aspa.h:143
@ ASPA_AS_PATH_VALID
Definition aspa.h:144
@ ASPA_AS_PATH_UNKNOWN
Definition aspa.h:142
@ ASPA_DOWNSTREAM
Definition aspa.h:136
@ ASPA_UPSTREAM
Definition aspa.h:136
uint32_t len
Definition rtr_pdus.h:4
struct pdu_reset_query __attribute__
ASPA Record Customer (Customer Autonomous Systen, CAS) authorizes a set of provider AS numbers.
Definition aspa.h:39
size_t provider_count
Definition aspa.h:41
uint32_t * provider_asns
Definition aspa.h:42
uint32_t customer_asn
Definition aspa.h:40
A linked list storing the bond between a rtr_socket and an aspa_array .
Definition aspa_private.h:122
ASPA Table.
Definition aspa.h:83
pthread_rwlock_t update_lock
Definition aspa.h:85
aspa_update_fp update_fp
Definition aspa.h:86
pthread_rwlock_t lock
Definition aspa.h:84
struct aspa_store_node * store
Definition aspa.h:87
A RTR socket.
Definition rtr.h:117