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
Modes is null, returns either the number of modes on success or -1 on failure;
- if
Modes is non-null, fills in *Modes and 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.
The call might look like
which would return a pointer to an allocated array of
ULONGvalues corresponding to supported time stamp modes and set*NumModesto the number of modes in the array. That might require another routine to free that array.Alternatively, it might look like
which:
Modesis null, returns either the number of modes on success or -1 on failure;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
BIOCGNUMTIMESTAMPMODESandBIOCGTIMESTAMPMODESioctls. The first takes anint-sized buffer and fills it in with a count of the number of time stamp modes; the second takes a pointer to the array ofULONGand fills it in.This would allow libpcap to implement
pcap_list_tstamp_types()with Npcap.