libnl 2.0

/tmp/buildd/libnl2-2.0/lib/route/cls/ematch/container.c

00001 /*
00002  * lib/route/cls/ematch/container.c     Container Ematch
00003  *
00004  *      This library is free software; you can redistribute it and/or
00005  *      modify it under the terms of the GNU Lesser General Public
00006  *      License as published by the Free Software Foundation version 2.1
00007  *      of the License.
00008  *
00009  * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
00010  */
00011 
00012 #include <netlink-local.h>
00013 #include <netlink-tc.h>
00014 #include <netlink/netlink.h>
00015 #include <netlink/route/cls/ematch.h>
00016 
00017 static int container_parse(struct rtnl_ematch *m, void *data, size_t len)
00018 {
00019         memcpy(m->e_data, data, sizeof(uint32_t));
00020 
00021         return 0;
00022 }
00023 
00024 static struct rtnl_ematch_ops container_ops = {
00025         .eo_kind        = TCF_EM_CONTAINER,
00026         .eo_name        = "container",
00027         .eo_datalen     = sizeof(uint32_t),
00028         .eo_parse       = container_parse,
00029 };
00030 
00031 static void __init container_init(void)
00032 {
00033         rtnl_ematch_register(&container_ops);
00034 }
00035 
00036 static void __exit container_exit(void)
00037 {
00038         rtnl_ematch_unregister(&container_ops);
00039 }