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: 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 write an "open" routine that can read the beginning of the
capture file and figure out if it's in that format or not, 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 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, "subtype_close" member of the "wtap" structure to point to it,
otherwise leave it set to NULL; otherwise leave it set to NULL;
add a pointer to the "open" routine to the "open_routines_base[]" add an entry for that file type in the "open_info_base[]" table
table in "wiretap/file_access.c" - if it uses a magic number, put in "wiretap/file_access.c", giving a pointer to the "open" routine,
it in the first section of that list, and, if it uses a heuristic, a name to use in file open dialogs, whether the file type uses a
put it in the second section, preferably putting the heuristic magic number or a heuristic, and if it uses a heuristic, file
routines for binary files before the heuristic routines for text extensions for which the heuristic should be tried first. More
files; 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 add a registration routine passing a "file_type_subtype_info" struct
"wiretap/file_access.c", giving a descriptive name, a short name to wtap_register_file_type_subtypes(), giving a descriptive name, a
that's convenient to type on a command line (no blanks or capital short name that's convenient to type on a command line (no blanks or
letters, please), common file extensions to open and save, a flag capital letters, please), common file extensions to open and save,
if it can be compressed with gzip (currently unused) and pointers any block types supported, and pointers to the "can_write_encap" and
to the "can_write_encap" and "dump_open" routines if writing that "dump_open" routines if writing that file is supported (see below),
file is supported (see below), otherwise just null pointers. otherwise just null pointers.
Wiretap applications typically first perform sequential reads through Wiretap applications typically first perform sequential reads through
the capture file and may later do "seek and read" for individual frames. 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; to it;
put pointers to the "can_write_encap" and "dump_open" routines 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. In the wiretap directory, add your source file to CMakelists.txt.