~ubuntu-branches/ubuntu/trusty/libnl3/trusty

« back to all changes in this revision

Viewing changes to include/netlink/route/tc-api.h

  • Committer: Bazaar Package Importer
  • Author(s): Heiko Stuebner
  • Date: 2011-05-21 19:25:13 UTC
  • Revision ID: james.westby@ubuntu.com-20110521192513-1ieyu9w9kym4bt16
Tags: upstream-3.0
ImportĀ upstreamĀ versionĀ 3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * netlink/route/tc-api.h       Traffic Control API
 
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) 2011 Thomas Graf <tgraf@suug.ch>
 
10
 */
 
11
 
 
12
#ifndef NETLINK_TC_API_H_
 
13
#define NETLINK_TC_API_H_
 
14
 
 
15
#include <netlink/netlink.h>
 
16
#include <netlink/msg.h>
 
17
#include <netlink/route/tc.h>
 
18
 
 
19
#ifdef __cplusplus
 
20
extern "C" {
 
21
#endif
 
22
 
 
23
enum rtnl_tc_type {
 
24
        RTNL_TC_TYPE_QDISC,
 
25
        RTNL_TC_TYPE_CLASS,
 
26
        RTNL_TC_TYPE_CLS,
 
27
        __RTNL_TC_TYPE_MAX,
 
28
};
 
29
 
 
30
#define RTNL_TC_TYPE_MAX (__RTNL_TC_TYPE_MAX - 1)
 
31
 
 
32
/**
 
33
 * Traffic control object operations
 
34
 * @ingroup tc
 
35
 *
 
36
 * This structure holds function pointers and settings implementing
 
37
 * the features of each traffic control object implementation.
 
38
 */
 
39
struct rtnl_tc_ops
 
40
{
 
41
        /**
 
42
         * Name of traffic control module
 
43
         */
 
44
        char *to_kind;
 
45
 
 
46
        /**
 
47
         * Type of traffic control object
 
48
         */
 
49
        enum rtnl_tc_type to_type;
 
50
 
 
51
 
 
52
        /**
 
53
         * Size of private data
 
54
         */
 
55
        size_t to_size;
 
56
 
 
57
        /**
 
58
         * Dump callbacks
 
59
         */
 
60
        void (*to_dump[NL_DUMP_MAX+1])(struct rtnl_tc *, void *,
 
61
                                       struct nl_dump_params *);
 
62
        /**
 
63
         * Used to fill the contents of TCA_OPTIONS
 
64
         */
 
65
        int (*to_msg_fill)(struct rtnl_tc *, void *, struct nl_msg *);
 
66
 
 
67
        /**
 
68
         * Uesd to to fill tc related messages, unlike with to_msg_fill,
 
69
         * the contents is not encapsulated with a TCA_OPTIONS nested
 
70
         * attribute.
 
71
         */
 
72
        int (*to_msg_fill_raw)(struct rtnl_tc *, void *, struct nl_msg *);
 
73
 
 
74
        /**
 
75
         * TCA_OPTIONS message parser
 
76
         */
 
77
        int (*to_msg_parser)(struct rtnl_tc *, void *);
 
78
 
 
79
        /**
 
80
         * Called before a tc object is destroyed
 
81
         */
 
82
        void (*to_free_data)(struct rtnl_tc *, void *);
 
83
 
 
84
        /**
 
85
         * Called whenever a classifier object needs to be cloned
 
86
         */
 
87
        int (*to_clone)(void *, void *);
 
88
 
 
89
        /**
 
90
         * Internal, don't touch
 
91
         */
 
92
        struct nl_list_head to_list;
 
93
};
 
94
 
 
95
struct rtnl_tc_type_ops
 
96
{
 
97
        enum rtnl_tc_type tt_type;
 
98
 
 
99
        char *tt_dump_prefix;
 
100
 
 
101
        /**
 
102
         * Dump callbacks
 
103
         */
 
104
        void (*tt_dump[NL_DUMP_MAX+1])(struct rtnl_tc *,
 
105
                                        struct nl_dump_params *);
 
106
};
 
107
 
 
108
extern int                      rtnl_tc_msg_parse(struct nlmsghdr *,
 
109
                                                  struct rtnl_tc *);
 
110
extern int                      rtnl_tc_msg_build(struct rtnl_tc *, int,
 
111
                                                  int, struct nl_msg **);
 
112
 
 
113
extern void                     rtnl_tc_free_data(struct nl_object *);
 
114
extern int                      rtnl_tc_clone(struct nl_object *,
 
115
                                              struct nl_object *);
 
116
extern void                     rtnl_tc_dump_line(struct nl_object *,
 
117
                                                  struct nl_dump_params *);
 
118
extern void                     rtnl_tc_dump_details(struct nl_object *,
 
119
                                                     struct nl_dump_params *);
 
120
extern void                     rtnl_tc_dump_stats(struct nl_object *,
 
121
                                                   struct nl_dump_params *);
 
122
extern int                      rtnl_tc_compare(struct nl_object *,
 
123
                                                struct nl_object *,
 
124
                                                uint32_t, int);
 
125
 
 
126
extern void *                   rtnl_tc_data(struct rtnl_tc *);
 
127
 
 
128
extern struct rtnl_tc_ops *     rtnl_tc_lookup_ops(enum rtnl_tc_type,
 
129
                                                   const char *);
 
130
extern struct rtnl_tc_ops *     rtnl_tc_get_ops(struct rtnl_tc *);
 
131
extern int                      rtnl_tc_register(struct rtnl_tc_ops *);
 
132
extern void                     rtnl_tc_unregister(struct rtnl_tc_ops *);
 
133
 
 
134
extern void                     rtnl_tc_type_register(struct rtnl_tc_type_ops *);
 
135
extern void                     rtnl_tc_type_unregister(struct rtnl_tc_type_ops *);
 
136
 
 
137
#ifdef __cplusplus
 
138
}
 
139
#endif
 
140
 
 
141
#endif