Linux netfilterÔ´Âë·ÖÎö(4)
ËÄ¡¢nf_hook_ops ¹³×ÓµÄ×¢²á
ÔÚfilter±íµÄ³õʼ»¯º¯Êýstatic int __init init(void)ÖгýÁËÓÐÒ»¸önf_register_hookº¯Êý×¢²áÒ»¸ötablesÍ⣬»¹ÓÉnf_register_hookº¯Êý×¢²áÁË3¸öhook
4.1 nf_hook_opsÊý¾Ý½á¹¹ netfilter.h
struct nf_hook_ops
{
struct list_head list; //Á´±í³ÉÔ±
/* User fills in from here down. */
nf_hookfn *hook; //¹³×Óº¯ÊýÖ¸Õë
struct module *owner;
int pf; //ÐÒé´Ø£¬¶ÔÓÚipv4¶øÑÔ£¬ÊÇPF_INET
int hooknum; //hookÀàÐÍ
/* Hooks are ordered in ascending priority. */
int priority; //ÓÅÏȼ¶
};
list³ÉÔ±ÓÃÓÚά»¤Netfilter hookµÄÁÐ±í¡£
hook³ÉÔ±ÊÇÒ»¸öÖ¸Ïònf_hookfnÀàÐ͵ĺ¯ÊýµÄÖ¸Õ룬¸Ãº¯ÊýÊÇÕâ¸öhook±»µ÷ÓÃʱִÐеĺ¯Êý¡£nf_hookfnͬÑùÔÚlinux/netfilter.hÖж¨Òå¡£
pfÕâ¸ö³ÉÔ±ÓÃÓÚÖ¸¶¨ÐÒé×å¡£ÓÐЧµÄÐÒé×åÔÚlinux/socket.hÖÐÁгö£¬µ«¶ÔÓÚIPv4ÎÒÃÇʹÓÃÐÒé×åPF_INET¡£
hooknumÕâ¸ö³ÉÔ±ÓÃÓÚÖ¸¶¨°²×°µÄÕâ¸öº¯Êý¶ÔÓ¦µÄ¾ßÌåµÄhookÀàÐÍ:
NF_IP_PRE_ROUTING ÔÚÍêÕûÐÔУÑéÖ®ºó£¬Ñ¡Â·È·¶¨Ö®Ç°
NF_IP_LOCAL_IN ÔÚѡ·ȷ¶¨Ö®ºó£¬ÇÒÊý¾Ý°üµÄÄ¿µÄÊDZ¾µØÖ÷»ú
NF_IP_FORWARD Ä¿µÄµØÊÇÆäËüÖ÷»úµØÊý¾Ý°ü
NF_IP_LOCAL_OUT &n
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
ÉÏÆªÎÄÕÂ˵µ½linuxÐèÒªitoaº¯Êý£¬ÏÂÃæÎÒ¾ÍÌṩһ·Ý¿çƽ̨µÄitoaº¯Êý¡£
//return the length of result string. support only 10 radix for easy use and better performance
int my_itoa(int val, char* buf)
{
const int radix = 10;
char* p;
int a;&nbs ......
תÌù×Ô£ºhttp://alexanderlaw.blog.hexun.com/8968782_d.html
Èý¡¢ipt_table±íµÄ×¢²á
init£¨£©º¯Êý³õʼ»¯Ê±µ÷ÓÃÁËipt_register_tableº¯Êý½øÐбíµÄ×¢²á
3.1 ip_tables.c ±íµÄ×¢²á ipt_register_table
int ipt_register_table(struct ipt_table *table)
{
......
1.´ÅÅÌÃüÁî
mount ¹ÒÉÏÎļþϵͳ
umount жÏÂÒѹÒÉϵÄÎļþϵͳ
df   ......