From d0009856814c13d13770db5aadd7b2fabf947776 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Mon, 13 May 2013 13:53:27 +0200 Subject: staging: add mausezahn staging directory After some back and forth, we decided that it is easier to maintain mausezahn in a staging directory until it is fully reworked and cleaned up to be ready to be fully integrated. This way, it is better than having it in a separate branch, and we can also accept patches from outside more easily. Also, while at it, fix up some function mismatches with libcli. Signed-off-by: Daniel Borkmann Signed-off-by: Tobias Klauser --- staging/cli_set.c | 350 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 350 insertions(+) create mode 100644 staging/cli_set.c (limited to 'staging/cli_set.c') diff --git a/staging/cli_set.c b/staging/cli_set.c new file mode 100644 index 0000000..8b365fc --- /dev/null +++ b/staging/cli_set.c @@ -0,0 +1,350 @@ +/* + * Mausezahn - A fast versatile traffic generator + * Copyright (C) 2008 Herbert Haas + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, see http://www.gnu.org/licenses/gpl-2.0.html + * +*/ + + +#include "mz.h" +#include "cli.h" + + +int cmd_set(struct cli_def *cli, const char *command, char *argv[], int argc) +{ + libnet_t *l; + unsigned int time_factor; + int i, cnt, found_dev; + char *dum; + unsigned char *x; + + + if (argc < 2) { + cli_print(cli, "Specify a variable to set:\r\n"); + cli_print(cli, "device specify the primary network device\r"); + + cli_print(cli, "NOTE: The following options are non-MOPS and deprecated:\n"); + + cli_print(cli, "a|sa specify a MAC source address\r"); + cli_print(cli, "b|da specify a MAC destination address\r"); + cli_print(cli, "A|SA specify a IP source address\r"); + cli_print(cli, "B|DA specify a IP destination address\r"); + cli_print(cli, "c|count specify a packet count value\r"); + cli_print(cli, "d|delay specify an interpacket delay (usec, msec, or sec)\r"); + cli_print(cli, "P|payload specify an ASCII payload\r"); + cli_print(cli, "H|hexload specify a hexadecimal payload\r"); + cli_print(cli, "p|padding specify a number of padding bytes (total for raw, added otherwise)\r"); + cli_print(cli, "Q|vlan specify one ore more 802.1Q vlan tags\r"); + cli_print(cli, "M|mpls specify one ore more MPLS labels\r"); + cli_print(cli, "\n"); + return CLI_OK; + } + + // set primary device + if (strncmp(argv[0], "device", 2)==0) + { + if (strncmp(argv[1],"?",1)==0) + { + cli_print(cli,"Specify the primary network device (use 'show dev' for a list)\n"); + } + else + { + if (strlen(argv[1])) + { + found_dev = 0; + for (i=0; i MAX_PAYLOAD_SIZE) + { + cli_print(cli, "Note: Padding too big! However, let's try and see what happens...\n"); + } + } + } + + + + // DEFAULT ANSWER: + else + { + cli_print(cli, "Unknown variable '%s'\n",argv[0]); + } + + return CLI_OK; +} -- cgit v1.2.3-54-g00ecf