I am looking for a tool to make it easier to experiment with tweaks to the Controller Area network (CAN) protocol, as well as experiment with building protocols on top of it.
In particular, I am looking for a simulation of the CAN bus with programmable nodes such that each node is able to completely control the bits that it outputs on the bus in any given packet, but the usual CAN node behavior (such as inter-frame spacing) and CAN bus features (such as arbitration) are still available.
However, if anything close to such a tool exists and is open source, I can most likely modify it to satisfy my requirements.
I have looked at CANOpen Magic, and RTaW-Sim, but they do not provide the exact functionality that I am looking for, and I cannot modify them to do so because they are not open source.
If no such library exists, please mention this in the comments.