]> git.proxmox.com Git - mirror_iproute2.git/blame - tc/m_pedit.h
vdpa: add .gitignore
[mirror_iproute2.git] / tc / m_pedit.h
CommitLineData
7e7c7372 1/*
ae665a52 2 * m_pedit.h generic packet editor actions module
7e7c7372 3 *
4 * This program is free software; you can distribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *
ae665a52
SH
9 * Authors: J Hadi Salim (hadi@cyberus.ca)
10 *
7e7c7372 11 */
12
13#ifndef _ACT_PEDIT_H_
14#define _ACT_PEDIT_H_ 1
15
16#include <stdio.h>
17#include <stdlib.h>
18#include <unistd.h>
7e7c7372 19#include <fcntl.h>
20#include <sys/socket.h>
21#include <netinet/in.h>
22#include <arpa/inet.h>
23#include <string.h>
24#include "utils.h"
25#include "tc_util.h"
26#include <linux/tc_act/tc_pedit.h>
27
28#define MAX_OFFS 128
29
30#define TIPV4 1
31#define TIPV6 2
32#define TINT 3
33#define TU32 4
3cd5149e 34#define TMAC 5
7e7c7372 35
36#define RU32 0xFFFFFFFF
37#define RU16 0xFFFF
38#define RU8 0xFF
39
3866d464 40#define PEDITKINDSIZ 16
41
7c71a40c
AV
42struct m_pedit_key {
43 __u32 mask; /* AND */
44 __u32 val; /*XOR */
45 __u32 off; /*offset */
46 __u32 at;
47 __u32 offmask;
48 __u32 shift;
49
50 enum pedit_header_type htype;
51 enum pedit_cmd cmd;
52};
53
54struct m_pedit_key_ex {
55 enum pedit_header_type htype;
56 enum pedit_cmd cmd;
57};
58
59struct m_pedit_sel {
60 struct tc_pedit_sel sel;
61 struct tc_pedit_key keys[MAX_OFFS];
62 struct m_pedit_key_ex keys_ex[MAX_OFFS];
63 bool extended;
64};
65
1e600da0 66struct m_pedit_util {
7e7c7372 67 struct m_pedit_util *next;
3866d464 68 char id[PEDITKINDSIZ];
7c71a40c 69 int (*parse_peopt)(int *argc_p, char ***argv_p,
1e600da0
SH
70 struct m_pedit_sel *sel,
71 struct m_pedit_key *tkey);
7e7c7372 72};
73
a8e9f4ae
SH
74int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,
75 __u32 retain,
76 struct m_pedit_sel *sel, struct m_pedit_key *tkey);
7e7c7372 77#endif