summaryrefslogtreecommitdiff
path: root/lib/netlink.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-12-10 09:51:03 -0800
committerBen Pfaff <blp@nicira.com>2010-12-10 11:13:27 -0800
commit2fe27d5ad27f3c7879ea696209bcf9702d9b7109 (patch)
tree943745f56a960fcd88b14205271fbf4d7d987f6f /lib/netlink.h
parent365a25176bf854112b37c56888979d7755ab0d72 (diff)
downloadopenvswitch-2fe27d5ad27f3c7879ea696209bcf9702d9b7109.tar.gz
netlink: Split into generic and Linux-specific parts.
The parts of the netlink module that are related to sockets are Linux-specific, since only Linux has AF_NETLINK sockets. The rest can be built anywhere. This commit breaks them into two modules, and builds the generic one on all platforms. Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'lib/netlink.h')
-rw-r--r--lib/netlink.h47
1 files changed, 8 insertions, 39 deletions
diff --git a/lib/netlink.h b/lib/netlink.h
index 9cb1f8103..127a41b7b 100644
--- a/lib/netlink.h
+++ b/lib/netlink.h
@@ -17,54 +17,27 @@
#ifndef NETLINK_H
#define NETLINK_H 1
-/* Netlink interface.
+/* Netlink message helpers.
*
* Netlink is a datagram-based network protocol primarily for communication
* between user processes and the kernel, and mainly on Linux. Netlink is
* specified in RFC 3549, "Linux Netlink as an IP Services Protocol".
*
* Netlink is not suitable for use in physical networks of heterogeneous
- * machines because host byte order is used throughout. */
+ * machines because host byte order is used throughout.
+ *
+ * This header file defines helper functions for working with Netlink messages.
+ * For Netlink protocol definitions, see netlink-protocol.h. For
+ * Linux-specific definitions for Netlink sockets, see netlink-socket.h.
+ */
#include <stdbool.h>
-#include <sys/uio.h>
+#include <stddef.h>
#include <stdint.h>
struct ofpbuf;
-struct nl_sock;
struct nlattr;
-/* Netlink sockets. */
-
-int nl_sock_create(int protocol, int multicast_group,
- size_t so_sndbuf, size_t so_rcvbuf,
- struct nl_sock **);
-void nl_sock_destroy(struct nl_sock *);
-
-int nl_sock_send(struct nl_sock *, const struct ofpbuf *, bool wait);
-int nl_sock_sendv(struct nl_sock *sock, const struct iovec iov[], size_t n_iov,
- bool wait);
-int nl_sock_recv(struct nl_sock *, struct ofpbuf **, bool wait);
-int nl_sock_transact(struct nl_sock *, const struct ofpbuf *request,
- struct ofpbuf **reply);
-
-void nl_sock_wait(const struct nl_sock *, short int events);
-
-/* Table dumping. */
-struct nl_dump {
- struct nl_sock *sock; /* Socket being dumped. */
- uint32_t seq; /* Expected nlmsg_seq for replies. */
- struct ofpbuf *buffer; /* Receive buffer currently being iterated. */
- int status; /* 0=OK, EOF=done, or positive errno value. */
-};
-
-void nl_dump_start(struct nl_dump *, struct nl_sock *,
- const struct ofpbuf *request);
-bool nl_dump_next(struct nl_dump *, struct ofpbuf *reply);
-int nl_dump_done(struct nl_dump *);
-
-/* Netlink messages. */
-
/* Accessing headers and data. */
struct nlmsghdr *nl_msg_nlmsghdr(const struct ofpbuf *);
struct genlmsghdr *nl_msg_genlmsghdr(const struct ofpbuf *);
@@ -141,9 +114,5 @@ bool nl_policy_parse(const struct ofpbuf *, size_t offset,
struct nlattr *[], size_t n_attrs);
bool nl_parse_nested(const struct nlattr *, const struct nl_policy[],
struct nlattr *[], size_t n_attrs);
-
-/* Miscellaneous. */
-
-int nl_lookup_genl_family(const char *name, int *number);
#endif /* netlink.h */