Tagging module iproute2 - iproute2-2.6.16-2
[iproute2.git] / tc / p_icmp.c
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
28 parse_icmp(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey)
29 {
30         int res = -1;
31 #if 0
32         int argc = *argc_p;
33         char **argv = *argv_p;
34
35         if (argc < 2)
36                 return -1;
37
38         if (strcmp(*argv, "type") == 0) {
39                 NEXT_ARG();
40                 res = parse_u8(&argc, &argv, 0);
41                 goto done;
42         }
43         if (strcmp(*argv, "code") == 0) {
44                 NEXT_ARG();
45                 res = parse_u8(&argc, &argv, 1);
46                 goto done;
47         }
48         return -1;
49
50       done:
51         *argc_p = argc;
52         *argv_p = argv;
53 #endif
54         return res;
55 }
56
57 struct m_pedit_util p_pedit_icmp = {
58         NULL,
59         "icmp",
60         parse_icmp,
61 };