在ubuntu 9.04上面有一個名為invest的pannel tool,這是一個投資理財的小工具,這個小工具利用抓取http://finance.yahoo.com/的資料,幫您做即時的股票和匯率等等的報導,所有在finance.yahoo.com上面查的到的資訊都可以利用這個工具來顯示。
將invest加入pannel中。
將想要觀察的代碼輸入invest中。
invest的畫面。

Usage: ip link add link DEV [ name ] NAME
[ txqueuelen PACKETS ]
[ address LLADDR ]
[ broadcast LLADDR ]
[ mtu MTU ]
type TYPE [ ARGS ]
ip link delete DEV type TYPE [ ARGS ]
ip link set DEVICE [ { up | down } ]
[ arp { on | off } ]
[ dynamic { on | off } ]
[ multicast { on | off } ]
[ allmulticast { on | off } ]
[ promisc { on | off } ]
[ trailers { on | off } ]
[ txqueuelen PACKETS ]
[ name NEWNAME ]
[ address LLADDR ]
[ broadcast LLADDR ]
[ mtu MTU ]
[ netns PID ]
[ alias NAME ]
ip link show [ DEVICE ]
TYPE := { vlan | veth | dummy | ifb | macvlan }
Usage: add [interface-name] [vlan_id]
rem [vlan-name]
set_dflt [interface-name] [vlan_id]
add_port [port-name] [vlan_id]
rem_port [port-name] [vlan_id]
set_egress_map [vlan-name] [skb_priority] [vlan_qos]
set_ingress_map [vlan-name] [skb_priority] [vlan_qos]
set_name_type [name-type]
set_bind_mode [bind-type]
struct nf_hook_ops
{
struct list_head list;
/* User fills in from here down. */
nf_hookfn *hook;
struct module *owner;
u_int8_t pf;
unsigned int hooknum;
/* Hooks are ordered in ascending priority. */
int priority;
};
pf是protocol family,目前有NFPROTO_UNSPEC、NFPROTO_IPV4、NFPROTO_ARP、NFPROTO_BRIDGE、NFPROTO_IPV6和NFPROTO_DECNET等等。這些值也等同sock的protocol family。| Hook | Called |
| NF_IP_PRE_ROUTING | After sanity checks, before routing decisions. |
| NF_IP_LOCAL_IN | After routing decisions if packet is for this host. |
| NF_IP_FORWARD | If the packet is destined for another interface. |
| NF_IP_LOCAL_OUT | For packets coming from local processes on their way out. |
| NF_IP_POST_ROUTING | Just before outbound packets "hit the wire". |
#include <linux/init.h>
#include <linux/module.h>
#include <linux/ip.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
MODULE_LICENSE("GPL");
inline void dumpIpHdr(const char *fn, const struct sk_buff *skb)
{
const struct iphdr *ip = ip_hdr(skb);
printk("%s, saddr:%pI4, daddr:%pI4\n", fn, &ip->saddr, &ip->daddr);
}
static unsigned int
prerouting(unsigned int hook, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff*))
{
dumpIpHdr(__FUNCTION__, skb);
return NF_ACCEPT;
}
static unsigned int
localin(unsigned int hook, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff*))
{
dumpIpHdr(__FUNCTION__, skb);
return NF_ACCEPT;
}
static unsigned int
localout(unsigned int hook, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff*))
{
dumpIpHdr(__FUNCTION__, skb);
return NF_ACCEPT;
}
static unsigned int
postrouting(unsigned int hook, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff*))
{
dumpIpHdr(__FUNCTION__, skb);
return NF_ACCEPT;
}
static unsigned int
fwding(unsigned int hook, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff*))
{
dumpIpHdr(__FUNCTION__, skb);
return NF_ACCEPT;
}
static struct nf_hook_ops brook_ops[] __read_mostly = {
{
.hook = prerouting,
.pf = PF_INET,
.hooknum = NF_INET_PRE_ROUTING,
.priority = NF_IP_PRI_RAW,
.owner = THIS_MODULE,
}, {
.hook = localin,
.pf = PF_INET,
.hooknum = NF_INET_LOCAL_IN,
.priority = NF_IP_PRI_RAW,
.owner = THIS_MODULE,
}, {
.hook = fwding,
.pf = PF_INET,
.hooknum = NF_INET_FORWARD,
.priority = NF_IP_PRI_RAW,
.owner = THIS_MODULE,
}, {
.hook = localout,
.pf = PF_INET,
.hooknum = NF_INET_LOCAL_OUT,
.priority = NF_IP_PRI_RAW,
.owner = THIS_MODULE,
}, {
.hook = postrouting,
.pf = PF_INET,
.hooknum = NF_INET_POST_ROUTING,
.priority = NF_IP_PRI_RAW,
.owner = THIS_MODULE,
},
};
static int __init init_modules(void)
{
if (nf_register_hooks(brook_ops, ARRAY_SIZE(brook_ops)) < 0) {
printk("nf_register_hook failed\n");
}
return 0;
}
static void __exit exit_modules(void)
{
nf_unregister_hooks(brook_ops, ARRAY_SIZE(brook_ops));
}
module_init(init_modules);
module_exit(exit_modules);