ifpps: remove voff increment from functions
[netsniff.git] / src / cli_interface.c
blobc15978ced6dddc5ba6f14ce08c74a38ba1a8785e
1 /*
2 * Mausezahn - A fast versatile traffic generator
3 * Copyright (C) 2008-2010 Herbert Haas
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 * details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, see http://www.gnu.org/licenses/gpl-2.0.html
20 #include "mz.h"
21 #include "cli.h"
22 #include "mops.h"
27 // Enter interface config mode:
28 //
29 int enter_interface (struct cli_def *cli, char *command, char *argv[], int argc)
31 int i, j=0;
32 char prompt[10];
34 if ( (strcmp(argv[argc-1],"?")==0) || (argc>1) )
36 cli_print(cli, "Specify an interface to configure\n");
37 return CLI_OK;
40 if (argc)
42 for (i=0; i<device_list_entries; i++)
44 if (strncmp(device_list[i].dev, argv[0], 16)==0)
46 j=1;
47 sprintf(prompt, "if-%s", device_list[i].dev);
48 clidev = i;
49 break;
53 if (j)
55 cli_set_configmode(cli, MZ_MODE_INTERFACE, prompt);
57 else
59 cli_print(cli, "Unknown device!\n");
62 else
64 cli_print(cli, "Specify an interface to configure\n");
67 return CLI_OK;
72 int conf_ip_address (struct cli_def *cli, char *command, char *argv[], int argc)
74 if ( (strcmp(argv[argc-1],"?")==0) || (argc>1) )
76 cli_print(cli, "A.B.C.D Specify a default interface IP address\n");
77 return CLI_OK;
80 if (argc)
82 if (mops_pdesc_ip (device_list[clidev].ip_mops, argv[0]))
84 cli_print(cli,"Invalid IP address (use format: A.B.C.D)\n");
87 else
88 cli_print(cli, "A.B.C.D Specify a default interface IP address\n");
90 return CLI_OK;
95 int conf_mac_address (struct cli_def *cli, char *command, char *argv[], int argc)
97 if ( (strcmp(argv[argc-1],"?")==0) || (argc>1) )
99 cli_print(cli, "XX:XX:XX:XX:XX:XX Configure a default interface MAC address\n");
100 return CLI_OK;
103 if (argc)
105 if (mops_pdesc_mac (device_list[clidev].mac_mops, argv[0]))
107 cli_print(cli,"Invalid MAC address (use format: XX:XX:XX:XX:XX:XX)\n");
110 else
111 cli_print(cli, "A.B.C.D Specify a default interface IP address\n");
113 return CLI_OK;
118 int conf_tag_dot1q (struct cli_def *cli, char *command, char *argv[], int argc)
120 if ( (strcmp(argv[argc-1],"?")==0) || (argc>1) )
122 cli_print(cli, "Specify one or more 802.1Q (and optionally 802.1P) tags\n");
123 return CLI_OK;
125 cli_print(cli, "Not supported in this version\n");
126 return CLI_OK;
129 int conf_tag_mpls (struct cli_def *cli, char *command, char *argv[], int argc)
131 if ( (strcmp(argv[argc-1],"?")==0) || (argc>1) )
133 cli_print(cli, "Specify one or more MPLS labels (and parameters)\n");
134 return CLI_OK;
136 cli_print(cli, "Not supported in this version\n");
137 return CLI_OK;