summaryrefslogtreecommitdiff
path: root/src/network/networkd-nexthop.h
blob: 28cbdad738e770e42c56b31914932a3407f325f9 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
/* SPDX-License-Identifier: LGPL-2.1+
 * Copyright © 2019 VMware, Inc.
 */

#pragma once

#include "conf-parser.h"
#include "macro.h"

typedef struct NextHop NextHop;
typedef struct NetworkConfigSection NetworkConfigSection;

#include "networkd-network.h"
#include "networkd-util.h"

struct NextHop {
        Network *network;
        NetworkConfigSection *section;

        Link *link;

        unsigned char protocol;

        int family;
        uint32_t oif;
        uint32_t id;

        union in_addr_union gw;

        LIST_FIELDS(NextHop, nexthops);
};

extern const struct hash_ops nexthop_hash_ops;

int nexthop_new(NextHop **ret);
void nexthop_free(NextHop *nexthop);
int nexthop_configure(NextHop *nexthop, Link *link, link_netlink_message_handler_t callback);
int nexthop_remove(NextHop *nexthop, Link *link, link_netlink_message_handler_t callback);

int nexthop_get(Link *link, NextHop *in, NextHop **ret);
int nexthop_add(Link *link, NextHop *in, NextHop **ret);
int nexthop_add_foreign(Link *link, NextHop *in, NextHop **ret);
bool nexthop_equal(NextHop *r1, NextHop *r2);

int nexthop_section_verify(NextHop *nexthop);

DEFINE_NETWORK_SECTION_FUNCTIONS(NextHop, nexthop_free);

CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_id);
CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_gateway);