wiretap: Update README.developer

Update the wiretap README.developer for the changes from
commit b8b3531883 in how to
register a new file type. (Also, update from referring to
"open_routines_base[]" to "open_info_base[]").

[skip ci]
This commit is contained in:
John Thacker 2023-04-16 00:57:34 -04:00
parent 07c86d1b2c
commit 99ef99d725
1 changed files with 16 additions and 17 deletions

View File

@ -4,9 +4,6 @@ submit patches - free software is a community effort....
To add the ability to read a new capture file format, you have to:
add a new WTAP_FILE_ value for the file type to
"wiretap/wtap.h";
write an "open" routine that can read the beginning of the
capture file and figure out if it's in that format or not,
either by looking at a magic number at the beginning or by using
@ -31,20 +28,21 @@ To add the ability to read a new capture file format, you have to:
"subtype_close" member of the "wtap" structure to point to it,
otherwise leave it set to NULL;
add a pointer to the "open" routine to the "open_routines_base[]"
table in "wiretap/file_access.c" - if it uses a magic number, put
it in the first section of that list, and, if it uses a heuristic,
put it in the second section, preferably putting the heuristic
routines for binary files before the heuristic routines for text
files;
add an entry for that file type in the "open_info_base[]" table
in "wiretap/file_access.c", giving a pointer to the "open" routine,
a name to use in file open dialogs, whether the file type uses a
magic number or a heuristic, and if it uses a heuristic, file
extensions for which the heuristic should be tried first. More
discriminating and faster heuristics should be put before less
accurate and slower heuristics;
add an entry for that file type in the "dump_open_table_base[]" in
"wiretap/file_access.c", giving a descriptive name, a short name
that's convenient to type on a command line (no blanks or capital
letters, please), common file extensions to open and save, a flag
if it can be compressed with gzip (currently unused) and pointers
to the "can_write_encap" and "dump_open" routines if writing that
file is supported (see below), otherwise just null pointers.
add a registration routine passing a "file_type_subtype_info" struct
to wtap_register_file_type_subtypes(), giving a descriptive name, a
short name that's convenient to type on a command line (no blanks or
capital letters, please), common file extensions to open and save,
any block types supported, and pointers to the "can_write_encap" and
"dump_open" routines if writing that file is supported (see below),
otherwise just null pointers.
Wiretap applications typically first perform sequential reads through
the capture file and may later do "seek and read" for individual frames.
@ -84,6 +82,7 @@ To add the ability to write a new capture file format, you have to:
to it;
put pointers to the "can_write_encap" and "dump_open" routines
in the "dump_open_table_base[]" entry for that file type.
in the "file_type_subtype_info" struct passed to
wtap_register_file_type_subtypes().
In the wiretap directory, add your source file to CMakelists.txt.