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
52
53
54
55
56
57
58
59
|
/* Declarations and definitions for kernel interaction over netlink
* Copyright (C) 2016 Cumulus Networks, Inc.
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _ZEBRA_KERNEL_NETLINK_H
#define _ZEBRA_KERNEL_NETLINK_H
#ifdef HAVE_NETLINK
#define NL_PKT_BUF_SIZE 8192
extern void netlink_parse_rtattr (struct rtattr **tb, int max,
struct rtattr *rta, int len);
extern int addattr_l (struct nlmsghdr *n, unsigned int maxlen,
int type, void *data, unsigned int alen);
extern int rta_addattr_l (struct rtattr *rta, unsigned int maxlen,
int type, void *data, unsigned int alen);
extern int addattr32 (struct nlmsghdr *n, unsigned int maxlen,
int type, int data);
extern struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type);
extern int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest);
extern struct rtattr * rta_nest(struct rtattr *rta, int maxlen, int type);
extern int rta_nest_end(struct rtattr *rta, struct rtattr *nest);
extern const char * nl_msg_type_to_str (uint16_t msg_type);
extern const char * nl_rtproto_to_str (u_char rtproto);
extern const char * nl_family_to_str (u_char family);
extern const char * nl_rttype_to_str (u_char rttype);
extern int netlink_parse_info (int (*filter) (struct sockaddr_nl *,
struct nlmsghdr *, ns_id_t, int),
struct nlsock *nl, struct zebra_ns *zns,
int count, int startup);
extern int netlink_talk_filter (struct sockaddr_nl *, struct nlmsghdr *,
ns_id_t, int startup);
extern int netlink_talk (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *,
ns_id_t, int startup),
struct nlmsghdr *n, struct nlsock *nl,
struct zebra_ns *zns, int startup);
extern int netlink_request (int family, int type, struct nlsock *nl);
#endif /* HAVE_NETLINK */
#endif /* _ZEBRA_KERNEL_NETLINK_H */
|