]> git.proxmox.com Git - mirror_ovs.git/blob - lib/netdev-linux.h
netdev: Implement an abstract interface to network devices.
[mirror_ovs.git] / lib / netdev-linux.h
1 /*
2 * Copyright (c) 2009 Nicira Networks.
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 NETDEV_LINUX_H
18 #define NETDEV_LINUX_H 1
19
20 /* These functions are specific to the Linux implementation of dpif and netdev.
21 * They should only be used directly by Linux-specific code. */
22
23 #include "list.h"
24
25 struct linux_netdev_change {
26 /* Copied from struct nlmsghdr. */
27 int nlmsg_type; /* e.g. RTM_NEWLINK, RTM_DELLINK. */
28
29 /* Copied from struct ifinfomsg. */
30 int ifi_index; /* Index of network device. */
31
32 /* Extracted from Netlink attributes. */
33 const char *ifname; /* Name of network device. */
34 int master_ifindex; /* Ifindex of datapath master (0 if none). */
35 };
36
37 typedef void linux_netdev_notify_func(const struct linux_netdev_change *,
38 void *aux);
39
40 struct linux_netdev_notifier {
41 struct list node;
42 linux_netdev_notify_func *cb;
43 void *aux;
44 };
45
46 int linux_netdev_notifier_register(struct linux_netdev_notifier *,
47 linux_netdev_notify_func *, void *aux);
48 void linux_netdev_notifier_unregister(struct linux_netdev_notifier *);
49 void linux_netdev_notifier_run(void);
50 void linux_netdev_notifier_wait(void);
51
52 #endif /* netdev-linux.h */