From e245a809296dad1ea22956f015751cc172a44ad2 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 25 Sep 2017 14:26:26 +0200 Subject: ipcpd: normal: Return list as routing table This returns a list as routing table instead of a pointer to a pointer to a pointer, which simplifies the looping through the routing table and makes it more extensible for future additions. --- src/ipcpd/normal/pol/graph.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/ipcpd/normal/pol/graph.h') diff --git a/src/ipcpd/normal/pol/graph.h b/src/ipcpd/normal/pol/graph.h index 8d092524..7340ecb9 100644 --- a/src/ipcpd/normal/pol/graph.h +++ b/src/ipcpd/normal/pol/graph.h @@ -28,9 +28,15 @@ #include +struct nhop { + struct list_head next; + uint64_t nhop; +}; + struct routing_table { - uint64_t dst; - uint64_t nhop; + struct list_head next; + uint64_t dst; + struct list_head nhops; }; struct graph * graph_create(void); @@ -46,8 +52,11 @@ int graph_del_edge(struct graph * graph, uint64_t s_addr, uint64_t d_addr); -ssize_t graph_routing_table(struct graph * graph, - uint64_t s_addr, - struct routing_table *** table); +int graph_routing_table(struct graph * graph, + uint64_t s_addr, + struct list_head * table); + +void graph_free_routing_table(struct graph * graph, + struct list_head * table); #endif /* OUROBOROS_IPCPD_NORMAL_GRAPH_H */ -- cgit v1.2.3