Skip to content
Browse files

remove the obsolete src/cls directory

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
  • Loading branch information...
1 parent b701746 commit 7dbf4d59030c67e7e1c85252802223d706392567 @congwang congwang committed with
Showing with 0 additions and 324 deletions.
  1. +0 −90 src/cls/basic.c
  2. +0 −78 src/cls/cgroup.c
  3. +0 −105 src/cls/utils.c
  4. +0 −51 src/cls/utils.h
View
90 src/cls/basic.c
@@ -1,90 +0,0 @@
-/*
- * src/cls/basic.c Basic Classifier
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2 of the License.
- *
- * Copyright (c) 2008 Thomas Graf <tgraf@suug.ch>
- */
-
-#include "utils.h"
-#include <netlink/route/cls/basic.h>
-#include <netlink/route/cls/ematch.h>
-
-static void print_usage(void)
-{
- printf(
-"Usage: ... basic [OPTIONS]...\n"
-"\n"
-"Options\n"
-" -h, --help Show this help.\n"
-" -e, --ematch=MATCH Extended match (See --ematch help).\n"
-" -c, --classid=HANDLE Target class to classify matching packets to.\n"
- );
- exit(0);
-}
-
-static void basic_parse_argv(struct rtnl_cls *cls, int argc, char **argv)
-{
- uint32_t classid;
-
- for (;;) {
- int c, optidx = 0, err;
- static struct option long_opts[] = {
- { "help", 0, 0, 'h' },
- { "ematch", 1, 0, 'e' },
- { "classid", 1, 0, 'c' },
- { 0, 0, 0, 0 }
- };
-
- c = getopt_long(argc, argv, "he:c:", long_opts, &optidx);
- if (c == -1)
- break;
-
- switch (c) {
- case '?':
- exit(NLE_INVAL);
-
- case 'h':
- print_usage();
-
- case 'e':
-#if 0
- if ((err = parse_ematch_syntax(optarg, &tree)) < 0)
- fatal(err, "Error while parsing ematch: %s",
- nl_geterror(err));
-
- if ((err = rtnl_basic_set_ematch(cls, tree)) < 0)
- fatal(err, "Unable to set ematch: %s",
- nl_geterror(err));
-#endif
- break;
-
- case 'c':
- if ((err = rtnl_tc_str2handle(optarg, &classid)) < 0)
- fatal(err, "Invalid classid \"%s\": %s",
- optarg, nl_geterror(err));
-
- if ((err = rtnl_basic_set_classid(cls, classid)) < 0)
- fatal(err, "Unable to set classid: %s",
- nl_geterror(err));
- break;
- }
- }
-}
-
-static struct cls_module basic_module = {
- .name = "basic",
- .parse_argv = basic_parse_argv,
-};
-
-static void __attribute__ ((constructor)) basic_init(void)
-{
- register_cls_module(&basic_module);
-}
-
-static void __attribute__ ((destructor)) basic_exit(void)
-{
- unregister_cls_module(&basic_module);
-}
View
78 src/cls/cgroup.c
@@ -1,78 +0,0 @@
-/*
- * src/cls/cgroup.c Control Groups Classifier
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2 of the License.
- *
- * Copyright (c) 2009 Thomas Graf <tgraf@suug.ch>
- */
-
-#include "utils.h"
-#include <netlink/route/cls/cgroup.h>
-#include <netlink/route/cls/ematch.h>
-
-static void print_usage(void)
-{
- printf(
-"Usage: ... cgroup [OPTIONS]...\n"
-"\n"
-"Options\n"
-" -h, --help Show this help.\n"
-" -e, --ematch=MATCH Extended match (See --ematch help).\n"
-" -c, --classid=HANDLE Target class to classify matching packets to.\n"
- );
- exit(0);
-}
-
-static void basic_parse_argv(struct rtnl_cls *cls, int argc, char **argv)
-{
- for (;;) {
- int c, optidx = 0;
- static struct option long_opts[] = {
- { "help", 0, 0, 'h' },
- { "ematch", 1, 0, 'e' },
- { "classid", 1, 0, 'c' },
- { 0, 0, 0, 0 }
- };
-
- c = getopt_long(argc, argv, "he:c:", long_opts, &optidx);
- if (c == -1)
- break;
-
- switch (c) {
- case '?':
- exit(NLE_INVAL);
-
- case 'h':
- print_usage();
-
-#if 0
- case 'e':
- if ((err = parse_ematch_syntax(optarg, &tree)) < 0)
- fatal(err, "Error while parsing ematch: %s",
- nl_geterror(err));
-
- if ((err = rtnl_basic_set_ematch(cls, tree)) < 0)
- fatal(err, "Unable to set ematch: %s",
- nl_geterror(err));
- break;
-#endif
- }
- }
-}
-
-static struct cls_module cgroup_module = {
- .name = "cgroup",
- .parse_argv = basic_parse_argv,
-};
-
-static void __init cgroup_init(void)
-{
- register_cls_module(&cgroup_module);
-}
-
-static void __exit cgroup_exit(void)
-{
- unregister_cls_module(&cgroup_module);
-}
View
105 src/cls/utils.c
@@ -1,105 +0,0 @@
-/*
- * src/cls-utils.c Classifier Helpers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2 of the License.
- *
- * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
- */
-
-#include "utils.h"
-
-struct rtnl_cls *nlt_alloc_cls(void)
-{
- struct rtnl_cls *cls;
-
- cls = rtnl_cls_alloc();
- if (!cls)
- fatal(ENOMEM, "Unable to allocate classifier object");
-
- return cls;
-}
-
-void parse_dev(struct rtnl_cls *cls, struct nl_cache *link_cache, char *arg)
-{
- int ival;
-
- if (!(ival = rtnl_link_name2i(link_cache, arg)))
- fatal(ENOENT, "Link \"%s\" does not exist", arg);
-
- rtnl_cls_set_ifindex(cls, ival);
-}
-
-void parse_prio(struct rtnl_cls *cls, char *arg)
-{
- uint32_t prio = parse_u32(arg);
- rtnl_cls_set_prio(cls, prio);
-}
-
-void parse_parent(struct rtnl_cls *cls, char *arg)
-{
- uint32_t parent;
- int err;
-
- if ((err = rtnl_tc_str2handle(arg, &parent)) < 0)
- fatal(err, "Unable to parse handle \"%s\": %s",
- arg, nl_geterror(err));
-
- rtnl_cls_set_parent(cls, parent);
-}
-
-void parse_handle(struct rtnl_cls *cls, char *arg)
-{
- uint32_t handle;
- int err;
-
- if ((err = rtnl_tc_str2handle(arg, &handle)) < 0)
- fatal(err, "Unable to parse handle \"%s\": %s",
- arg, nl_geterror(err));
-
- rtnl_cls_set_handle(cls, handle);
-}
-
-void parse_proto(struct rtnl_cls *cls, char *arg)
-{
- int proto = nl_str2ether_proto(arg);
- if (proto < 0)
- fatal(proto, "Unable to parse protocol \"%s\": %s",
- arg, nl_geterror(proto));
- rtnl_cls_set_protocol(cls, proto);
-}
-
-static NL_LIST_HEAD(cls_modules);
-
-struct cls_module *lookup_cls_mod(struct rtnl_cls_ops *ops)
-{
- struct cls_module *mod;
-
- nl_list_for_each_entry(mod, &cls_modules, list) {
- if (mod->ops == ops)
- return mod;
- }
-
- return NULL;
-}
-
-void register_cls_module(struct cls_module *mod)
-{
- struct rtnl_cls_ops *ops;
-
- if (!(ops = __rtnl_cls_lookup_ops(mod->name)))
- fatal(ENOENT, "Could not locate classifier module \"%s\"",
- mod->name);
-
- if (lookup_cls_mod(ops) != NULL)
- fatal(EEXIST, "Duplicate classifier module registration.");
-
- mod->ops = ops;
- nl_list_add_tail(&mod->list, &cls_modules);
-}
-
-void unregister_cls_module(struct cls_module *mod)
-{
- nl_list_del(&mod->list);
-}
View
51 src/cls/utils.h
@@ -1,51 +0,0 @@
-/*
- * src/cls-utils.h Classifier Helpers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2 of the License.
- *
- * Copyright (c) 2008-2009 Thomas Graf <tgraf@suug.ch>
- */
-
-#ifndef __CLS_UTILS_H_
-#define __CLS_UTILS_H_
-
-#include "../utils.h"
-#include <netlink/route/classifier-modules.h>
-#include <netlink/route/cls/ematch.h>
-
-struct cls_module
-{
- const char * name;
- struct rtnl_cls_ops * ops;
- void (*parse_argv)(struct rtnl_cls *, int, char **);
- struct nl_list_head list;
-};
-
-extern struct cls_module *lookup_cls_mod(struct rtnl_cls_ops *);
-extern void register_cls_module(struct cls_module *);
-extern void unregister_cls_module(struct cls_module *);
-
-struct ematch_module
-{
- int kind;
- struct rtnl_ematch_ops *ops;
- void (*parse_argv)(struct rtnl_ematch *, int, char **);
- struct nl_list_head list;
-};
-
-extern struct ematch_module *lookup_ematch_mod(struct rtnl_ematch_ops *);
-extern void register_ematch_module(struct ematch_module *);
-extern void unregister_ematch_module(struct ematch_module *);
-
-extern struct rtnl_cls *nlt_alloc_cls(void);
-extern void parse_dev(struct rtnl_cls *, struct nl_cache *, char *);
-extern void parse_prio(struct rtnl_cls *, char *);
-extern void parse_parent(struct rtnl_cls *, char *);
-extern void parse_handle(struct rtnl_cls *, char *);
-extern void parse_proto(struct rtnl_cls *, char *);
-
-extern int parse_ematch_syntax(const char *, struct rtnl_ematch_tree **);
-
-#endif

0 comments on commit 7dbf4d5

Please sign in to comment.
Something went wrong with that request. Please try again.