diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-05-24 11:28:30 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-05-24 18:31:25 +0000 |
commit | 6db77b000fe58173eeed23b91b32c92c681feda2 (patch) | |
tree | 5113821a7f5e1b43734eccf94783d37962b37712 /epan/wslua/make-init-lua.pl | |
parent | 33ae4cb024e36192ff7c6fa1d3d6bdcce9b25b7a (diff) |
Allow wtap_read() and wtap_seek_read() to return records other than packets.
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be
REC_TYPE_PACKET, for a record containing a packet, or
REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific
data.
Modify code that reads packets to be able to handle non-packet records,
even if that just means ignoring them.
Rename some routines to indicate that they handle more than just
packets.
We don't yet have any libwiretap code that supplies records other than
REC_TYPE_PACKET or that supporting writing records other than
REC_TYPE_PACKET, or any code to support plugins for handling
REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug
8590.
Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813
Reviewed-on: https://code.wireshark.org/review/1773
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/wslua/make-init-lua.pl')
-rwxr-xr-x | epan/wslua/make-init-lua.pl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/epan/wslua/make-init-lua.pl b/epan/wslua/make-init-lua.pl index 328dd9fc92..29df74019f 100755 --- a/epan/wslua/make-init-lua.pl +++ b/epan/wslua/make-init-lua.pl @@ -34,6 +34,7 @@ my $wtap_encaps_table = ''; my $wtap_filetypes_table = ''; my $wtap_commenttypes_table = ''; my $ft_types_table = ''; +my $wtap_rec_types_table = ''; my $wtap_presence_flags_table = ''; my $bases_table = ''; my $encodings = ''; @@ -48,6 +49,7 @@ my %replacements = %{{ WTAP_FILETYPES => \$wtap_filetypes_table, WTAP_COMMENTTYPES => \$wtap_commenttypes_table, FT_TYPES => \$ft_types_table, + WTAP_REC_TYPES => \$wtap_rec_types_table, WTAP_PRESENCE_FLAGS => \$wtap_presence_flags_table, BASES => \$bases_table, ENCODINGS => \$encodings, @@ -78,6 +80,7 @@ close TEMPLATE; $wtap_encaps_table = "-- Wiretap encapsulations XXX\nwtap_encaps = {\n"; $wtap_filetypes_table = "-- Wiretap file types\nwtap_filetypes = {\n"; $wtap_commenttypes_table = "-- Wiretap file comment types\nwtap_comments = {\n"; +$wtap_rec_types_table = "-- Wiretap record_types\nwtap_rec_types = {\n"; $wtap_presence_flags_table = "-- Wiretap presence flags\nwtap_presence_flags = {\n"; open WTAP_H, "< $WSROOT/wiretap/wtap.h" or die "cannot open '$WSROOT/wiretap/wtap.h': $!"; @@ -96,6 +99,10 @@ while(<WTAP_H>) { $wtap_commenttypes_table .= "\t[\"$1\"] = $2,\n"; } + if ( /^#define REC_TYPE_([A-Z0-9_]+)\s+(\d+)\s+\/\*\*<([^\*]+)\*\// ) { + $wtap_rec_types_table .= "\t[\"$1\"] = $2, --$3\n"; + } + if ( /^#define WTAP_HAS_([A-Z0-9_]+)\s+(0x\d+)\s+\/\*\*<([^\*]+)\*\// ) { my $num = hex($2); $wtap_presence_flags_table .= "\t[\"$1\"] = $num, --$3\n"; @@ -105,6 +112,9 @@ while(<WTAP_H>) { $wtap_encaps_table =~ s/,\n$/\n}\nwtap = wtap_encaps -- for bw compatibility\n/msi; $wtap_filetypes_table =~ s/,\n$/\n}\n/msi; $wtap_commenttypes_table =~ s/,\n$/\n}\n/msi; +# wtap_rec_types_table has comments at the end (not a comma), +# but Lua doesn't care about extra commas so leave it in +$wtap_rec_types_table =~ s/\n$/\n}\n/msi; # wtap_presence_flags_table has comments at the end (not a comma), # but Lua doesn't care about extra commas so leave it in $wtap_presence_flags_table =~ s/\n$/\n}\n/msi; |