huyc

导航

ipq_create_handle,ipq_destroy_handle

IPQ_CREATE_HANDLE(3) 2001-10-16

NAME
ipq_create_handle, ipq_destroy_handle —— 创建和销毁libipq句柄。

SYNOPSIS

#include <linux/netfilter.h>
#include <libipq.h>

struct ipq_handle *ipq_create_handle(u_int32_t flags, u_int32_t protocol);
int ipq_destroy_handle(struct ipq_handle *h);

DESCRIPTION
函数ipq_create_handle初始化为一个应用初始化libipq,尝试绑定ip_queue使用的Netlink套接字,并返回一个上下文无关的句柄。它应该是应用程序调用的第一个libipq函数。返回的句柄用于传递给所有接下来的需要句柄参数的库调用。

flags参数当前并不使用,处于兼容性考虑应该设置为0。

protocal参数用于指定排队的数据包的协议。有效值是NF_PROTO_IPV4和NFPROTO_IPV6。当前的实现仅允许一个句柄排队一种协议。

函数ipq_destroy_handle释放ipq_create_handle分配的资源,应该在句柄不再需要时使用。

RETURN VALUES
成功时,ipq_create_handle返回一个上下文句柄指针。

失败时返回NULL。

成功时,ipq_destroy_handle返回0。 
失败时返回-1。

ERRORS
失败时,可以通过ipq_errstr函数得到一个错误消息描述。

BUGS
None known.

AUTHOR
James Morris <jmorris@intercode.com.au>

COPYRIGHT
Copyright (c) 2000-2001 Netfilter Core Team.

Distributed under the GNU General Public License.

SEE ALSO
iptables(8), libipq(3).



posted on 2011-11-03 16:39  huyc  阅读(761)  评论(0编辑  收藏  举报