#include "../aspa.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
|
struct | aspa_array |
| Struct which is similar in function to std::vector from C++. More...
|
|
|
enum aspa_status | aspa_array_create (struct aspa_array **array_ptr) |
| Creates an vector object.
|
|
void | aspa_array_free (struct aspa_array *array, bool free_provider_arrays) |
| Deletes the given ASPA array.
|
|
enum aspa_status | aspa_array_insert (struct aspa_array *array, size_t index, struct aspa_record *record, bool copy_providers) |
| Inserts a given ASPA record into the array, preserving its order.
|
|
enum aspa_status | aspa_array_append (struct aspa_array *array, struct aspa_record *record, bool copy_providers) |
| Appends a given ASPA record to the array.
|
|
enum aspa_status | aspa_array_remove (struct aspa_array *array, size_t index, bool free_providers) |
| Removes the record at the given index from the array.
|
|
struct aspa_record * | aspa_array_get_record (struct aspa_array *array, size_t index) |
| Returns a reference to the record at the given index.
|
|
struct aspa_record * | aspa_array_search (struct aspa_array *array, uint32_t customer_asn) |
| Searches the given ASPA array for a record matching its customer ASN.
|
|
enum aspa_status | aspa_array_reserve (struct aspa_array *array, size_t size) |
| Reserves some space in the array.
|
|
◆ aspa_array_append()
Appends a given ASPA record to the array.
- Parameters
-
array | The ASPA array that will hold the new record. |
record | The record that will be appended to the array. |
copy_providers | A boolean value indicating whether the array should copy the record's providers before appending the record. |
- Returns
ASPA_SUCCESS
if the operation succeeds, ASPA_ERROR
if it fails.
◆ aspa_array_create()
Creates an vector object.
- Parameters
-
[in,out] | array_ptr | Pointer to a variable that will hold a reference to the newly created array. |
- Returns
ASPA_SUCCESS
if the operation succeeds, ASPA_ERROR
if it fails.
◆ aspa_array_free()
void aspa_array_free |
( |
struct aspa_array * |
array, |
|
|
bool |
free_provider_arrays |
|
) |
| |
Deletes the given ASPA array.
- Parameters
-
array | ASPA array which will be deleted |
free_provider_arrays | A boolean value determining whether each record's provider array should be deallocated. |
◆ aspa_array_get_record()
Returns a reference to the record at the given index.
- Parameters
-
array | ASPA array |
index | The index in the ASPA array. |
- Returns
- A reference to the
aspa_record
if found, NULL
otherwise.
◆ aspa_array_insert()
Inserts a given ASPA record into the array, preserving its order.
- Parameters
-
array | The ASPA array that will hold the new record. |
index | The index at which the new record will be stored. |
record | The new record. |
copy_providers | A boolean value indicating whether the array should copy the record's providers before inserting the record. |
- Returns
ASPA_SUCCESS
if the operation succeeds, ASPA_ERROR
if it fails.
◆ aspa_array_remove()
Removes the record at the given index from the array.
- Parameters
-
array | The array to remove the record from. |
index | The record's index. |
free_providers | A boolean value determining whether to free the existing record's provider array. |
- Returns
ASPA_SUCCESS
if the operation succeeds, ASPA_RECORD_NOT_FOUND
if the record's index doesn't exist, ASPA_ERROR
otherwise.
◆ aspa_array_reserve()
Reserves some space in the array.
- Parameters
-
array | The array to remove the record from. |
size | the number of object that should definetly fit into the array |
- Returns
ASPA_SUCCESS
if the operation succeeds ASPA_ERROR
otherwise.
◆ aspa_array_search()
Searches the given ASPA array for a record matching its customer ASN.
- Parameters
-
array | The array to search. |
customer_asn | Customer ASN |
- Returns
- A reference to the
aspa_record
if found, NULL
otherwise.