2 * Mausezahn - A fast versatile traffic generator
3 * Copyright (C) 2008-2010 Herbert Haas
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.
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
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
27 // Enter interface config mode:
29 int enter_interface (struct cli_def
*cli
, char *command
, char *argv
[], int argc
)
34 if ( (strcmp(argv
[argc
-1],"?")==0) || (argc
>1) )
36 cli_print(cli
, "Specify an interface to configure\n");
42 for (i
=0; i
<device_list_entries
; i
++)
44 if (strncmp(device_list
[i
].dev
, argv
[0], 16)==0)
47 sprintf(prompt
, "if-%s", device_list
[i
].dev
);
55 cli_set_configmode(cli
, MZ_MODE_INTERFACE
, prompt
);
59 cli_print(cli
, "Unknown device!\n");
64 cli_print(cli
, "Specify an interface to configure\n");
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");
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");
88 cli_print(cli
, "A.B.C.D Specify a default interface IP address\n");
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");
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");
111 cli_print(cli
, "A.B.C.D Specify a default interface IP address\n");
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");
125 cli_print(cli
, "Not supported in this version\n");
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");
136 cli_print(cli
, "Not supported in this version\n");