kernel.h
Go to the documentation of this file.
00001 #ifdef __KERNEL__
00002 #include <linux/rtnetlink.h>
00003 #include <linux/ctype.h>
00004 
00005 MODULE_LICENSE("GPL");
00006 
00007 /* Module parameter */
00008 char *autonomous = "no";
00009 module_param(autonomous, charp, 0);
00010 MODULE_PARM_DESC(autonomous, "Indicates if the protocol will use an interface or will be autonomous");
00011 
00012 uint node_id = 0;
00013 module_param(node_id, uint, 0);
00014 MODULE_PARM_DESC(node_id, "ID of the node.");
00015 
00016 uint num_nodes = 0;
00017 module_param(num_nodes, uint, 0);
00018 MODULE_PARM_DESC(num_nodes, "Number of nodes in the network.");
00019 
00020 
00021 #define TOUPPER(p) {unsigned int i;\
00022                    for(i=0; p[i]; i++){\
00023                       p[i]=toupper(p[i]);\
00024                    }}
00025 
00026 static int run_auto = 0;
00027 
00028 static int __init load_rtwmp(void)
00029 {
00030         printk(KERN_INFO "Module RT-WMP loading\n");
00031         if(strcmp(autonomous, "yes") == 0) {
00032                 printk(KERN_INFO "Running mode: Autonomous\n");
00033                 run_auto = 1;
00034                 rtnl_lock();
00035                 if(!wmpSetup(node_id, num_nodes)) {
00036                         printk(KERN_ERR "RT-WMP initialization error.\n");
00037                         return -EAGAIN;
00038                 }
00039                 rtnl_unlock();
00040                 wmpRunBG();
00041         }
00042         else {
00043                 printk(KERN_INFO "Running mode: With interface\n");
00044         }
00045         return 0;
00046 }
00047 
00048 static void __exit unload_rtwmp(void)
00049 {
00050         if(run_auto) {
00051                 wmpExit();
00052         }
00053         printk(KERN_INFO "Module RT-WMP unloaded\n");
00054 }
00055 int init_proc(void);
00056 void close_proc(void);
00057 
00058 #define INIT_PROC() init_proc()
00059 #define CLOSE_PROC() close_proc();
00060 
00061 module_init(load_rtwmp);
00062 module_exit(unload_rtwmp);
00063 
00064 EXPORT_SYMBOLS();
00065 
00066 #else
00067 
00068 #define INIT_PROC() 1
00069 #define CLOSE_PROC()
00070 
00071 int  wmpIsKernelSpace(){
00072         return 0;
00073 }
00074 
00075 #endif


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Fri Jan 3 2014 12:07:55