2 * Copyright (c) 2009 Nicira Networks.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef NETDEV_LINUX_H
18 #define NETDEV_LINUX_H 1
20 /* These functions are specific to the Linux implementation of dpif and netdev.
21 * They should only be used directly by Linux-specific code. */
25 struct linux_netdev_change {
26 /* Copied from struct nlmsghdr. */
27 int nlmsg_type; /* e.g. RTM_NEWLINK, RTM_DELLINK. */
29 /* Copied from struct ifinfomsg. */
30 int ifi_index; /* Index of network device. */
32 /* Extracted from Netlink attributes. */
33 const char *ifname; /* Name of network device. */
34 int master_ifindex; /* Ifindex of datapath master (0 if none). */
37 typedef void linux_netdev_notify_func(const struct linux_netdev_change *,
40 struct linux_netdev_notifier {
43 linux_netdev_notify_func *cb;
47 int linux_netdev_notifier_register(struct linux_netdev_notifier *,
48 linux_netdev_notify_func *, void *aux);
49 void linux_netdev_notifier_unregister(struct linux_netdev_notifier *);
50 int linux_netdev_notifier_get_error(struct linux_netdev_notifier *);
51 int linux_netdev_notifier_peek_error(const struct linux_netdev_notifier *);
52 void linux_netdev_notifier_run(void);
53 void linux_netdev_notifier_wait(void);
55 #endif /* netdev-linux.h */