Hello Guys,
For a research project we want to write a Wireshark protocol interpreter and need to have access to accurate hardware timestamps. I've seen this but am not familiar with the inner workings of Wireshark. Do you have any idea how to get access to the stamp[2] value in Wireshark?
Cheers,
Chris
Hardware Timestamps in Wireshark with SocketCAN
- S.Grosjean
- Software Development
- Posts: 357
- Joined: Wed 4. Jul 2012, 17:02
Re: Hardware Timestamps in Wireshark with SocketCAN
Hi,
If you're asking to get the so-called "hardware timestamp" from socket-CAN API, then the socket application has to set the corresponding socket option, something like:
Then, you should check your CMSG list on rx side with:
stamp[2] is the raw hardware timestamp.
(see also chapter 2.2. Receive timestamps in linux/Documentation/networking/timestamping.txt)
But... I admit, this has nothing to do with Wireshark and we actually don't absolutely know how a Wireshark plug-in could sniff these data structures.
Regards,
If you're asking to get the so-called "hardware timestamp" from socket-CAN API, then the socket application has to set the corresponding socket option, something like:
Code: Select all
int flags = SOF_TIMESTAMPING_SOFTWARE |
SOF_TIMESTAMPING_RX_SOFTWARE |
SOF_TIMESTAMPING_RAW_HARDWARE;
setsockopt(s, SOL_SOCKET, SO_TIMESTAMPING, &flags, sizeof(flags));
Code: Select all
if (cmsg->cmsg_type == SO_TIMESTAMPING) {
struct timespec *stamp = (struct timespec *)CMSG_DATA(cmsg);
(see also chapter 2.2. Receive timestamps in linux/Documentation/networking/timestamping.txt)
But... I admit, this has nothing to do with Wireshark and we actually don't absolutely know how a Wireshark plug-in could sniff these data structures.
Regards,
— Stéphane