# Resistance to Cybersecurity Attacks in a Novel Network for Autonomous Vehicles
## 3 Delay Tolerant Network Protocols
### Black and Grey Hole Spray and Wait  
The Spray and Wait routing protocol is a relatively simple yet efficient routing scheme that consists of two phases [30]. Spray and Wait is a combination of ideas from two other routing protocols: Epidemic and Direct Transmission Epidemic is very effective at spreading a message quickly though a network to the destination, however it uses an immense amount of computational resources; direct transmission uses very few resources but takes a long time to deliver the message. Spray and Wait is an effective amalgamation as the spray phase allows the speed of epidemic routing and the wait phase continues until the message is delivered to the required destination node. The biggest issue with the protocol is how to determine the number of copies of the message which should be spread in the initial stage. If the number is too small, the message may not be delivered, but if the figure is too large it could become identical to the Epidemic Routing Protocol with resulting high computational expense and use of resources. There are currently two common adaptations of the spray and wait protocol, the only difference between them being how the message is distributed during the first phase. ```
start whileTruedo ifContactedNodethen ifBlackHolethen  Drop Messages elseifGreyHolethen ifDroppingMessagesthen  Drop Messages else ifNextnodedoesnothacemessagesthen  Forward copy of messages end else ifNextnodedoesnothacemessagesthen  Forward copy of messages end
```  
**Algorithm 1**Black and Grey Hole Epidemic Router  
Every message that originates at a source node within the network is copied a set number of times. Once two nodes meet, they will transfer half of the available copies of each relevant message. This continues until a node only holds one copy of the message and then goes into the wait phase. The reason this adaptation was made is passing messages in this manner allows far a faster spread and therefore lower latency within the network. Once a message has reached the limit of copies, if the destination node for the message was not found during the previous phase, each of the nodes that has a replication of the message then uses direct transmission in order to deliver it to the required node. The wait phase vastly reduces the computational expenses, however it does run the risk of increasing latency depending upon how well the copy limit has been calculated for the network. The basic algorithm was altered to allow attacking vehicles to act as both black and grey holes. The modifications allowed the functional nodes to send messages to attacking nodes without being aware of the fact the recipients were malfunctioning. ```
start whileTruedo ifContactedNodethen ifBlackHolethen  Drop Messages elseifGreyHolethen ifDroppingMessagesthen  Drop Messages else ifNextnodedoesnothacemessagesthen ifCopiesavailableorNextnodeisdestinationthen  Forward messages end
```  
**Algorithm 2**Black and Grey Hole Binary Spray and Wait Router  
Every message that originates at a source node within the network is copied a set number of times. Once two nodes meet, they will transfer half of the available copies of each relevant message. This continues until a node only holds one copy of the message and then goes into the wait phase. The reason this adaptation was made is passing messages in this manner allows far a faster spread and therefore lower latency within the network. Once a message has reached the limit of copies, if the destination node for the message was not found during the previous phase, each of the nodes that has a replication of the message then uses direct transmission in order to deliver it to the required node. The wait phase vastly reduces the computational expenses, however it does run the risk of increasing latency depending upon how well the copy limit has been calculated for the network. The basic algorithm was altered to allow attacking vehicles to act as both black and grey holes.