iproute2/tc/p_icmp.c
<<
>>
Prefs
   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 <fcntl.h>
  17#include <sys/socket.h>
  18#include <netinet/in.h>
  19#include <arpa/inet.h>
  20#include <string.h>
  21#include "utils.h"
  22#include "tc_util.h"
  23#include "m_pedit.h"
  24
  25
  26static int
  27parse_icmp(int *argc_p, char ***argv_p,
  28           struct m_pedit_sel *sel, struct m_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
  50done:
  51        *argc_p = argc;
  52        *argv_p = argv;
  53#endif
  54        return res;
  55}
  56
  57struct m_pedit_util p_pedit_icmp = {
  58        .id = "icmp",
  59        .parse_peopt = parse_icmp,
  60};
  61