diff options
author | Franciszek Malinka <franciszek.malinka@gmail.com> | 2021-04-19 08:41:26 +0200 |
---|---|---|
committer | Franciszek Malinka <franciszek.malinka@gmail.com> | 2021-04-19 08:41:26 +0200 |
commit | 1078d2387db43d0c7e982d1ba3340dc67fe0fed9 (patch) | |
tree | ebb144225320e2559b29cc49efb6b5eea03183c5 /Semestr 4/sieci/pracownia2/router/dist_vector.h | |
parent | 4167f191cec04314082896ca4618663e97b4f4f1 (diff) |
Router update
Diffstat (limited to 'Semestr 4/sieci/pracownia2/router/dist_vector.h')
-rw-r--r-- | Semestr 4/sieci/pracownia2/router/dist_vector.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Semestr 4/sieci/pracownia2/router/dist_vector.h b/Semestr 4/sieci/pracownia2/router/dist_vector.h new file mode 100644 index 0000000..cd1a995 --- /dev/null +++ b/Semestr 4/sieci/pracownia2/router/dist_vector.h @@ -0,0 +1,24 @@ +#ifndef DIST_VECTOR_H +#define DIST_VECTOR_H + +#include "linked_list.h" +#include "network_addr.h" + +/* Item of the distance vector. + * If <<reachable>> is set to 0, then it means that the network is reachable. + * If <<reachable>> has positive value, then it indicates that the network was + * unreachable for <<reachable>> turns. + */ +struct vector_item { + struct network_addr network; + router_addr via_ip; + uint8_t reachable; +}; + +/* Returns true if given distance vector item is connected directly, false otherwise */ +bool is_connected_directly(struct vector_item item); + +/* Updates the distance vector. */ +void update_distance_vector(list_t *distance_vector, struct vector_item new_item); + +#endif
\ No newline at end of file |