我使用qt做了一个防火墙的界面,生成了firewall.ui文件,然后导入到kdevelop的工程中,运行的时候
界面可以显示出来
下面的问题,是我需要调用netfilter/iptables的一些函数,包含一些头文件,我应该怎么添加那?
比如下面的代码,如果使用gcc编译,是可以成功的,但是我想把这个功能加入到我的kdevelop工程
中去,应该怎么操作那?
请大家指点,谢谢啦
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
static struct nf_hook_ops nfho;
unsigned int hook_func(unsigned int hooknum,
struct sk_buff **skb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff *))
{
return NF_DROP;
}
int init_module(void)
{
nfho.hook = hook_func;
nfho.hooknum = NF_IP_PRE_ROUTING;
nfho.pf = PF_INET;
nfho.priority = NF_IP_PRI_FIRST;
nf_register_hook(&nfho);
return 0;
}
void cleanup_module(void)
{
nf_unregister_hook(&nfho);
}