summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-neighbor.h
blob: 1405ac25e2f8ee151546fc3de327df8805dfcdb1 (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
51
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once

#include "sd-netlink.h"

#include "conf-parser.h"
#include "ether-addr-util.h"
#include "in-addr-util.h"
#include "list.h"
#include "macro.h"

typedef struct Neighbor Neighbor;

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

typedef enum {
        NEIGHBOR_LLADDR_MAC,
        NEIGHBOR_LLADDR_IP,
        _NEIGHBOR_LLADDR_MAX,
        _NEIGHBOR_LLADDR_INVALID = -1,
} NeighborLLAddressType;

struct Neighbor {
        Network *network;
        Link *link;
        NetworkConfigSection *section;

        int family;
        union in_addr_union in_addr;
        union {
                struct ether_addr mac;
                union in_addr_union ip;
        } lladdr;
        NeighborLLAddressType lladdr_type;

        LIST_FIELDS(Neighbor, neighbors);
};

void neighbor_free(Neighbor *neighbor);

DEFINE_NETWORK_SECTION_FUNCTIONS(Neighbor, neighbor_free);

int neighbor_configure(Neighbor *neighbor, Link *link, link_netlink_message_handler_t callback);

int neighbor_section_verify(Neighbor *neighbor);

CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_address);
CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_hwaddr);
CONFIG_PARSER_PROTOTYPE(config_parse_neighbor_lladdr);