summaryrefslogtreecommitdiffstats
path: root/ffd/ffd.h
diff options
context:
space:
mode:
Diffstat (limited to 'ffd/ffd.h')
-rw-r--r--ffd/ffd.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/ffd/ffd.h b/ffd/ffd.h
index cf9d59c..e0f1954 100644
--- a/ffd/ffd.h
+++ b/ffd/ffd.h
@@ -40,6 +40,11 @@
#define FFD_HELLO_INTERVAL 400
#define FFD_IHU_INTERVAL (3*FFD_HELLO_INTERVAL)
+#define FFD_UPDATE_INTERVAL 400
+
+
+#define FFD_UPDATE_WITH_DATA 0x01
+
typedef struct __attribute__((packed)) _ffd_node_id_t {
uint8_t id[8];
@@ -77,9 +82,11 @@ typedef struct _ffd_metric_seqno_t {
typedef struct _ffd_nexthop_t {
struct _ffd_nexthop_t *next;
- struct timespec last_update;
- eth_addr_t addr;
+ struct _ffd_neigh_t *neigh;
ffd_metric_seqno_t metric_seqno;
+
+ struct timespec last_update;
+ uint16_t interval;
} ffd_nexthop_t;
typedef struct _ffd_announce_t {
@@ -88,21 +95,22 @@ typedef struct _ffd_announce_t {
ffd_node_id_t node;
uint16_t type;
uint16_t key;
- uint16_t interval;
-
- uint8_t len;
ffd_metric_seqno_t feasability_distance;
ffd_nexthop_t *selected;
ffd_nexthop_t *nexthop_list;
- uint8_t data[];
+ /* an incomplete announcement is specified by a len value of 0xff with NULL data */
+ uint8_t len;
+ uint8_t *data;
} ffd_announce_t;
typedef struct _ffd_neigh_t {
struct _ffd_neigh_t *next;
+ /* for actual routing, we'd also have to link back to the iface
+ this neighbour belongs to */
eth_addr_t addr;
uint16_t hello_log;
@@ -130,6 +138,8 @@ typedef struct _ffd_iface_t {
extern const eth_addr_t ffd_addr;
+extern ffd_node_id_t self;
+
extern ffd_iface_t *iface_list;
extern ffd_announce_t *announce_list;
@@ -137,11 +147,13 @@ extern int sockfd;
extern struct timespec now;
+bool ffd_is_feasable(const ffd_announce_t *announce, ffd_metric_seqno_t ms);
ffd_metric_seqno_t ffd_announce_get_metric(const ffd_announce_t *announce);
-ffd_announce_t* ffd_announce_new(size_t len);
+void ffd_announce_update_nexthop(ffd_announce_t *announce);
+ffd_announce_t* ffd_announce_new(void);
void ffd_send_hellos(void);
-void ffd_send_update(ffd_iface_t *iface, ffd_neigh_t *neigh, const ffd_announce_t *announce);
-void ffd_send_announce_request(ffd_iface_t *iface, ffd_neigh_t *neigh, ffd_node_id_t node, uint16_t type, uint16_t key);
+void ffd_send_update(ffd_iface_t *iface, ffd_neigh_t *neigh, ffd_announce_t *announce, bool with_data);
+void ffd_send_announce_request(ffd_iface_t *iface, ffd_neigh_t *neigh, ffd_node_id_t node, uint16_t type, uint16_t key, bool with_data);
#endif /* _FFD_FFD_H_ */