Tizen 2.1 base
[platform/upstream/libnl2.git] / lib / route / cls / ematch / container.c
1 /*
2  * lib/route/cls/ematch/container.c     Container Ematch
3  *
4  *      This library is free software; you can redistribute it and/or
5  *      modify it under the terms of the GNU Lesser General Public
6  *      License as published by the Free Software Foundation version 2.1
7  *      of the License.
8  *
9  * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
10  */
11
12 #include <netlink-local.h>
13 #include <netlink-tc.h>
14 #include <netlink/netlink.h>
15 #include <netlink/route/cls/ematch.h>
16
17 static int container_parse(struct rtnl_ematch *m, void *data, size_t len)
18 {
19         memcpy(m->e_data, data, sizeof(uint32_t));
20
21         return 0;
22 }
23
24 static struct rtnl_ematch_ops container_ops = {
25         .eo_kind        = TCF_EM_CONTAINER,
26         .eo_name        = "container",
27         .eo_datalen     = sizeof(uint32_t),
28         .eo_parse       = container_parse,
29 };
30
31 static void __init container_init(void)
32 {
33         rtnl_ematch_register(&container_ops);
34 }
35
36 static void __exit container_exit(void)
37 {
38         rtnl_ematch_unregister(&container_ops);
39 }