Blame tc/tc_qevent.h

Packit Service 3880ab
/* SPDX-License-Identifier: GPL-2.0 */
Packit Service 3880ab
#ifndef _TC_QEVENT_H_
Packit Service 3880ab
#define _TC_QEVENT_H_
Packit Service 3880ab
Packit Service 3880ab
#include <stdbool.h>
Packit Service 3880ab
#include <linux/types.h>
Packit Service 3880ab
#include <libnetlink.h>
Packit Service 3880ab
Packit Service 3880ab
struct qevent_base {
Packit Service 3880ab
	__u32 block_idx;
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
struct qevent_util {
Packit Service 3880ab
	const char *id;
Packit Service 3880ab
	int (*parse_qevent)(struct qevent_util *qu, int *argc, char ***argv);
Packit Service 3880ab
	int (*read_qevent)(struct qevent_util *qu, struct rtattr **tb);
Packit Service 3880ab
	void (*print_qevent)(struct qevent_util *qu, FILE *f);
Packit Service 3880ab
	int (*dump_qevent)(struct qevent_util *qu, struct nlmsghdr *n);
Packit Service 3880ab
	size_t data_size;
Packit Service 3880ab
	void *data;
Packit Service 3880ab
	int attr;
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
#define QEVENT(_name, _form, _data, _attr)				\
Packit Service 3880ab
	{								\
Packit Service 3880ab
		.id = _name,						\
Packit Service 3880ab
		.parse_qevent = qevent_parse_##_form,			\
Packit Service 3880ab
		.read_qevent = qevent_read_##_form,			\
Packit Service 3880ab
		.print_qevent = qevent_print_##_form,			\
Packit Service 3880ab
		.dump_qevent = qevent_dump_##_form,			\
Packit Service 3880ab
		.data_size = sizeof(struct qevent_##_form),		\
Packit Service 3880ab
		.data = _data,						\
Packit Service 3880ab
		.attr = _attr,						\
Packit Service 3880ab
	}
Packit Service 3880ab
Packit Service 3880ab
void qevents_init(struct qevent_util *qevents);
Packit Service 3880ab
int qevent_parse(struct qevent_util *qevents, int *p_argc, char ***p_argv);
Packit Service 3880ab
int qevents_read(struct qevent_util *qevents, struct rtattr **tb);
Packit Service 3880ab
int qevents_dump(struct qevent_util *qevents, struct nlmsghdr *n);
Packit Service 3880ab
void qevents_print(struct qevent_util *qevents, FILE *f);
Packit Service 3880ab
bool qevents_have_block(struct qevent_util *qevents, __u32 block_idx);
Packit Service 3880ab
Packit Service 3880ab
struct qevent_plain {
Packit Service 3880ab
	struct qevent_base base;
Packit Service 3880ab
};
Packit Service 3880ab
int qevent_parse_plain(struct qevent_util *qu, int *p_argc, char ***p_argv);
Packit Service 3880ab
int qevent_read_plain(struct qevent_util *qu, struct rtattr **tb);
Packit Service 3880ab
void qevent_print_plain(struct qevent_util *qu, FILE *f);
Packit Service 3880ab
int qevent_dump_plain(struct qevent_util *qu, struct nlmsghdr *n);
Packit Service 3880ab
Packit Service 3880ab
#endif