diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-09-25 14:26:26 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-09-25 14:26:26 +0200 |
commit | e245a809296dad1ea22956f015751cc172a44ad2 (patch) | |
tree | 38171f07be9f2a18e15212eef5fc6f3fd5516041 /src/ipcpd/normal/pol/graph.h | |
parent | baa9da56af12d14d63d504101c7efeb20da71a78 (diff) | |
download | ouroboros-e245a809296dad1ea22956f015751cc172a44ad2.tar.gz ouroboros-e245a809296dad1ea22956f015751cc172a44ad2.zip |
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.
Diffstat (limited to 'src/ipcpd/normal/pol/graph.h')
-rw-r--r-- | src/ipcpd/normal/pol/graph.h | 19 |
1 files changed, 14 insertions, 5 deletions
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 <inttypes.h> +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 */ |