blob: 1698c954e999e7d593eb6e683c515fb84c6a365f [file] [log] [blame]
net[shemminger]!shemminger7e7c7372005-01-17 23:32:51 +00001/*
Stephen Hemmingerae665a52006-12-05 10:10:22 -08002 * m_pedit.h generic packet editor actions module
net[shemminger]!shemminger7e7c7372005-01-17 23:32:51 +00003 *
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 *
Stephen Hemmingerae665a52006-12-05 10:10:22 -08009 * Authors: J Hadi Salim (hadi@cyberus.ca)
10 *
net[shemminger]!shemminger7e7c7372005-01-17 23:32:51 +000011 */
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>
19#include <syslog.h>
20#include <fcntl.h>
21#include <sys/socket.h>
22#include <netinet/in.h>
23#include <arpa/inet.h>
24#include <string.h>
25#include "utils.h"
26#include "tc_util.h"
27#include <linux/tc_act/tc_pedit.h>
28
29#define MAX_OFFS 128
30
31#define TIPV4 1
32#define TIPV6 2
33#define TINT 3
34#define TU32 4
35
36#define RU32 0xFFFFFFFF
37#define RU16 0xFFFF
38#define RU8 0xFF
39
2!tgraf3866d462005-01-18 00:17:27 +000040#define PEDITKINDSIZ 16
41
net[shemminger]!shemminger7e7c7372005-01-17 23:32:51 +000042struct m_pedit_util
43{
44 struct m_pedit_util *next;
2!tgraf3866d462005-01-18 00:17:27 +000045 char id[PEDITKINDSIZ];
net[shemminger]!shemminger7e7c7372005-01-17 23:32:51 +000046 int (*parse_peopt)(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey);
47};
48
49
50extern int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey);
51extern int pack_key(struct tc_pedit_sel *sel,struct tc_pedit_key *tkey);
52extern int pack_key32(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey);
53extern int pack_key16(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey);
54extern int pack_key8(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey);
55extern int parse_val(int *argc_p, char ***argv_p, __u32 * val, int type);
56extern int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey);
57extern int parse_offset(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey);
58int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
59extern int print_pedit(struct action_util *au,FILE * f, struct rtattr *arg);
60extern int pedit_print_xstats(struct action_util *au, FILE *f, struct rtattr *xstats);
61
62#endif