diff options
author | Thomas Graf <tgr@lsx.localdomain> | 2008-05-15 11:26:32 (GMT) |
---|---|---|
committer | Thomas Graf <tgr@lsx.localdomain> | 2008-05-15 11:26:32 (GMT) |
commit | 1155370f520cb64657e25153255cf7dc1424317f (patch) | |
tree | bfa1323d2495dfe5729eb27d0536d4349f2a9d86 /lib/netfilter | |
parent | 0cf780859cbce363a6e2cd4b8d19c5498a3530f5 (diff) | |
download | libnl-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/netfilter')
-rw-r--r-- | lib/netfilter/ct.c | 32 | ||||
-rw-r--r-- | lib/netfilter/log.c | 16 | ||||
-rw-r--r-- | lib/netfilter/nfnl.c | 16 | ||||
-rw-r--r-- | lib/netfilter/queue.c | 16 | ||||
-rw-r--r-- | lib/netfilter/queue_msg.c | 2 |
5 files changed, 41 insertions, 41 deletions
diff --git a/lib/netfilter/ct.c b/lib/netfilter/ct.c index cdd50a7..beb1dc5 100644 --- a/lib/netfilter/ct.c +++ b/lib/netfilter/ct.c @@ -374,15 +374,15 @@ errout: return err; } -int nfnl_ct_dump_request(struct nl_handle *h) +int nfnl_ct_dump_request(struct nl_sock *sk) { - return nfnl_send_simple(h, NFNL_SUBSYS_CTNETLINK, IPCTNL_MSG_CT_GET, + return nfnl_send_simple(sk, NFNL_SUBSYS_CTNETLINK, IPCTNL_MSG_CT_GET, NLM_F_DUMP, AF_UNSPEC, 0); } -static int ct_request_update(struct nl_cache *c, struct nl_handle *h) +static int ct_request_update(struct nl_cache *cache, struct nl_sock *sk) { - return nfnl_ct_dump_request(h); + return nfnl_ct_dump_request(sk); } static int nfnl_ct_build_tuple(struct nl_msg *msg, const struct nfnl_ct *ct, @@ -480,7 +480,7 @@ int nfnl_ct_build_add_request(const struct nfnl_ct *ct, int flags, return nfnl_ct_build_message(ct, IPCTNL_MSG_CT_NEW, flags, result); } -int nfnl_ct_add(struct nl_handle *h, const struct nfnl_ct *ct, int flags) +int nfnl_ct_add(struct nl_sock *sk, const struct nfnl_ct *ct, int flags) { struct nl_msg *msg; int err; @@ -488,12 +488,12 @@ int nfnl_ct_add(struct nl_handle *h, const struct nfnl_ct *ct, int flags) if ((err = nfnl_ct_build_add_request(ct, flags, &msg)) < 0) return err; - err = nl_send_auto_complete(h, msg); + err = nl_send_auto_complete(sk, msg); nlmsg_free(msg); if (err < 0) return err; - return nl_wait_for_ack(h); + return nl_wait_for_ack(sk); } int nfnl_ct_build_delete_request(const struct nfnl_ct *ct, int flags, @@ -502,7 +502,7 @@ int nfnl_ct_build_delete_request(const struct nfnl_ct *ct, int flags, return nfnl_ct_build_message(ct, IPCTNL_MSG_CT_DELETE, flags, result); } -int nfnl_ct_del(struct nl_handle *h, const struct nfnl_ct *ct, int flags) +int nfnl_ct_del(struct nl_sock *sk, const struct nfnl_ct *ct, int flags) { struct nl_msg *msg; int err; @@ -510,12 +510,12 @@ int nfnl_ct_del(struct nl_handle *h, const struct nfnl_ct *ct, int flags) if ((err = nfnl_ct_build_delete_request(ct, flags, &msg)) < 0) return err; - err = nl_send_auto_complete(h, msg); + err = nl_send_auto_complete(sk, msg); nlmsg_free(msg); if (err < 0) return err; - return nl_wait_for_ack(h); + return nl_wait_for_ack(sk); } int nfnl_ct_build_query_request(const struct nfnl_ct *ct, int flags, @@ -524,7 +524,7 @@ int nfnl_ct_build_query_request(const struct nfnl_ct *ct, int flags, return nfnl_ct_build_message(ct, IPCTNL_MSG_CT_GET, flags, result); } -int nfnl_ct_query(struct nl_handle *h, const struct nfnl_ct *ct, int flags) +int nfnl_ct_query(struct nl_sock *sk, const struct nfnl_ct *ct, int flags) { struct nl_msg *msg; int err; @@ -532,12 +532,12 @@ int nfnl_ct_query(struct nl_handle *h, const struct nfnl_ct *ct, int flags) if ((err = nfnl_ct_build_query_request(ct, flags, &msg)) < 0) return err; - err = nl_send_auto_complete(h, msg); + err = nl_send_auto_complete(sk, msg); nlmsg_free(msg); if (err < 0) return err; - return nl_wait_for_ack(h); + return nl_wait_for_ack(sk); } /** @@ -547,7 +547,7 @@ int nfnl_ct_query(struct nl_handle *h, const struct nfnl_ct *ct, int flags) /** * Build a conntrack cache holding all conntrack currently in the kernel - * @arg handle netlink handle + * @arg sk Netlink socket. * @arg result Pointer to store resulting cache. * * Allocates a new cache, initializes it properly and updates it to @@ -555,9 +555,9 @@ int nfnl_ct_query(struct nl_handle *h, const struct nfnl_ct *ct, int flags) * * @return 0 on success or a negative error code. */ -int nfnl_ct_alloc_cache(struct nl_handle *sock, struct nl_cache **result) +int nfnl_ct_alloc_cache(struct nl_sock *sk, struct nl_cache **result) { - return nl_cache_alloc_and_fill(&nfnl_ct_ops, sock, result); + return nl_cache_alloc_and_fill(&nfnl_ct_ops, sk, result); } /** @} */ diff --git a/lib/netfilter/log.c b/lib/netfilter/log.c index 0cfbc87..6d3e23a 100644 --- a/lib/netfilter/log.c +++ b/lib/netfilter/log.c @@ -54,16 +54,16 @@ nla_put_failure: return -NLE_MSGSIZE; } -static int send_log_request(struct nl_handle *handle, struct nl_msg *msg) +static int send_log_request(struct nl_sock *sk, struct nl_msg *msg) { int err; - err = nl_send_auto_complete(handle, msg); + err = nl_send_auto_complete(sk, msg); nlmsg_free(msg); if (err < 0) return err; - return nl_wait_for_ack(handle); + return nl_wait_for_ack(sk); } int nfnl_log_build_pf_bind(uint8_t pf, struct nl_msg **result) @@ -71,7 +71,7 @@ int nfnl_log_build_pf_bind(uint8_t pf, struct nl_msg **result) return build_log_cmd_request(pf, 0, NFULNL_CFG_CMD_PF_BIND, result); } -int nfnl_log_pf_bind(struct nl_handle *nlh, uint8_t pf) +int nfnl_log_pf_bind(struct nl_sock *nlh, uint8_t pf) { struct nl_msg *msg; int err; @@ -87,7 +87,7 @@ int nfnl_log_build_pf_unbind(uint8_t pf, struct nl_msg **result) return build_log_cmd_request(pf, 0, NFULNL_CFG_CMD_PF_UNBIND, result); } -int nfnl_log_pf_unbind(struct nl_handle *nlh, uint8_t pf) +int nfnl_log_pf_unbind(struct nl_sock *nlh, uint8_t pf) { struct nl_msg *msg; int err; @@ -179,7 +179,7 @@ nla_put_failure: return -NLE_MSGSIZE; } -int nfnl_log_create(struct nl_handle *nlh, const struct nfnl_log *log) +int nfnl_log_create(struct nl_sock *nlh, const struct nfnl_log *log) { struct nl_msg *msg; int err; @@ -196,7 +196,7 @@ int nfnl_log_build_change_request(const struct nfnl_log *log, return nfnl_log_build_request(log, result); } -int nfnl_log_change(struct nl_handle *nlh, const struct nfnl_log *log) +int nfnl_log_change(struct nl_sock *nlh, const struct nfnl_log *log) { struct nl_msg *msg; int err; @@ -217,7 +217,7 @@ int nfnl_log_build_delete_request(const struct nfnl_log *log, NFULNL_CFG_CMD_UNBIND, result); } -int nfnl_log_delete(struct nl_handle *nlh, const struct nfnl_log *log) +int nfnl_log_delete(struct nl_sock *nlh, const struct nfnl_log *log) { struct nl_msg *msg; int err; diff --git a/lib/netfilter/nfnl.c b/lib/netfilter/nfnl.c index 2441f69..b687636 100644 --- a/lib/netfilter/nfnl.c +++ b/lib/netfilter/nfnl.c @@ -47,7 +47,7 @@ * nla_put_u32(msg, 1, 0x10); * * // Message is ready to be sent. - * nl_send_auto_complete(nl_handle, msg); + * nl_send_auto_complete(sk, msg); * * // All done? Free the message. * nlmsg_free(msg); @@ -57,7 +57,7 @@ * @code * // For trivial messages not requiring any subsys specific header or * // attributes, nfnl_send_simple() may be used to send messages directly. - * nfnl_send_simple(nl_handle, SUBSYS, TYPE, 0, FAMILY, RES_ID); + * nfnl_send_simple(sk, SUBSYS, TYPE, 0, FAMILY, RES_ID); * @endcode * @{ */ @@ -73,7 +73,7 @@ /** * Create and connect netfilter netlink socket. - * @arg handle Netlink handle. + * @arg sk Netlink socket. * * Creates a NETLINK_NETFILTER netlink socket, binds the socket and * issues a connection attempt. @@ -82,9 +82,9 @@ * * @return 0 on success or a negative error code. */ -int nfnl_connect(struct nl_handle *handle) +int nfnl_connect(struct nl_sock *sk) { - return nl_connect(handle, NETLINK_NETFILTER); + return nl_connect(sk, NETLINK_NETFILTER); } /** @} */ @@ -96,7 +96,7 @@ int nfnl_connect(struct nl_handle *handle) /** * Send trivial netfilter netlink message - * @arg handle Netlink handle. + * @arg sk Netlink socket. * @arg subsys_id nfnetlink subsystem * @arg type nfnetlink message type * @arg flags message flags @@ -105,7 +105,7 @@ int nfnl_connect(struct nl_handle *handle) * * @return Newly allocated netlink message or NULL. */ -int nfnl_send_simple(struct nl_handle *handle, uint8_t subsys_id, uint8_t type, +int nfnl_send_simple(struct nl_sock *sk, uint8_t subsys_id, uint8_t type, int flags, uint8_t family, uint16_t res_id) { struct nfgenmsg hdr = { @@ -114,7 +114,7 @@ int nfnl_send_simple(struct nl_handle *handle, uint8_t subsys_id, uint8_t type, .res_id = htons(res_id), }; - return nl_send_simple(handle, NFNLMSG_TYPE(subsys_id, type), flags, + return nl_send_simple(sk, NFNLMSG_TYPE(subsys_id, type), flags, &hdr, sizeof(hdr)); } diff --git a/lib/netfilter/queue.c b/lib/netfilter/queue.c index 7f31c66..3af2a48 100644 --- a/lib/netfilter/queue.c +++ b/lib/netfilter/queue.c @@ -24,16 +24,16 @@ #include <netlink/netfilter/nfnl.h> #include <netlink/netfilter/queue.h> -static int send_queue_request(struct nl_handle *handle, struct nl_msg *msg) +static int send_queue_request(struct nl_sock *sk, struct nl_msg *msg) { int err; - err = nl_send_auto_complete(handle, msg); + err = nl_send_auto_complete(sk, msg); nlmsg_free(msg); if (err < 0) return err; - return nl_wait_for_ack(handle); + return nl_wait_for_ack(sk); } /** @@ -71,7 +71,7 @@ int nfnl_queue_build_pf_bind(uint8_t pf, struct nl_msg **result) return build_queue_cmd_request(pf, 0, NFQNL_CFG_CMD_PF_BIND, result); } -int nfnl_queue_pf_bind(struct nl_handle *nlh, uint8_t pf) +int nfnl_queue_pf_bind(struct nl_sock *nlh, uint8_t pf) { struct nl_msg *msg; int err; @@ -87,7 +87,7 @@ int nfnl_queue_build_pf_unbind(uint8_t pf, struct nl_msg **result) return build_queue_cmd_request(pf, 0, NFQNL_CFG_CMD_PF_UNBIND, result); } -int nfnl_queue_pf_unbind(struct nl_handle *nlh, uint8_t pf) +int nfnl_queue_pf_unbind(struct nl_sock *nlh, uint8_t pf) { struct nl_msg *msg; int err; @@ -169,7 +169,7 @@ nla_put_failure: return -NLE_MSGSIZE; } -int nfnl_queue_create(struct nl_handle *nlh, const struct nfnl_queue *queue) +int nfnl_queue_create(struct nl_sock *nlh, const struct nfnl_queue *queue) { struct nl_msg *msg; int err; @@ -186,7 +186,7 @@ int nfnl_queue_build_change_request(const struct nfnl_queue *queue, return nfnl_queue_build_request(queue, result); } -int nfnl_queue_change(struct nl_handle *nlh, const struct nfnl_queue *queue) +int nfnl_queue_change(struct nl_sock *nlh, const struct nfnl_queue *queue) { struct nl_msg *msg; int err; @@ -207,7 +207,7 @@ int nfnl_queue_build_delete_request(const struct nfnl_queue *queue, NFQNL_CFG_CMD_UNBIND, result); } -int nfnl_queue_delete(struct nl_handle *nlh, const struct nfnl_queue *queue) +int nfnl_queue_delete(struct nl_sock *nlh, const struct nfnl_queue *queue) { struct nl_msg *msg; int err; diff --git a/lib/netfilter/queue_msg.c b/lib/netfilter/queue_msg.c index 6d6ca73..ec461a5 100644 --- a/lib/netfilter/queue_msg.c +++ b/lib/netfilter/queue_msg.c @@ -194,7 +194,7 @@ nla_put_failure: return NULL; } -int nfnl_queue_msg_send_verdict(struct nl_handle *nlh, +int nfnl_queue_msg_send_verdict(struct nl_sock *nlh, const struct nfnl_queue_msg *msg) { struct nl_msg *nlmsg; |