On 20.09.2010 22:48, Oliver Hartkopp wrote:
> On 20.09.2010 16:28, [email protected] wrote:
>> B) Is it possible to label CAN packets in the similar way as done by
>> "--set-mark" in iptables?
>
> ??? Need to look into the ideas there. Maybe i can go for that tommorow.
done :-)
AFAICS a control message for marking CAN frames can be added to the CAN stuff
also.
E.g. A new SO_MARK control message for CAN could be handled in the same way as
described here:
>> D) Do we still need extra ioctl call to get the Rx message timestamp?
>> I remember the discussion about the possibility to pass timestamp
>> with the message itself about two years ago.
>
> You can use recvmsg() - an example can be found for the timestamp and the
> dropcounter in trunk/can-utils/candump.c
>
> 602 nbytes = recvmsg(s[i], &msg, 0);
>
> (..)
>
> 627 for (cmsg = CMSG_FIRSTHDR(&msg);
> 628 cmsg && (cmsg->cmsg_level == SOL_SOCKET);
> 629 cmsg = CMSG_NXTHDR(&msg,cmsg)) {
> 630 if (cmsg->cmsg_type == SO_TIMESTAMP)
> 631 tv = *(struct timeval *)CMSG_DATA(cmsg);
> 632 else if (cmsg->cmsg_type == SO_RXQ_OVFL)
> 633 dropcnt[i] = *(__u32 *)CMSG_DATA(cmsg);
> 634 }
>
But just for curiosity ...
Why do you think that you need to know whether a CAN frame was locally
originated? It's a broadcast medium and the received frames on userspace level
reflect the traffic on the bus.
Isn't the (uniquely defined) CAN-ID enough to know whether it was originated
from the local machine?
Regards,
Oliver
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core