Blame tc/m_pedit.h

Packit d3f73b
/*
Packit d3f73b
 * m_pedit.h		generic packet editor actions module
Packit d3f73b
 *
Packit d3f73b
 *		This program is free software; you can distribute it and/or
Packit d3f73b
 *		modify it under the terms of the GNU General Public License
Packit d3f73b
 *		as published by the Free Software Foundation; either version
Packit d3f73b
 *		2 of the License, or (at your option) any later version.
Packit d3f73b
 *
Packit d3f73b
 * Authors:  J Hadi Salim (hadi@cyberus.ca)
Packit d3f73b
 *
Packit d3f73b
 */
Packit d3f73b
Packit d3f73b
#ifndef _ACT_PEDIT_H_
Packit d3f73b
#define _ACT_PEDIT_H_ 1
Packit d3f73b
Packit d3f73b
#include <stdio.h>
Packit d3f73b
#include <stdlib.h>
Packit d3f73b
#include <unistd.h>
Packit d3f73b
#include <fcntl.h>
Packit d3f73b
#include <sys/socket.h>
Packit d3f73b
#include <netinet/in.h>
Packit d3f73b
#include <arpa/inet.h>
Packit d3f73b
#include <string.h>
Packit d3f73b
#include "utils.h"
Packit d3f73b
#include "tc_util.h"
Packit d3f73b
#include <linux/tc_act/tc_pedit.h>
Packit d3f73b
Packit d3f73b
#define MAX_OFFS 128
Packit d3f73b
Packit d3f73b
#define TIPV4 1
Packit d3f73b
#define TIPV6 2
Packit d3f73b
#define TINT 3
Packit d3f73b
#define TU32 4
Packit d3f73b
#define TMAC 5
Packit d3f73b
Packit d3f73b
#define RU32 0xFFFFFFFF
Packit d3f73b
#define RU16 0xFFFF
Packit d3f73b
#define RU8 0xFF
Packit d3f73b
Packit d3f73b
#define PEDITKINDSIZ 16
Packit d3f73b
Packit d3f73b
struct m_pedit_key {
Packit d3f73b
	__u32           mask;  /* AND */
Packit d3f73b
	__u32           val;   /*XOR */
Packit d3f73b
	__u32           off;  /*offset */
Packit d3f73b
	__u32           at;
Packit d3f73b
	__u32           offmask;
Packit d3f73b
	__u32           shift;
Packit d3f73b
Packit d3f73b
	enum pedit_header_type htype;
Packit d3f73b
	enum pedit_cmd cmd;
Packit d3f73b
};
Packit d3f73b
Packit d3f73b
struct m_pedit_key_ex {
Packit d3f73b
	enum pedit_header_type htype;
Packit d3f73b
	enum pedit_cmd cmd;
Packit d3f73b
};
Packit d3f73b
Packit d3f73b
struct m_pedit_sel {
Packit d3f73b
	struct tc_pedit_sel sel;
Packit d3f73b
	struct tc_pedit_key keys[MAX_OFFS];
Packit d3f73b
	struct m_pedit_key_ex keys_ex[MAX_OFFS];
Packit d3f73b
	bool extended;
Packit d3f73b
};
Packit d3f73b
Packit d3f73b
struct m_pedit_util {
Packit d3f73b
	struct m_pedit_util *next;
Packit d3f73b
	char    id[PEDITKINDSIZ];
Packit d3f73b
	int     (*parse_peopt)(int *argc_p, char ***argv_p,
Packit d3f73b
			       struct m_pedit_sel *sel,
Packit d3f73b
			       struct m_pedit_key *tkey);
Packit d3f73b
};
Packit d3f73b
Packit d3f73b
int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,
Packit d3f73b
	      __u32 retain,
Packit d3f73b
	      struct m_pedit_sel *sel, struct m_pedit_key *tkey);
Packit d3f73b
#endif