Is the CAN bus protocol a master and slave protocol?
A CAN bus is multi-master and automatically arbitration free. The whole point is that you don't need a single master or main controller to take care of everything. Each message that is sent has a priority, and higher priority messages trump lower priority ones (a lower priority message will wait until there isn't a high priority message being sent). So there are no slaves. It's kind of similar to a peer to peer network, in that it's decentralized. The reason this is done is to reduce failure points. If a single main controller failed, so would the entire network. If there is no central controller, a single component can fail and the rest of the system will keep going.
For your network, you should assign priorities to each command sent depending on what's most important. The Wikipedia article is actually quite good.
CAN is a low-level protocol, somewhere around the data-link layer of the OSI model (layer 2). Thus it is only concerned with transferring generic data frames. CAN does not specify a network topology, nor how data gets passed around, nor the nature of the data etc etc.
So CAN is not a master/slave protocol for the same reason as UART isn't one.
On top of the standard CAN protocol frames, you need higher layers that define the communication. The far most common ones for CAN are:
- CANopen (most common, generic)
- DeviceNet (generic, mainly used in the automation industry)
- J1939 (trucks, tractors, heavy vehicles)
These work in entirely different ways.
CANopen for example, doesn't define a master as far as the data traffic is concerned. Data communication between nodes on the bus is only a concern of the nodes involved: there is no master directing data traffic and every node can be configured to speak/listen to any other node.
But CANopen does define a "network manager" master, who is in charge of supervising the nodes on the bus: making sure they start correctly and remain alive and functional etc.
CAN only has masters. One node transmits at a time - if multiple nodes being a transmission at approximately the same time, they will collide, and the node transmitting the lowest ID will win arbitration. The other nodes will listen to the winning node's message and then after some backoff time re-try their own transmissions.
And of course, there's nothing to stop you building some kind of master/slave protocol on top of the low-level message-moving that CAN provides you with.