]>
Commit | Line | Data |
---|---|---|
21d6e22e | 1 | /* |
7e9dcc0f | 2 | * Copyright (c) 2009, 2015 Nicira, Inc. |
21d6e22e EJ |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at: | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | #ifndef RTNETLINK_LINK_H | |
18 | #define RTNETLINK_LINK_H 1 | |
19 | ||
ea83a2fc | 20 | #include <stdbool.h> |
44445cac PS |
21 | #include <stdint.h> |
22 | #include <linux/if_ether.h> | |
ea83a2fc | 23 | |
74ff3298 JR |
24 | #include "openvswitch/types.h" |
25 | ||
ea83a2fc | 26 | struct ofpbuf; |
0a811051 | 27 | struct nln_notifier; |
21d6e22e EJ |
28 | |
29 | /* These functions are Linux specific, so they should be used directly only by | |
30 | * Linux-specific code. */ | |
31 | ||
32 | /* A digested version of an rtnetlink_link message sent down by the kernel to | |
7e9dcc0f AW |
33 | * indicate that a network device's status (link or address) has been changed. |
34 | */ | |
35 | struct rtnetlink_change { | |
21d6e22e EJ |
36 | /* Copied from struct nlmsghdr. */ |
37 | int nlmsg_type; /* e.g. RTM_NEWLINK, RTM_DELLINK. */ | |
38 | ||
7e9dcc0f AW |
39 | /* Common attributes. */ |
40 | int if_index; /* Index of network device. */ | |
21d6e22e | 41 | const char *ifname; /* Name of network device. */ |
7e9dcc0f AW |
42 | |
43 | /* Network device link status. */ | |
21d6e22e | 44 | int master_ifindex; /* Ifindex of datapath master (0 if none). */ |
90a6637d | 45 | int mtu; /* Current MTU. */ |
74ff3298 | 46 | struct eth_addr mac; |
c37d4da4 | 47 | unsigned int ifi_flags; /* Flags of network device. */ |
7e9dcc0f AW |
48 | |
49 | /* Network device address status. */ | |
50 | /* xxx To be added when needed. */ | |
135ee7ef | 51 | |
91fc374a BP |
52 | /* Link bonding info. */ |
53 | const char *primary; /* Kind of primary (NULL if not primary). */ | |
54 | const char *sub; /* Kind of subordinate (NULL if not sub). */ | |
21d6e22e EJ |
55 | }; |
56 | ||
57 | /* Function called to report that a netdev has changed. 'change' describes the | |
58 | * specific change. It may be null if the buffer of change information | |
59 | * overflowed, in which case the function must assume that every device may | |
60 | * have changed. 'aux' is as specified in the call to | |
7e9dcc0f | 61 | * rtnetlink_notifier_register(). */ |
21d6e22e | 62 | typedef |
7e9dcc0f AW |
63 | void rtnetlink_notify_func(const struct rtnetlink_change *change, |
64 | void *aux); | |
21d6e22e | 65 | |
7e9dcc0f AW |
66 | bool rtnetlink_type_is_rtnlgrp_link(uint16_t type); |
67 | bool rtnetlink_type_is_rtnlgrp_addr(uint16_t type); | |
68 | bool rtnetlink_parse(struct ofpbuf *buf, struct rtnetlink_change *change); | |
2ee6545f | 69 | struct nln_notifier * |
7e9dcc0f AW |
70 | rtnetlink_notifier_create(rtnetlink_notify_func *, void *aux); |
71 | void rtnetlink_notifier_destroy(struct nln_notifier *); | |
72 | void rtnetlink_run(void); | |
73 | void rtnetlink_wait(void); | |
e8e1a409 | 74 | void rtnetlink_report_link(void); |
7e9dcc0f | 75 | #endif /* rtnetlink.h */ |