use sk_receive_skb instead of sk_backlog_rcv
[ana-net.git] / src / xt_builder.c
blobe8bcd4fd7c175301d4232344553dd96ba4106910
1 /*
2 * Lightweight Autonomic Network Architecture
4 * Builds Functional Block objects requested by its type. Holds global
5 * reference to all registered functional blocks. Invoked from userspace
6 * via xt_user Netlink.
8 * Copyright 2011 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,
9 * Swiss federal institute of technology (ETH Zurich)
10 * Subject to the GPL.
13 #include <linux/kernel.h>
14 #include <linux/module.h>
16 #include "xt_critbit.h"
17 #include "xt_builder.h"
18 #include "xt_fblock.h"
20 static struct critbit_tree fbmap;
22 int register_fblock_type(struct fblock_factory *fops)
24 return critbit_insert(&fbmap, fops->type);
26 EXPORT_SYMBOL_GPL(register_fblock_type);
28 void unregister_fblock_type(struct fblock_factory *fops)
30 critbit_delete(&fbmap, fops->type);
32 EXPORT_SYMBOL_GPL(unregister_fblock_type);
34 struct fblock *build_fblock_object(char *type, char *name)
36 struct fblock *fb;
37 struct fblock_factory *factory = struct_of(critbit_get(&fbmap, type),
38 struct fblock_factory);
39 if (!factory) {
40 printk(KERN_ERR "[lana] So such type available!\n");
41 return NULL;
43 fb = factory->ctor(name);
44 if (!fb)
45 return NULL;
46 fb->factory = factory;
47 return fb;
49 EXPORT_SYMBOL(build_fblock_object);
51 int init_fblock_builder(void)
53 get_critbit_cache();
54 critbit_init_tree(&fbmap);
55 return 0;
57 EXPORT_SYMBOL_GPL(init_fblock_builder);
59 void cleanup_fblock_builder(void)
61 put_critbit_cache();
63 EXPORT_SYMBOL_GPL(cleanup_fblock_builder);