X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetlink.h;h=9cb1f81038b9049e77e41eb4610ec732a38aabbd;hb=c94238565522c51a117a7f89fecaabd2605b7c66;hp=dba7f02ea70e9ba86b22e81b66bbcd9d481dcbd9;hpb=25eeae6a1e12445c6d17b27d092f5936a6150892;p=openvswitch diff --git a/lib/netlink.h b/lib/netlink.h index dba7f02e..9cb1f810 100644 --- a/lib/netlink.h +++ b/lib/netlink.h @@ -49,6 +49,19 @@ 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. */ @@ -76,7 +89,14 @@ void nl_msg_put_u16(struct ofpbuf *, uint16_t type, uint16_t value); void nl_msg_put_u32(struct ofpbuf *, uint16_t type, uint32_t value); void nl_msg_put_u64(struct ofpbuf *, uint16_t type, uint64_t value); void nl_msg_put_string(struct ofpbuf *, uint16_t type, const char *value); -void nl_msg_put_nested(struct ofpbuf *, uint16_t type, struct ofpbuf *); + +size_t nl_msg_start_nested(struct ofpbuf *, uint16_t type); +void nl_msg_end_nested(struct ofpbuf *, size_t offset); +void nl_msg_put_nested(struct ofpbuf *, uint16_t type, + const void *data, size_t size); + +/* Separating buffers into individual messages. */ +struct nlmsghdr *nl_msg_next(struct ofpbuf *buffer, struct ofpbuf *msg); /* Netlink attribute types. */ enum nl_attr_type