# A Roadside and Cloud-Based Vehicular Communications Framework for the Provision of C-ITS Services
## 3 Roadside and Cloud Architecture
### Cloud Architecture
#### 3.2.1 Cloud MQTT Broker  
In safety-critical systems such as vehicular systems, the efficiency of information dissemination and reception is critical. The road manager must be able to inform the local vehicular networks of possible events as quickly as possible, and receive information from them, process it, and possibly retransmit it in an efficient manner. To do this, the road manager must have an effective way of managing the data transmitted across all of its RSUs. The communication protocol used for communications between the RSUs and the central C-ITS platform (operated by the road manager) must be chosen specifically accounting for several required features, namely,  
* Security: RSUs/central C-ITS platform must be able to authenticate themselves and privately transmit data (through encryption);
* Reliability: no transmitted messages should be lost in the connection between RSU/central C-ITS platform;
* Communication patterns: the road manager must be able to inform and receive information from multiple RSUs as efficiently as possible;
* Performance: the communication technology should be as efficient and lightweight as possible, given the embedded nature of the RSU hardware. Figure 4: CCAM application: visualization of an RSU transmitting CPMs (**left**); and the alert (DENM) generation panel for the user to disseminate warnings (**right**). A comparison between popular application layer communication protocols, namely HTTP, MQTT, CoAP, and AMQP, is presented in Table 1. Security-wise, all protocols except CoAP employ Transport Layer Security (TLS) as the encryption and authentication protocol. AMQP also provides the option of using Simple Authentication and Security Layer (SASL). CoAP, being based on UDP, employs instead Datagram TLS (DTLS). Reliability-wise, all protocols except CoAP work on top of the TCP, where CoAP uses UDP. Given TCP's native retransmission and required acknowledgments, this protocol ensures the reception of transmitted packets, whereas UDP does not provide such features. Patterns-wise, the publish/subscribe (PUB/SUB) model is preferable to a request/response (REQ/REP) approach since the former allows for one to transmit the same information to several nodes at once (e.g., transmit accident information to several RSUs at once). Both MQTT and AMQP support PUB/SUB, whereas HTTP and CoAP do not. Performance-wise, both MQTT and CoAP were developed for the Internet of Things (IoT) with an embedded hardware focus, while also possessing smaller overheads (header length) in the exchanged messages. Considering the mentioned features and the provided the comparison, MQTT was chosen as the communication protocol to be used. A persistent cloud MQTT broker implemented using the Mosquito library is used as a communication bridge between the RSUs (running an MQTT client) and the central C-ITS platform (MOBICS). ITS messages received by the RSU through ITS-G5 are forwarded to the central C-ITS platform through MQTT. ITS messages, such as the manually triggered DENMs and IVIMs, can also be injected into the ITS-G5 environment by specific RSUs chosen using an MQTT geographical-based topic system based on [9]. The topic used system has follows the structure described in Listing 1.  
its_center/[QT]/[MF]/[ID]/[MT]/[LoC]  
Here, QT is the message destination (inqueuefor messages published by the RSUs or outqueue for messages published by MOBICS), MT is the message encoding type (e.g., binary or Extensible Markup Language--XML), ID is the ITS-S identifier number, MT is the type of ITS message (e.g., CAM, DENM, or IVIM), and LOC is the current location of the RSU following a quadtree map system representation. In this representation, each Earth quadrant is represented by a digit from 0 to 3, where the quadrant 0 represents northwest, 1 represents northeast, 2 represents southwest, and 3 represents northwest. Each quadrant can be divided into four quadrants following the same logic, this being performed in succession until a desired zoom/resolution level is reached.