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__
27 #define CLI_DEBUG_PACKET 0x0001
29 #define MZ_MODE_BENCHMARK 1002
30 #define MZ_MODE_SCAN 1003
32 #define MZ_MODE_PACKET 1100
34 #define MZ_MODE_PACKET_ARP 1101
35 #define MZ_MODE_PACKET_BPDU 1102
36 #define MZ_MODE_PACKET_CDP 1103
37 #define MZ_MODE_PACKET_DNS 1104
38 #define MZ_MODE_PACKET_IP 1105
39 #define MZ_MODE_PACKET_ICMP 1106
40 #define MZ_MODE_PACKET_LLDP 1107
41 #define MZ_MODE_PACKET_RTP 1108
42 #define MZ_MODE_PACKET_SYSLOG 1109
43 #define MZ_MODE_PACKET_TCP 1110
44 #define MZ_MODE_PACKET_UDP 1111
45 #define MZ_MODE_PACKET_ETH 1112
46 #define MZ_MODE_PACKET_IGMP 1113
48 #define MZ_MODE_INTERFACE 1200
49 #define MZ_MODE_SEQUENCE 1300
51 #define MZ_BANNER_TEXT \
53 "------------------------------------------\n" \
54 "Mausezahn, version " MAUSEZAHN_VERSION_SHORT " \n" \
55 "Copyright (C) 2007-2009 by Herbert Haas.\n" \
56 "------------------------------------------\n\n" \
57 "Mausezahn comes with ABSOLUTELY NO WARRANTY; for details\n" \
58 "type 'warranty'. This is free software, and you are welcome\n" \
59 "to redistribute it under certain conditions; see COPYING\n" \
60 "(included in the Mausezahn source package) for details.\n\n" \
61 "For Mausezahn NEWS visit http://www.perihel.at/sec/mz/\n\n"
64 #define MZ_WARRANTY_TEXT \
65 "\nMausezahn, version " MAUSEZAHN_VERSION_SHORT " - a fast versatile traffic generator.\n" \
66 "Copyright (C) 2007-2009 by Herbert Haas ~ www.perihel.at\n" \
68 "This program is free software; you can redistribute it and/or modify it under\n" \
69 "the terms of the GNU General Public License version 2 as published by the \n" \
70 "Free Software Foundation.\n" \
72 "This program is distributed in the hope that it will be useful, but WITHOUT\n" \
73 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n" \
74 "FOR A PARTICULAR PURPOSE. See the GNU General Public License for more \n" \
77 "You should have received a copy of the GNU General Public License along with\n" \
78 "this program; if not, see http://www.gnu.org/licenses/gpl-2.0.html\n\n"
80 #define MZ_PROMPT "mz-" MAUSEZAHN_VERSION_SHORT
82 #define MZ_DEFAULT_USERNAME "mz"
83 #define MZ_DEFAULT_PASSWORD "mz"
84 #define MZ_DEFAULT_ENABLE_PASSWORD "mops"
85 #define MZ_DEFAULT_PORT 25542 // Towel day and 42
93 struct mops
*clipkt
; // actual packet used by CLI thread
97 // =================================================================
100 // Flags from 0x0000 to 0xFFFF
101 // cli_debug & 8000 => Developer specific debugs
102 // cli_debug & 0001 => Packet transmission debugging
105 // =================================================================
108 ///////////////////////////////////////////////////////////////////////////////
112 int cli_read_cfg(char *str
);
113 int mz_def16 (char *def
, u_int16_t val
, char *str256
);
116 int debug_all (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
117 int debug_packet (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
119 int cmd_end_to_config(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
120 int tx_switch(struct cli_def
*cli
);
121 int cmd_test(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
122 int cmd_reset_interface (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
124 int show_system(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
125 int show_packets(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
126 int show_set(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
127 int show_interfaces(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
128 int show_mops(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
129 int show_arp (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
131 int cmd_set(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
132 int cmd_run_id (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
133 int cmd_run_name (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
134 int cmd_run_sequence (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
135 int cmd_run_all (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
136 int cmd_stop (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
138 int launch_bpdu (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
139 int launch_synflood (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
141 int stop_mausezahn(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
142 int warranty(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
143 int transmit (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
144 int clear_all(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
145 int clear_packet(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
146 int cmd_reset_packet(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
147 int cmd_load (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
149 int enter_interface (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
150 int conf_ip_address (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
151 int conf_mac_address (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
152 int conf_tag_dot1q (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
153 int conf_tag_mpls (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
155 int conf_frame_limit (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
157 int conf_sequence (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
158 int sequence_add (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
159 int sequence_delay (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
160 int sequence_remove (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
161 int sequence_show (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
164 int enter_packet (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
165 int cmd_packet_type(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
166 int cmd_packet_end(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
167 int cmd_packet_clone (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
168 int cmd_packet_name (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
169 int cmd_packet_description (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
170 int cmd_packet_count (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
171 int cmd_packet_delay (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
172 int cmd_packet_interval (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
173 int cmd_packet_bind (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
174 int cmd_packet_mac_address_source (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
175 int cmd_packet_mac_address_destination (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
176 int cmd_eth_type (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
177 int cmd_eth_length (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
178 int cmd_eth_llc (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
179 int cmd_eth_snap (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
181 int cmd_packet_dot1q (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
182 int cmd_packet_mpls (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
183 int cmd_packet_payload_hex (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
184 int cmd_packet_payload_ascii (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
185 int cmd_packet_payload_raw (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
187 int cmd_port_source (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
188 int cmd_port_destination (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
189 int cmd_udp_sum (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
190 int cmd_udp_len (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
191 int cmd_udp_end(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
193 int cmd_tcp_seqnr (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
194 int cmd_tcp_acknr (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
195 int cmd_tcp_offset (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
196 int cmd_tcp_res (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
197 int cmd_tcp_flags (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
198 int cmd_tcp_cwr (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
199 int cmd_tcp_ece (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
200 int cmd_tcp_urg (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
201 int cmd_tcp_ack (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
202 int cmd_tcp_psh (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
203 int cmd_tcp_rst (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
204 int cmd_tcp_syn (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
205 int cmd_tcp_fin (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
206 int cmd_tcp_window (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
207 int cmd_tcp_sum (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
208 int cmd_tcp_urgptr(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
209 int cmd_tcp_options (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
210 int cmd_tcp_end(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
212 int cmd_dns_query(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
213 int cmd_dns_answer(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
214 int cmd_dns_ttl(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
215 int cmd_dns_end(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
217 int cmd_arp_hwtype (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
218 int cmd_arp_prtype (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
219 int cmd_arp_hwaddrsize (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
220 int cmd_arp_praddrsize (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
221 int cmd_arp_opcode (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
222 int cmd_arp_smac (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
223 int cmd_arp_sip (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
224 int cmd_arp_tmac (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
225 int cmd_arp_tip (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
226 int cmd_arp_trailer (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
227 int cmd_arp_end(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
229 int cmd_bpdu_id (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
230 int cmd_bpdu_version (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
231 int cmd_bpdu_type (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
232 int cmd_bpdu_flags (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
233 int cmd_bpdu_rid (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
234 int cmd_bpdu_pc (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
235 int cmd_bpdu_bid (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
236 int cmd_bpdu_pid (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
237 int cmd_bpdu_age (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
238 int cmd_bpdu_maxage (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
239 int cmd_bpdu_hello (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
240 int cmd_bpdu_fwd (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
241 int cmd_bpdu_mode (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
242 int cmd_bpdu_vlan(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
243 int cmd_bpdu_end(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
245 int cmd_igmpv2_genquery (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
246 int cmd_igmpv2_specquery (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
247 int cmd_igmpv2_report (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
248 int cmd_igmpv2_leave (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
249 int cmd_igmpv1_query (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
250 int cmd_igmpv1_report (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
252 int cmd_lldp_conformance (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
253 int cmd_lldp_chassis_id (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
254 int cmd_lldp_port_id (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
255 int cmd_lldp_ttl (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
256 int cmd_lldp_vlan (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
257 int cmd_lldp_opt_tlv (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
258 int cmd_lldp_opt_tlv_bad (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
259 int cmd_lldp_opt_org (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
260 int cmd_lldp_endtlv (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
261 int cmd_lldp_reset (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
263 int cmd_ip_address_source (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
264 int cmd_ip_address_destination (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
265 int cmd_ip_version (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
266 int cmd_ip_ttl (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
267 int cmd_ip_protocol (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
268 int cmd_ip_hlen (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
269 int cmd_ip_len (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
270 int cmd_ip_id (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
271 int cmd_ip_offset (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
272 int cmd_ip_sum (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
273 int cmd_ip_tos (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
274 int cmd_ip_dscp (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
275 int cmd_ip_rsv (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
276 int cmd_ip_df (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
277 int cmd_ip_mf (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
278 int cmd_ip_fragsize (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
279 int cmd_ip_fragoverlap (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
280 int cmd_ip_option (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
281 int cmd_ip_delivery (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
282 int cmd_ip_end(struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
284 int cmd_rtp_version (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
285 int cmd_rtp_padding (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
286 int cmd_rtp_xten (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
287 int cmd_rtp_marker (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
288 int cmd_rtp_cc (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
289 int cmd_rtp_pt (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
290 int cmd_rtp_ssrc (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
291 int cmd_rtp_sqnr (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
292 int cmd_rtp_time (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
293 int cmd_rtp_extension (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
294 int cmd_rtp_source (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);
295 int cmd_rtp_cclist (struct cli_def
*cli
, char *command
, char *argv
[], int argc
);