libnl  3.2.3
/build/buildd/libnl3-3.2.3/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-2010 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 *e, void *data, size_t len)
00018 {
00019         memcpy(e->e_data, data, sizeof(uint32_t));
00020 
00021         return 0;
00022 }
00023 
00024 static int container_fill(struct rtnl_ematch *e, struct nl_msg *msg)
00025 {
00026         return nlmsg_append(msg, e->e_data, sizeof(uint32_t), 0);
00027 }
00028 
00029 static struct rtnl_ematch_ops container_ops = {
00030         .eo_kind        = TCF_EM_CONTAINER,
00031         .eo_name        = "container",
00032         .eo_minlen      = sizeof(uint32_t),
00033         .eo_datalen     = sizeof(uint32_t),
00034         .eo_parse       = container_parse,
00035         .eo_fill        = container_fill,
00036 };
00037 
00038 static void __init container_init(void)
00039 {
00040         rtnl_ematch_register(&container_ops);
00041 }