1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
-module(fib).
-export([tables/0, current_table/0]).
-export([list/0, list/1]).
-export_types([table/0, flags/0, entry/0]).
-type table() :: non_neg_integer.
-type flags() :: [].
-type entry() :: #{destination := inet:ip_address() | default,
netmask := inet:ip_address() | undefined,
gateway := inet:ip_address() | {mac, string()} | {link, integer()},
scope := string() | undefined,
interface := string(),
flags := flags(),
expire := undefined}.
-spec tables() -> [table()].
tables() ->
persistent_term:get('fib/tables').
-spec current_table() -> table().
current_table() ->
persistent_term:get('fib/current_table').
-spec list() -> [entry()].
list() ->
Mod = mod(),
Mod:list(Mod:default_table()).
-spec list(table) -> [entry()].
list(Table) ->
Mod = mod(),
Mod:list(Table).
mod() ->
persistent_term:get('fib/module').
|