diff options
author | Dario Lombardo <lomato@gmail.com> | 2015-11-10 15:41:52 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-11-11 13:22:05 +0000 |
commit | f1ff6d62c4fc1db0f5b98efd537f3ec518b0d4b8 (patch) | |
tree | c1bb7ecf4c3aa5ea444752b71cc6508bc145d733 /randpkt-core.h | |
parent | 328fbc001e89d2daaca343c378744e75e0a107fb (diff) | |
download | wireshark-f1ff6d62c4fc1db0f5b98efd537f3ec518b0d4b8.tar.gz |
randpkt: split into a core and an app.
This will allow other apps to use the random packet generation
features.
Change-Id: I7e9af58cbe39da4908242b5fbb292f473e03b4f2
Reviewed-on: https://code.wireshark.org/review/11579
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'randpkt-core.h')
-rw-r--r-- | randpkt-core.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/randpkt-core.h b/randpkt-core.h new file mode 100644 index 0000000000..0ba56cfefc --- /dev/null +++ b/randpkt-core.h @@ -0,0 +1,69 @@ +/* + * randpkt-core.h + * --------- + * Creates random packet traces. Useful for debugging sniffers by testing + * assumptions about the veracity of the data found in the packet. + * + * Copyright (C) 1999 by Gilbert Ramirez <gram@alumni.rice.edu> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __RANDPKT_CORE_H__ +#define __RANDPKT_CORE_H__ + +#include <glib.h> +#include "wiretap/wtap.h" + +typedef struct { + const char* abbrev; + const char* longname; + int produceable_type; + int sample_wtap_encap; + guint8* sample_buffer; + int sample_length; + guint8* pseudo_buffer; + guint pseudo_length; + wtap_dumper* dump; + const char* filename; + guint produce_max_bytes; + +} randpkt_example; + +/* Return the number of active examples */ +guint randpkt_example_count(void); + +/* Return the list of the active examples */ +void randpkt_example_list(const char*** abbrev_list, const char*** longname_list, unsigned* list_num); + +/* Seed the random-number generator */ +void randpkt_seed(void); + +/* Parse command-line option "type" and return enum type */ +int randpkt_parse_type(char *string); + +/* Find pkt_example record and return pointer to it */ +randpkt_example* randpkt_find_example(int type); + +/* Init a new example */ +void randpkt_example_init(randpkt_example* example, char* produce_filename, int produce_max_bytes); + +/* Loop the packet generation */ +void randpkt_loop(randpkt_example* example, guint64 produce_count); + +/* Close the current example */ +gboolean randpkt_example_close(randpkt_example* example); + +#endif |