133 protocol adds more features or functionalities. User applications usually deal with the top- most layers. In the context of protocol structure, we will frequently use the terms service and protocol. It must be noted that services and protocols are distinct concepts. A service is a set of primi- tives or operations that a layer provides to the layer(s) to which it is logically/physically connected. The service defines what operations a layer performs without specifying how the operations are implemented. It is further related to the interface between two adjacent layers. A protocol, in contrast, is a set of rules presiding over the format and interpretation of the information/messages that are exchanged by peer entities within a layer. The entities use protocols to implement their service definitions. Thus a protocol is related to the imple- mentation of a service. The protocols and functional elements defined by 3GPP standards correspond to all layers of the open system interconnection (OSI), that is, the seven-layer network reference model.6 62 As shown in Fig. 1.64, what 3GPP considers as layer-2 and layer-3 protocols is mapped to the OSI data link layer. The higher layer protocols in the 3GPP stack are the application and transport layers. The presentation and session layers are often abstracted in practice. The NG-RAN protocol structure is depicted in Fig. 1.65 for UEs and gNBs in the user plane and control plane. In the control plane, the NAS functional block is used for network attach- ment, authentication, setting up bearers, and mobility management. All NAS messages are ciphered and integrity protected by the AMF and the UE. There is also a mechanism for transparent transfer of NAS messages. As shown in Fig. 1.66, the layer-2 of NR is divided into MAC, RLC, PDCP, and SDAP sublayers. The SAP or the interface between two adja- cent protocol layers is marked with a circle at the interface between the sublayers in the fig- ure. The SAP between the physical layer and the MAC sublayer provides the transport