## 3 Platform for Real-Life Testing of Communication Protocols
### Monitor Messaging
#### 3.3.4 The PROTO-Based Messaging Method  
The Protocol Buffer [50] is a tool used to work with structured data. It defines the structure (schema) in a language-neutral form that needs to be compiled to obtain the structure in the language the application is built in, like C++. This additional step is required before the application can be compiled. However, because it integrates well with CMake, using it in a GNU radio OOT (Out Of Tree) [52] build pipeline is relatively easy. All PROTO messages have a fixed part that contains the timestamp, payload, payload ID, and probe-related information. The fixed part of the message is defined as a separate PROTO message and referred to as the main one. Each payload is defined as an independent PROTO message aggregated into the main PROTO message through a proto::any field. This allows for a single definition for the main PROTO message. Figure 13 illustrates the implementation of the PROTO messaging. The PROTO messaging system is implemented in C++ to allow integration in the GNU radio application at a lower level. It uses a message template that is specialized for each payload message, along with the payload ID used by the message receiver to choose the parser. The protocol ID was used instead of proto::any's type_url field because it needed to be known at the compile time and used as a template parameter. The type_url field is a string. The Message Registry variadic template is specialized with all messages as a parameter pack and registers the parse methods in the parser dictionary. The messaging system is built as a shared library used by both the GNU radio application under test and the messaging broker. Figure 12: Building a PMT monitoring message. To maintain a consistent message-building API similar to the baseline method and to enable dynamic referencing of message fields by their names at runtime, it was necessary to create a dictionary that maps field objects to their respective names. When the message builder was constructed, the protocol buffer reflection feature was used to build this dictionary, resulting in an API similar to the PMT-only method. Figure 14 provides an example of how to make a PROTO message. Since the payload information is now carried by a PROTO message, it is necessary to use the payload ID field to tell the broker which parser to use. The PROTO-BLOB method does not use the optional probe-related fields in the main PROTO message and only sets the timestamp, payload, and payload ID when the message is generated. After that, the PROTO message is serialized and passed to the probe as a pmt:blob. The probe creates a PMT cons list containing the queue size, the sender counter, and the blob message received. After that, it serializes the new message and sends it to the transport channel. Using a cons list allows you to add fields of different types without having field names (like tuples). It adds a bit of overhead when the structure is traversed for serialization and deserialization. Still, the overhead is negligible since the number of elements in the counter list is small (three elements). With the PROTO-ANY method, the PROTO messages between GNU radio blocks are carried as pmt:any, and the method casts the main PROTO message at the probe. In this way, it is possible to use the optional probe-related fields of the main PROTO message. Once these fields are set, the PROTO message is serialized and sent over the transport channel. Because the PROTO message is not encapsulated in a PMT message, it is necessary to signal to the parser that it was not serialized with PMT. For this, it exploits the tagging mechanism that PMT uses to indicate the field type and adds a custom tag that PMT does not use. In this way, all three methods are consistent, with the first byte indicating the type of the outermost element of  
Figure 14: Building a PROTO monitoring message using an API like that of the PMT method. Figure 13: UML diagram of the PROTO messaging. the message.