RTRlib
Loading...
Searching...
No Matches
bgpsec_private.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
17#ifndef RTR_BGPSEC_PRIVATE_H
18#define RTR_BGPSEC_PRIVATE_H
19
21
31int rtr_bgpsec_validate_as_path(const struct rtr_bgpsec *data, struct spki_table *table);
32
43int rtr_bgpsec_generate_signature(const struct rtr_bgpsec *data, uint8_t *private_key,
44 struct rtr_signature_seg **new_signature);
45
51
58int rtr_bgpsec_has_algorithm_suite(uint8_t alg_suite);
59
65int rtr_bgpsec_get_algorithm_suites(const uint8_t **algs_arr);
66
72
83
90
101
111int rtr_bgpsec_prepend_sig_seg(struct rtr_bgpsec *bgpsec, struct rtr_signature_seg *new_seg);
112
123struct rtr_bgpsec *rtr_bgpsec_new(uint8_t alg, uint8_t safi, uint16_t afi, uint32_t my_as, uint32_t target_as,
124 struct rtr_bgpsec_nlri *nlri);
125
132
138
144void rtr_bgpsec_free(struct rtr_bgpsec *bgpsec);
145
152
161
170
180int rtr_bgpsec_append_sig_seg(struct rtr_bgpsec *bgpsec, struct rtr_signature_seg *new_seg);
181
190
196void rtr_bgpsec_add_spki_record(struct spki_table *table, struct spki_record *record);
197#endif
198/* @} */
void rtr_bgpsec_free_signatures(struct rtr_signature_seg *seg)
Free a signature and any signatures that are pointed to.
struct rtr_bgpsec_nlri * nlri
Definition bgpsec.h:135
int rtr_bgpsec_has_algorithm_suite(uint8_t alg_suite)
Check, if an algorithm suite is supported by RTRlib.
void rtr_bgpsec_append_sec_path_seg(struct rtr_bgpsec *bgpsec, struct rtr_secure_path_seg *new_seg)
Append a Secure Path Segment to the end of the rtr_bgpsec::path of a given rtr_bgpsec struct.
void rtr_bgpsec_prepend_sec_path_seg(struct rtr_bgpsec *bgpsec, struct rtr_secure_path_seg *new_seg)
Prepend a given Secure Path Segment to rtr_bgpsec::path.
struct rtr_signature_seg * rtr_bgpsec_new_signature_seg(uint8_t *ski, uint16_t sig_len, uint8_t *signature)
Return an allocated and initialized Signature.
int rtr_bgpsec_get_version(void)
Returns the highest supported BGPsec version.
uint32_t my_as
Definition bgpsec.h:129
uint8_t safi
Definition bgpsec.h:127
struct rtr_signature_seg * rtr_bgpsec_pop_signature_seg(struct rtr_bgpsec *bgpsec)
Pop off the first Signature Segment from a given rtr_bgpsec struct and return this Signature Segment.
void rtr_bgpsec_nlri_free(struct rtr_bgpsec_nlri *nlri)
Free a rtr_bgpsec_nlri struct.
struct rtr_bgpsec * rtr_bgpsec_new(uint8_t alg, uint8_t safi, uint16_t afi, uint32_t my_as, uint32_t target_as, struct rtr_bgpsec_nlri *nlri)
Initializes and returns a pointer to a rtr_bgpsec struct.
int rtr_bgpsec_prepend_sig_seg(struct rtr_bgpsec *bgpsec, struct rtr_signature_seg *new_seg)
Prepend a given Signature Segment to rtr_bgpsec::sigs.
int rtr_bgpsec_generate_signature(const struct rtr_bgpsec *data, uint8_t *private_key, struct rtr_signature_seg **new_signature)
Signing function for a BGPsec_PATH.
void rtr_bgpsec_free(struct rtr_bgpsec *bgpsec)
Free a rtr_bgpsec struct and any Secure Path and Signature Segments it holds.
int rtr_bgpsec_append_sig_seg(struct rtr_bgpsec *bgpsec, struct rtr_signature_seg *new_seg)
Append a Signature Segment to the end of the rtr_bgpsec::sigs of a given rtr_bgpsec struct.
struct rtr_secure_path_seg * rtr_bgpsec_new_secure_path_seg(uint8_t pcount, uint8_t flags, uint32_t asn)
Return an allocated and initialized Secure Path Segment.
int rtr_bgpsec_get_algorithm_suites(const uint8_t **algs_arr)
Returns a pointer to a list that holds all supported algorithm suites.
uint16_t afi
Definition bgpsec.h:128
struct rtr_bgpsec_nlri * rtr_bgpsec_nlri_new(int nlri_len)
Allocate memory for a rtr_bgpsec_nlri struct.
void rtr_bgpsec_free_secure_path(struct rtr_secure_path_seg *seg)
Free a Secure Path Segment and any segments that are pointed to by rtr_secure_path_seg::next.
uint32_t target_as
Definition bgpsec.h:130
uint8_t nlri_len
Definition bgpsec.h:108
uint8_t alg
Definition bgpsec.h:126
uint8_t pcount
Definition bgpsec.h:76
uint16_t sig_len
Definition bgpsec.h:91
uint8_t * nlri
Definition bgpsec.h:109
uint8_t * signature
The signature of the segment.
Definition bgpsec.h:93
struct rtr_secure_path_seg * rtr_bgpsec_pop_secure_path_seg(struct rtr_bgpsec *bgpsec)
Pop off the first Secure Path Segment from a given rtr_bgpsec struct and return this Secure Path Segm...
int rtr_bgpsec_validate_as_path(const struct rtr_bgpsec *data, struct spki_table *table)
Validation function for AS path validation.
void rtr_bgpsec_add_spki_record(struct spki_table *table, struct spki_record *record)
Manually add a SPKI record into the SPKI table.
uint8_t ski[SKI_SIZE]
Definition rtr_pdus.h:5
uint8_t flags
Definition rtr_pdus.h:2
uint32_t asn
Definition rtr_pdus.h:6
This struct contains the Network Layer Reachability Information (NLRI).
Definition bgpsec.h:105
The data that is passed to the rtr_mgr_bgpsec_validate_as_path function.
Definition bgpsec.h:125
A single Secure Path Segment.
Definition bgpsec.h:73
A single Signature Segment.
Definition bgpsec.h:88
spki_record.
Definition spkitable.h:38
spki_table.
Definition ht-spkitable_private.h:27