IETF-OPSAWG-WG / draft-ietf-opsawg-pcap

PCAP next generation file format specification
Other
263 stars 59 forks source link

Order of options in a block with respect to option code? #152

Closed daluu closed 1 month ago

daluu commented 6 months ago

I was looking at the spec, https://github.com/IETF-OPSAWG-WG/draft-ietf-opsawg-pcap/blob/master/draft-ietf-opsawg-pcapng.md, let me know if I'm viewing the wrong/outdated version.

I didn't find any mention on ordering of options within the options section of a block. Does/should order matter (in terms of order by option code)? Does the spec offer any guidance on this matter?

I'm assuming that this currently is open ended, and readers should be able to handle processing options in any order and writers can write the options in any order. I did some tests in this area and found that Wireshark seems to be able to handle options in any order.

Personally though, for readability, and in cases of working with unit tests around pcapng read/write of options, I'd prefer to write options ordered by option code, and if the reader code were to display/visualize them, I'd also sort and order them (if not needing to render the data as it is exactly written). It's easier to read/skim/look them over in (ascending) order than some undefined order.

I just wanted to pose this question to get the matter clarified. If the spec does mention ordering, please point me to it. Thanks.

guyharris commented 6 months ago

I didn't find any mention on ordering of options within the options section of a block. Does/should order matter (in terms of order by option code)?

No/no.

I'm assuming that this currently is open ended,

Yes.

and readers should be able to handle processing options in any order

Yes.

and writers can write the options in any order.

Yes.

Personally though, for readability, and in cases of working with unit tests around pcapng read/write of options, I'd prefer to write options ordered by option code,

You're welcome to do so, but other writers are not and will not be required to do so.

Note that, as option codes are assigned sequentially, that order has no significance other than the order in which options happened to be assigned.

and if the reader code were to display/visualize them, I'd also sort and order them.

Your reader is welcome to do so, but other readers are not and will not be required to do so. A reader may, for example, group them as it chooses, or treat some as more likely to be interesting and put those first, etc..