summaryrefslogtreecommitdiffstats
path: root/lib/genl
diff options
context:
space:
mode:
authorThomas Graf <tgr@lsx.localdomain>2008-05-15 11:26:32 (GMT)
committerThomas Graf <tgr@lsx.localdomain>2008-05-15 11:26:32 (GMT)
commit1155370f520cb64657e25153255cf7dc1424317f (patch)
treebfa1323d2495dfe5729eb27d0536d4349f2a9d86 /lib/genl
parent0cf780859cbce363a6e2cd4b8d19c5498a3530f5 (diff)
downloadlibnl-1155370f520cb64657e25153255cf7dc1424317f.zip
libnl-1155370f520cb64657e25153255cf7dc1424317f.tar.gz
libnl-1155370f520cb64657e25153255cf7dc1424317f.tar.bz2
Rename struct nl_handle to struct nl_sock
The idea of a common handle is long revised and only misleading, nl_handle really represents a socket with some additional action handlers assigned to it. Alias for nl_handle is kept for backwards compatibility.
Diffstat (limited to 'lib/genl')
-rw-r--r--lib/genl/ctrl.c10
-rw-r--r--lib/genl/genl.c16
-rw-r--r--lib/genl/mngt.c8
3 files changed, 17 insertions, 17 deletions
diff --git a/lib/genl/ctrl.c b/lib/genl/ctrl.c
index fc08e14..f60cd1a 100644
--- a/lib/genl/ctrl.c
+++ b/lib/genl/ctrl.c
@@ -31,7 +31,7 @@
static struct nl_cache_ops genl_ctrl_ops;
/** @endcond */
-static int ctrl_request_update(struct nl_cache *c, struct nl_handle *h)
+static int ctrl_request_update(struct nl_cache *c, struct nl_sock *h)
{
return genl_send_simple(h, GENL_ID_CTRL, CTRL_CMD_GETFAMILY,
CTRL_VERSION, NLM_F_DUMP);
@@ -143,7 +143,7 @@ errout:
* @{
*/
-int genl_ctrl_alloc_cache(struct nl_handle *sock, struct nl_cache **result)
+int genl_ctrl_alloc_cache(struct nl_sock *sock, struct nl_cache **result)
{
return nl_cache_alloc_and_fill(&genl_ctrl_ops, sock, result);
}
@@ -216,7 +216,7 @@ struct genl_family *genl_ctrl_search_by_name(struct nl_cache *cache,
/**
* Resolve generic netlink family name to its identifier
- * @arg handle Netlink Handle
+ * @arg sk Netlink socket.
* @arg name Name of generic netlink family
*
* Resolves the generic netlink family name to its identifer and returns
@@ -224,13 +224,13 @@ struct genl_family *genl_ctrl_search_by_name(struct nl_cache *cache,
*
* @return A positive identifier or a negative error code.
*/
-int genl_ctrl_resolve(struct nl_handle *handle, const char *name)
+int genl_ctrl_resolve(struct nl_sock *sk, const char *name)
{
struct nl_cache *cache;
struct genl_family *family;
int err;
- if ((err = genl_ctrl_alloc_cache(handle, &cache)) < 0)
+ if ((err = genl_ctrl_alloc_cache(sk, &cache)) < 0)
return err;
family = genl_ctrl_search_by_name(cache, name);
diff --git a/lib/genl/genl.c b/lib/genl/genl.c
index cee7efd..4db17e9 100644
--- a/lib/genl/genl.c
+++ b/lib/genl/genl.c
@@ -6,7 +6,7 @@
* 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>
*/
/**
@@ -38,12 +38,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 +100,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 +114,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 +125,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 +133,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));
}
/** @} */
diff --git a/lib/genl/mngt.c b/lib/genl/mngt.c
index 7644352..0ebe74d 100644
--- a/lib/genl/mngt.c
+++ b/lib/genl/mngt.c
@@ -234,12 +234,12 @@ static int __genl_ops_resolve(struct nl_cache *ctrl, struct genl_ops *ops)
return -NLE_OBJ_NOTFOUND;
}
-int genl_ops_resolve(struct nl_handle *handle, struct genl_ops *ops)
+int genl_ops_resolve(struct nl_sock *sk, struct genl_ops *ops)
{
struct nl_cache *ctrl;
int err;
- if ((err = genl_ctrl_alloc_cache(handle, &ctrl)) < 0)
+ if ((err = genl_ctrl_alloc_cache(sk, &ctrl)) < 0)
goto errout;
err = __genl_ops_resolve(ctrl, ops);
@@ -249,13 +249,13 @@ errout:
return err;
}
-int genl_mngt_resolve(struct nl_handle *handle)
+int genl_mngt_resolve(struct nl_sock *sk)
{
struct nl_cache *ctrl;
struct genl_ops *ops;
int err = 0;
- if ((err = genl_ctrl_alloc_cache(handle, &ctrl)) < 0)
+ if ((err = genl_ctrl_alloc_cache(sk, &ctrl)) < 0)
goto errout;
nl_list_for_each_entry(ops, &genl_ops_list, o_list) {