1 /*
2 * m_pedit_icmp.c packet editor: ICMP header
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 *
9 * Authors: J Hadi Salim (hadi@cyberus.ca)
10 *
11 */
12
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include <syslog.h>
17 #include <fcntl.h>
18 #include <sys/socket.h>
19 #include <netinet/in.h>
20 #include <arpa/inet.h>
21 #include <string.h>
22 #include "utils.h"
23 #include "tc_util.h"
24 #include "m_pedit.h"
25
26
27 static int
parse_icmp(int * argc_p,char *** argv_p,struct m_pedit_sel * sel,struct m_pedit_key * tkey)28 parse_icmp(int *argc_p, char ***argv_p,
29 struct m_pedit_sel *sel, struct m_pedit_key *tkey)
30 {
31 int res = -1;
32 #if 0
33 int argc = *argc_p;
34 char **argv = *argv_p;
35
36 if (argc < 2)
37 return -1;
38
39 if (strcmp(*argv, "type") == 0) {
40 NEXT_ARG();
41 res = parse_u8(&argc, &argv, 0);
42 goto done;
43 }
44 if (strcmp(*argv, "code") == 0) {
45 NEXT_ARG();
46 res = parse_u8(&argc, &argv, 1);
47 goto done;
48 }
49 return -1;
50
51 done:
52 *argc_p = argc;
53 *argv_p = argv;
54 #endif
55 return res;
56 }
57
58 struct m_pedit_util p_pedit_icmp = {
59 NULL,
60 "icmp",
61 parse_icmp,
62 };
63