summaryrefslogtreecommitdiffstats
path: root/zebra/ge_netlink.h
blob: 20d09116c00a1404def593f09eea423b55ab7947 (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
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Header file exported by ge_netlink.c to zebra.
 * Copyright (C) 2022, Carmine Scarpitta
 */

#ifndef _ZEBRA_GE_NETLINK_H
#define _ZEBRA_GE_NETLINK_H

#include "zebra_dplane.h"

#ifdef HAVE_NETLINK

#include <linux/genetlink.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Generic Netlink request message */
struct genl_request {
	struct nlmsghdr n;
	struct genlmsghdr g;
	char buf[1024];
};

extern int genl_resolve_family(const char *family);
extern ssize_t netlink_sr_tunsrc_set_msg_encode(int cmd,
						struct zebra_dplane_ctx *ctx,
						void *buf, size_t buflen);
extern ssize_t netlink_sr_tunsrc_set_msg_encoder(struct zebra_dplane_ctx *ctx,
						 void *buf, size_t buflen);
struct nl_batch;
extern enum netlink_msg_status
netlink_put_sr_tunsrc_set_msg(struct nl_batch *bth,
			      struct zebra_dplane_ctx *ctx);

int netlink_sr_tunsrc_reply_read(struct nlmsghdr *h, ns_id_t ns_id, int startup);
int netlink_sr_tunsrc_read(struct zebra_ns *zns);

extern void ge_netlink_init(struct zebra_ns *zns);

#ifdef __cplusplus
}
#endif

#endif /* HAVE_NETLINK */

#endif /* _ZEBRA_GE_NETLINK_H */