-
Notifications
You must be signed in to change notification settings - Fork 979
Rework packet lines in struct ndpi_packet_struct #3032
Copy link
Copy link
Open
Labels
Description
Rework the work with lines in packets.
Currently, each header has a named pointer in the form of a struct ndpi_int_one_line_struct structure and all structures follow each other.
I suggest moving to an array of structures and human-readable names of indexes (via enum).
This will significantly reduce the code in ndpi_int_one_line_struct(), eliminate the code for initializing the headers_[a-z] arrays in parse_single_packet_line() and at the same time will not change the speed of access to headers from the compiler's point of view.
To access the header lines, make several inline functions. These functions will help make working with lines safer, since you can implement checks for going beyond the boundaries of the header line.
An example can be found in https://github.com/vel21ripn/nDPI/src/lib/protocols/bittorrent.c functions memcmp_packet_hdr() and memcmp_packet_line().
From #2803 (comment), by @vel21ripn
Reactions are currently unavailable