diff options
Diffstat (limited to 'lib/genl/genl.c')
-rw-r--r-- | lib/genl/genl.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/genl/genl.c b/lib/genl/genl.c index 04cfebf..055be91 100644 --- a/lib/genl/genl.c +++ b/lib/genl/genl.c @@ -6,11 +6,10 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> */ /** - * @ingroup nlfam * @defgroup genl Generic Netlink * * @par Message Format @@ -38,12 +37,12 @@ * #include <netlink/genl/genl.h> * #include <netlink/genl/ctrl.h> * - * struct nl_handle *sock; + * struct nl_sock *sock; * struct nl_msg *msg; * int family; * * // Allocate a new netlink socket - * sock = nl_handle_alloc(); + * sock = nl_socket_alloc(); * * // Connect to generic netlink socket on kernel side * genl_connect(sock); @@ -100,9 +99,9 @@ * @{ */ -int genl_connect(struct nl_handle *handle) +int genl_connect(struct nl_sock *sk) { - return nl_connect(handle, NETLINK_GENERIC); + return nl_connect(sk, NETLINK_GENERIC); } /** @} */ @@ -114,7 +113,7 @@ int genl_connect(struct nl_handle *handle) /** * Send trivial generic netlink message - * @arg handle Netlink handle. + * @arg sk Netlink socket. * @arg family Generic netlink family * @arg cmd Command * @arg version Version @@ -125,7 +124,7 @@ int genl_connect(struct nl_handle *handle) * * @return 0 on success or a negative error code. */ -int genl_send_simple(struct nl_handle *handle, int family, int cmd, +int genl_send_simple(struct nl_sock *sk, int family, int cmd, int version, int flags) { struct genlmsghdr hdr = { @@ -133,7 +132,7 @@ int genl_send_simple(struct nl_handle *handle, int family, int cmd, .version = version, }; - return nl_send_simple(handle, family, flags, &hdr, sizeof(hdr)); + return nl_send_simple(sk, family, flags, &hdr, sizeof(hdr)); } /** @} */ @@ -164,7 +163,7 @@ int genlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, struct genlmsghdr *ghdr; if (!genlmsg_valid_hdr(nlh, hdrlen)) - return nl_errno(EINVAL); + return -NLE_MSG_TOOSHORT; ghdr = nlmsg_data(nlh); return nla_validate(genlmsg_attrdata(ghdr, hdrlen), @@ -177,7 +176,7 @@ int genlmsg_parse(struct nlmsghdr *nlh, int hdrlen, struct nlattr *tb[], struct genlmsghdr *ghdr; if (!genlmsg_valid_hdr(nlh, hdrlen)) - return nl_errno(EINVAL); + return -NLE_MSG_TOOSHORT; ghdr = nlmsg_data(nlh); return nla_parse(tb, maxtype, genlmsg_attrdata(ghdr, hdrlen), |