]> git.proxmox.com Git - mirror_ovs.git/blame - lib/netdev-linux.h
rtnetlink: Document.
[mirror_ovs.git] / lib / netdev-linux.h
CommitLineData
e9e28be3
BP
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
d81c0ac5
BP
25/* A digested version of an rtnetlink message sent down by the kernel to
26 * indicate that a network device has been created or destroyed or changed. */
46097491 27struct rtnetlink_change {
e9e28be3
BP
28 /* Copied from struct nlmsghdr. */
29 int nlmsg_type; /* e.g. RTM_NEWLINK, RTM_DELLINK. */
30
31 /* Copied from struct ifinfomsg. */
32 int ifi_index; /* Index of network device. */
33
34 /* Extracted from Netlink attributes. */
35 const char *ifname; /* Name of network device. */
36 int master_ifindex; /* Ifindex of datapath master (0 if none). */
37};
38
d81c0ac5
BP
39/* Function called to report that a netdev has changed. 'change' describes the
40 * specific change. It may be null if the buffer of change information
41 * overflowed, in which case the function must assume that every device may
42 * have changed. 'aux' is as specified in the call to
43 * lxnetdev_notifier_register(). */
44typedef void rtnetlink_notify_func(const struct rtnetlink_change *, void *aux);
e9e28be3 45
46097491 46struct rtnetlink_notifier {
e9e28be3 47 struct list node;
46097491 48 rtnetlink_notify_func *cb;
e9e28be3
BP
49 void *aux;
50};
51
46097491
BP
52int rtnetlink_notifier_register(struct rtnetlink_notifier *,
53 rtnetlink_notify_func *, void *aux);
54void rtnetlink_notifier_unregister(struct rtnetlink_notifier *);
55void rtnetlink_notifier_run(void);
56void rtnetlink_notifier_wait(void);
e9e28be3
BP
57
58#endif /* netdev-linux.h */