-
Notifications
You must be signed in to change notification settings - Fork 579
Description
The call might look like
ULONG * PacketGetTimestampModes(LPADAPTER AdapterObject, UINT *NumModes);
which would return a pointer to an allocated array of ULONG values corresponding to supported time stamp modes and set *NumModes to the number of modes in the array. That might require another routine to free that array.
Alternatively, it might look like
int PacketGetTimestampModes(LPADAPTER AdapterObject, ULONG *Modes)
which:
- if
Modesis null, returns either the number of modes on success or -1 on failure; - if
Modesis non-null, fills in*Modesand returns the number of modes on success or -1 on failure.
The caller would first call it with a null Modes, to find out how big a buffer it needs, and then allocate the buffer and call it again with that buffer. I don't expect that the number of available modes will change over time without, for example, installing a newer version of Npcap, so two calls should suffice.
This might be implemented atop BIOCGNUMTIMESTAMPMODES and BIOCGTIMESTAMPMODES ioctls. The first takes an int-sized buffer and fills it in with a count of the number of time stamp modes; the second takes a pointer to the array of ULONG and fills it in.
This would allow libpcap to implement pcap_list_tstamp_types() with Npcap.