]>
Commit | Line | Data |
---|---|---|
1fdc9eae | 1 | /* Declarations and definitions for kernel interaction over netlink |
2 | * Copyright (C) 2016 Cumulus Networks, Inc. | |
3 | * | |
4 | * This file is part of GNU Zebra. | |
5 | * | |
6 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2, or (at your option) any | |
9 | * later version. | |
10 | * | |
11 | * GNU Zebra is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * General Public License for more details. | |
15 | * | |
896014f4 DL |
16 | * You should have received a copy of the GNU General Public License along |
17 | * with this program; see the file COPYING; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
1fdc9eae | 19 | */ |
20 | ||
21 | #ifndef _ZEBRA_KERNEL_NETLINK_H | |
22 | #define _ZEBRA_KERNEL_NETLINK_H | |
23 | ||
24 | #ifdef HAVE_NETLINK | |
25 | ||
26 | #define NL_PKT_BUF_SIZE 8192 | |
27 | ||
28 | extern void netlink_parse_rtattr (struct rtattr **tb, int max, | |
29 | struct rtattr *rta, int len); | |
30 | extern int addattr_l (struct nlmsghdr *n, unsigned int maxlen, | |
c7450f9a | 31 | int type, void *data, unsigned int alen); |
1fdc9eae | 32 | extern int rta_addattr_l (struct rtattr *rta, unsigned int maxlen, |
c7450f9a | 33 | int type, void *data, unsigned int alen); |
bbc16902 | 34 | extern int addattr16 (struct nlmsghdr *n, unsigned int maxlen, |
35 | int type, u_int16_t data); | |
1fdc9eae | 36 | extern int addattr32 (struct nlmsghdr *n, unsigned int maxlen, |
37 | int type, int data); | |
38 | extern struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type); | |
39 | extern int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest); | |
40 | extern struct rtattr * rta_nest(struct rtattr *rta, int maxlen, int type); | |
41 | extern int rta_nest_end(struct rtattr *rta, struct rtattr *nest); | |
42 | extern const char * nl_msg_type_to_str (uint16_t msg_type); | |
43 | extern const char * nl_rtproto_to_str (u_char rtproto); | |
b339bde7 DS |
44 | extern const char * nl_family_to_str (u_char family); |
45 | extern const char * nl_rttype_to_str (u_char rttype); | |
1fdc9eae | 46 | |
47 | extern int netlink_parse_info (int (*filter) (struct sockaddr_nl *, | |
936ebf0a DS |
48 | struct nlmsghdr *, ns_id_t, int), |
49 | struct nlsock *nl, struct zebra_ns *zns, | |
50 | int count, int startup); | |
30359046 | 51 | extern int netlink_talk_filter (struct sockaddr_nl *, struct nlmsghdr *, |
936ebf0a | 52 | ns_id_t, int startup); |
30359046 | 53 | extern int netlink_talk (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *, |
936ebf0a | 54 | ns_id_t, int startup), |
30359046 | 55 | struct nlmsghdr *n, struct nlsock *nl, |
936ebf0a | 56 | struct zebra_ns *zns, int startup); |
289602d7 | 57 | extern int netlink_request (struct nlsock *nl, struct nlmsghdr *n); |
1fdc9eae | 58 | |
59 | #endif /* HAVE_NETLINK */ | |
60 | ||
61 | #endif /* _ZEBRA_KERNEL_NETLINK_H */ |