diff options
| author | Siger Yang <siger.yang@outlook.com> | 2022-09-06 15:10:11 +0800 |
|---|---|---|
| committer | Siger Yang <siger.yang@outlook.com> | 2022-11-22 22:35:35 +0800 |
| commit | c317d3f246769e8261df0f9d1eb787bea7b5da06 (patch) | |
| tree | 5fe488123f08250f2c5db8c70bb092ea6c1e3ed5 /zebra/zebra_tc.h | |
| parent | daa602b593dc80b011a2355844c4cc7528f7a90d (diff) | |
zebra: traffic control state management
This allows Zebra to manage QDISC, TCLASS, TFILTER in kernel and do cleaning
jobs when it starts up.
Signed-off-by: Siger Yang <siger.yang@outlook.com>
Diffstat (limited to 'zebra/zebra_tc.h')
| -rw-r--r-- | zebra/zebra_tc.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/zebra/zebra_tc.h b/zebra/zebra_tc.h new file mode 100644 index 0000000000..832972b713 --- /dev/null +++ b/zebra/zebra_tc.h @@ -0,0 +1,79 @@ +/* + * Zebra Traffic Control (TC) Data structures and definitions + * These are public definitions referenced by multiple files. + * + * Copyright (C) 2022 Shichu Yang + * + * This program 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; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _ZEBRA_TC_H +#define _ZEBRA_TC_H + +#include <zebra.h> +#include "rt.h" +#include "tc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct zebra_tc_qdisc { + int sock; + + struct tc_qdisc qdisc; +}; + +struct zebra_tc_class { + int sock; + + struct tc_class class; +}; + +struct zebra_tc_filter { + int sock; + + struct tc_filter filter; +}; + +const char *tc_qdisc_kind2str(uint32_t type); +enum tc_qdisc_kind tc_qdisc_str2kind(const char *type); + +uint32_t zebra_tc_qdisc_hash_key(const void *arg); +bool zebra_tc_qdisc_hash_equal(const void *arg1, const void *arg2); +void zebra_tc_qdisc_install(struct zebra_tc_qdisc *qdisc); +void zebra_tc_qdisc_uninstall(struct zebra_tc_qdisc *qdisc); + +uint32_t zebra_tc_class_hash_key(const void *arg); +bool zebra_tc_class_hash_equal(const void *arg1, const void *arg2); +void zebra_tc_class_add(struct zebra_tc_class *class); +void zebra_tc_class_delete(struct zebra_tc_class *class); + +const char *tc_filter_kind2str(uint32_t type); +enum tc_qdisc_kind tc_filter_str2kind(const char *type); +void zebra_tc_filter_add(struct zebra_tc_filter *filter); +void zebra_tc_filter_delete(struct zebra_tc_filter *filter); + +void zebra_tc_filters_free(void *arg); +uint32_t zebra_tc_filter_hash_key(const void *arg); +bool zebra_tc_filter_hash_equal(const void *arg1, const void *arg2); + +void kernel_read_tc_qdisc(struct zebra_ns *zns); + +#ifdef __cplusplus +} +#endif + +#endif /* _ZEBRA_TC_H */ |
