iproute2/tc/tc_qevent.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#ifndef _TC_QEVENT_H_
   3#define _TC_QEVENT_H_
   4
   5#include <stdbool.h>
   6#include <linux/types.h>
   7#include <libnetlink.h>
   8
   9struct qevent_base {
  10        __u32 block_idx;
  11};
  12
  13struct qevent_util {
  14        const char *id;
  15        int (*parse_qevent)(struct qevent_util *qu, int *argc, char ***argv);
  16        int (*read_qevent)(struct qevent_util *qu, struct rtattr **tb);
  17        void (*print_qevent)(struct qevent_util *qu, FILE *f);
  18        int (*dump_qevent)(struct qevent_util *qu, struct nlmsghdr *n);
  19        size_t data_size;
  20        void *data;
  21        int attr;
  22};
  23
  24#define QEVENT(_name, _form, _data, _attr)                              \
  25        {                                                               \
  26                .id = _name,                                            \
  27                .parse_qevent = qevent_parse_##_form,                   \
  28                .read_qevent = qevent_read_##_form,                     \
  29                .print_qevent = qevent_print_##_form,                   \
  30                .dump_qevent = qevent_dump_##_form,                     \
  31                .data_size = sizeof(struct qevent_##_form),             \
  32                .data = _data,                                          \
  33                .attr = _attr,                                          \
  34        }
  35
  36void qevents_init(struct qevent_util *qevents);
  37int qevent_parse(struct qevent_util *qevents, int *p_argc, char ***p_argv);
  38int qevents_read(struct qevent_util *qevents, struct rtattr **tb);
  39int qevents_dump(struct qevent_util *qevents, struct nlmsghdr *n);
  40void qevents_print(struct qevent_util *qevents, FILE *f);
  41bool qevents_have_block(struct qevent_util *qevents, __u32 block_idx);
  42
  43struct qevent_plain {
  44        struct qevent_base base;
  45};
  46int qevent_parse_plain(struct qevent_util *qu, int *p_argc, char ***p_argv);
  47int qevent_read_plain(struct qevent_util *qu, struct rtattr **tb);
  48void qevent_print_plain(struct qevent_util *qu, FILE *f);
  49int qevent_dump_plain(struct qevent_util *qu, struct nlmsghdr *n);
  50
  51#endif
  52