2 * Mausezahn - A fast versatile traffic generator
3 * Copyright (C) 2008 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
21 #ifndef __MAUSEZAHN_CLI__
22 #define __MAUSEZAHN_CLI__
28 #define CLI_DEBUG_PACKET 0x0001
30 #define MZ_MODE_BENCHMARK 1002
31 #define MZ_MODE_SCAN 1003
33 #define MZ_MODE_PACKET 1100
35 #define MZ_MODE_PACKET_ARP 1101
36 #define MZ_MODE_PACKET_BPDU 1102
37 #define MZ_MODE_PACKET_CDP 1103
38 #define MZ_MODE_PACKET_DNS 1104
39 #define MZ_MODE_PACKET_IP 1105
40 #define MZ_MODE_PACKET_ICMP 1106
41 #define MZ_MODE_PACKET_LLDP 1107
42 #define MZ_MODE_PACKET_RTP 1108
43 #define MZ_MODE_PACKET_SYSLOG 1109
44 #define MZ_MODE_PACKET_TCP 1110
45 #define MZ_MODE_PACKET_UDP 1111
46 #define MZ_MODE_PACKET_ETH 1112
47 #define MZ_MODE_PACKET_IGMP 1113
49 #define MZ_MODE_INTERFACE 1200
50 #define MZ_MODE_SEQUENCE 1300
52 #define MZ_DEFAULT_USERNAME "mz"
53 #define MZ_DEFAULT_PASSWORD "mz"
54 #define MZ_DEFAULT_ENABLE_PASSWORD "mops"
55 #define MZ_DEFAULT_PORT 25542 // Towel day and 42
62 char mz_listen_addr
[16];
64 struct mops
*clipkt
; // actual packet used by CLI thread
68 // =================================================================
71 // Flags from 0x0000 to 0xFFFF
72 // cli_debug & 8000 => Developer specific debugs
73 // cli_debug & 0001 => Packet transmission debugging
76 // =================================================================
79 ///////////////////////////////////////////////////////////////////////////////
82 void mz_cli_init(void);
83 int cli_read_cfg(char *str
);
84 int mz_def16 (char *def
, u_int16_t val
, char *str256
);
87 int debug_all (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
88 int debug_packet (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
90 int cmd_end_to_config(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
91 int tx_switch(struct cli_def
*cli
);
92 int cmd_test(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
93 int cmd_reset_interface (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
95 int show_system(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
96 int show_packets(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
97 int show_set(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
98 int show_interfaces(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
99 int show_mops(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
100 int show_arp (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
102 int cmd_set(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
103 int cmd_run_id (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
104 int cmd_run_name (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
105 int cmd_run_sequence (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
106 int cmd_run_all (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
107 int cmd_stop (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
109 int launch_bpdu (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
110 int launch_synflood (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
112 int stop_mausezahn(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
113 int transmit (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
114 int clear_all(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
115 int clear_packet(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
116 int cmd_reset_packet(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
117 int cmd_load (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
119 int enter_interface (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
120 int conf_ip_address (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
121 int conf_mac_address (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
122 int conf_tag_dot1q (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
123 int conf_tag_mpls (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
125 int conf_frame_limit (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
127 int conf_sequence (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
128 int sequence_add (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
129 int sequence_delay (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
130 int sequence_remove (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
131 int sequence_show (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
134 int enter_packet (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
135 int cmd_packet_type(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
136 int cmd_packet_end(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
137 int cmd_packet_clone (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
138 int cmd_packet_name (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
139 int cmd_packet_description (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
140 int cmd_packet_count (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
141 int cmd_packet_delay (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
142 int cmd_packet_interval (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
143 int cmd_packet_bind (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
144 int cmd_packet_mac_address_source (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
145 int cmd_packet_mac_address_destination (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
146 int cmd_eth_type (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
147 int cmd_eth_length (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
148 int cmd_eth_llc (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
149 int cmd_eth_snap (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
151 int cmd_packet_dot1q (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
152 int cmd_packet_mpls (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
153 int cmd_packet_payload_hex (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
154 int cmd_packet_payload_ascii (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
155 int cmd_packet_payload_raw (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
157 int cmd_port_source (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
158 int cmd_port_destination (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
159 int cmd_udp_sum (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
160 int cmd_udp_len (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
161 int cmd_udp_end(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
163 int cmd_tcp_seqnr (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
164 int cmd_tcp_acknr (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
165 int cmd_tcp_offset (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
166 int cmd_tcp_res (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
167 int cmd_tcp_flags (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
168 int cmd_tcp_cwr (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
169 int cmd_tcp_ece (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
170 int cmd_tcp_urg (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
171 int cmd_tcp_ack (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
172 int cmd_tcp_psh (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
173 int cmd_tcp_rst (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
174 int cmd_tcp_syn (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
175 int cmd_tcp_fin (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
176 int cmd_tcp_window (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
177 int cmd_tcp_sum (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
178 int cmd_tcp_urgptr(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
179 int cmd_tcp_options (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
180 int cmd_tcp_end(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
182 int cmd_dns_query(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
183 int cmd_dns_answer(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
184 int cmd_dns_ttl(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
185 int cmd_dns_end(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
187 int cmd_arp_hwtype (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
188 int cmd_arp_prtype (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
189 int cmd_arp_hwaddrsize (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
190 int cmd_arp_praddrsize (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
191 int cmd_arp_opcode (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
192 int cmd_arp_smac (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
193 int cmd_arp_sip (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
194 int cmd_arp_tmac (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
195 int cmd_arp_tip (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
196 int cmd_arp_trailer (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
197 int cmd_arp_end(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
199 int cmd_bpdu_id (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
200 int cmd_bpdu_version (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
201 int cmd_bpdu_type (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
202 int cmd_bpdu_flags (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
203 int cmd_bpdu_rid (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
204 int cmd_bpdu_pc (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
205 int cmd_bpdu_bid (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
206 int cmd_bpdu_pid (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
207 int cmd_bpdu_age (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
208 int cmd_bpdu_maxage (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
209 int cmd_bpdu_hello (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
210 int cmd_bpdu_fwd (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
211 int cmd_bpdu_mode (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
212 int cmd_bpdu_vlan(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
213 int cmd_bpdu_end(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
215 int cmd_igmpv2_genquery (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
216 int cmd_igmpv2_specquery (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
217 int cmd_igmpv2_report (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
218 int cmd_igmpv2_leave (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
219 int cmd_igmpv1_query (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
220 int cmd_igmpv1_report (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
222 int cmd_lldp_conformance (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
223 int cmd_lldp_chassis_id (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
224 int cmd_lldp_port_id (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
225 int cmd_lldp_ttl (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
226 int cmd_lldp_vlan (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
227 int cmd_lldp_opt_tlv (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
228 int cmd_lldp_opt_tlv_bad (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
229 int cmd_lldp_opt_org (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
230 int cmd_lldp_endtlv (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
231 int cmd_lldp_reset (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
233 int cmd_ip_address_source (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
234 int cmd_ip_address_destination (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
235 int cmd_ip_version (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
236 int cmd_ip_ttl (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
237 int cmd_ip_protocol (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
238 int cmd_ip_hlen (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
239 int cmd_ip_len (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
240 int cmd_ip_id (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
241 int cmd_ip_offset (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
242 int cmd_ip_sum (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
243 int cmd_ip_tos (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
244 int cmd_ip_dscp (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
245 int cmd_ip_rsv (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
246 int cmd_ip_df (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
247 int cmd_ip_mf (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
248 int cmd_ip_fragsize (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
249 int cmd_ip_fragoverlap (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
250 int cmd_ip_option (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
251 int cmd_ip_delivery (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
252 int cmd_ip_end(struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
254 int cmd_rtp_version (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
255 int cmd_rtp_padding (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
256 int cmd_rtp_xten (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
257 int cmd_rtp_marker (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
258 int cmd_rtp_cc (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
259 int cmd_rtp_pt (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
260 int cmd_rtp_ssrc (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
261 int cmd_rtp_sqnr (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
262 int cmd_rtp_time (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
263 int cmd_rtp_extension (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
264 int cmd_rtp_source (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);
265 int cmd_rtp_cclist (struct cli_def
*cli
, const char *command
, char *argv
[], int argc
);