//Called when module loaded using 'insmod' int init_module() { int ret; //Initialize RuleTable Init_Table(&rt); //Initialize clock rwlock_init(&my_rwlock); //PREROUTING nfho_incoming.hook = hook_func_in; nfho_incoming.hooknum = NF_INET_PRE_ROUTING; nfho_incoming.pf = PF_INET; nfho_incoming.priority = NF_IP_PRI_FIRST; nf_register_hook(&nfho_incoming); //POSTROUTING nfho_outgoing.hook = hook_func_out; nfho_outgoing.hooknum = NF_INET_POST_ROUTING; nfho_outgoing.pf = PF_INET; nfho_outgoing.priority = NF_IP_PRI_FIRST; nf_register_hook(&nfho_outgoing); //Register device file ret = register_chrdev(MAJOR_NUM, DEVICE_NAME, &ops); if (ret < 0) { printk(KERN_INFO "Registering char device failed with %d\n", MAJOR_NUM); return ret; } printk(KERN_INFO "Start RoX kernel module\n", MAJOR_NUM); return SUCCESS; }
Tweak_Patch::Tweak_Patch(Tweak_Types t) { type = t; labTableH=McoNewHandle(sizeof(double)*33*33*33*3+1); Init_Table(); }