{'fraction_non_alphanumeric': 0.028462094626765654, 'fraction_numerical': 0.008111873313700248, 'mean_word_length': 5.415657879850662, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Device-to-Device Communications for 5G Internet of Things

The proliferation of heterogeneous devices connected through large-scale networks is a clear sign that the vision of the Internet of Things (IoT) is getting closer to becoming a reality. Many researchers and experts in the field share the opinion that the next-to-come fifth generation (5G) cellular systems will be a strong boost for the IoT deployment. Device-toDevice (D2D) appears as a key communication paradigm to support heterogeneous objects interconnection and to guarantee important benefits. In this paper, we thoroughly discuss the added-value features introduced by cellular/noncellular D2D communications and its potential in efficiently fulfilling IoT requirements in 5G networks. State-of-the-art solutions, enabling radio technologies, and current standardization activities for D2D communications are surveyed and their pros and cons with reference to manifold IoT use cases pointed out. Future research directions are then presented towards a fully converged 5G IoT ecosystem.


Introduction to the Internet of Things
The Internet of Things (IoT) holds the promise to improve our lives by introducing innovative services conceived for a wide range of application domains: from industrial automation to home appliances, from healthcare to consumer electronics, and many others facing several societal challenges in various everyday-life human contexts [1]. Currently we have 10 billion IoT devices connected and 24 billion to 50 billion total connections expected within the next five years [2]. The vision of a "smart world" where our everyday furniture, food containers, and paper documents accessing the Internet is not a mirage anymore [3]! The IoT growth is sustained by the constant increase in the number of devices able to monitor and process information from the physical world and by their decreasing costs. Most of them operate through their virtual representations within a digital overlay information system that is built over the physical world. The majority of current IoT solutions, indeed, requires Cloud services, leveraging on their virtually unlimited capabilities to effectively exploit the potential of massive tiny sensors and actuators towards a so-called Cloud of Things [4].
Despite all the conditions seem to be very favorable, still much remains to do before reaching well-working, reliable and efficient IoT ecosystem. In [5] the current situation of the IoT arena is compared to the "Wild West" of a couple of centuries ago with its vast, mostly unexplored territories, without clear borders, where all current technologies can play a role, and where ad hoc solutions are often the norm. For instance, the high heterogeneity of devices, technologies, and interaction modalities (machine-to-machine, machine-to-human, and machine-to-cloud) involved poses severe challenges concerning the communication process. In this view, a wide variety of low-power short-range wireless technologies, such as IEEE 802.15.4, Bluetooth Low Energy, IEEE 802.11ah, have been designed to provide efficient connectivity among IoT devices and to the Internet.
Recently, also long-range cellular networks are being considered as promising candidates to guarantee the desired internetworking of IoT devices, thanks to the offered benefits in terms of enhanced coverage, high data rate, low latency, low cost per bit, high spectrum efficiency, etc. [3]. In this context, the Third Generation Partnership Project (3GPP) has introduced novel features to support machine-type communications † (MTC) [6] by accounting for the intrinsic battery-constrained capabilities of IoT devices and the related traffic patterns (e.g., small data packets). At the same time, the efforts of academic, industrial and standardization bodies are pushing towards the fulfillment of IoT requirements through the next-to-come fifth generation (5G) wireless systems [7]. 5G will not only be a sheer evolution of the current network generations but, more significantly, a revolution in the information and communication technology field [8] with innovative network features [9]. Among these we can mention: (i) native support of MTC, according to which ad-hoc transmission procedures are defined to efficiently handle the cellular transmission of small packets by reducing latency and energy consumption; (ii) small-cell deployments, envisaging femto, pico and relay cells massively deployed to extend coverage and capacity and to reduce energy consumption; (iii) interoperability, i.e., seamless integration between 3GPP and non-3GPP access technologies to enhance reliability and coverage; (iv) optimized access/core segments, achieved through novel paradigms such as softwarisation and virtualization of network entities and functionalities, respectively. In this direction go the initiatives of GSM Association towards embedded-sim (esim) solutions [10], to overcome the classic concept of physical cellular sim, which could be a serious limitation for large-scale tiny IoT device (e.g., sensors). The e-sims will allow "over the air" provisioning of network connectivity and possibility to subscribe to multiple operators.
In the evolutionary scenario depicted so far, a new device-to-device (D2D) will play an undoubted key role in the IoT/5G integration [11]. D2D communications refers to the paradigm where devices communicate directly with each other without routing the data paths through a network infrastructure. In wireless scenarios this means bypassing the base station (BS) or access point (AP) and relaying on direct inter-device connections established over either cellular resources or alternative over Wi-Fi/Bluetooth technologies. This approach has recently gained momentum as a means to extend the coverage and overcome the limitations of conventional cellular systems. The main benefits it can introduce are [12]: (i) high data rate transmissions supported also by devices remotely located from the BS/AP; (ii) reliable communications also in case of network failure, as may be the case of disaster scenarios; (iii) energy saving since devices in close proximity can interact at a lower transmission power level; (iv) traffic offloading that reduces the overall † MTC is the name used by 3GPP for identifying the machineto-machine (M2M) communications within the LTE-Advanced (LTE-A) cellular environment [33]. number of cellular connections; (v) heterogeneous connectivity accounting that direct communications among devices does not only rely on cellular radio interface, but can be established through alternative radio technologies; (vi) instantaneous communications between a set of devices in the same way that walkie-talkies are used for emergency services.
Needless to say, these same features make D2D a very appealing solution to satisfy also the exacting requirements imposed by IoT in emerging 5G network scenarios (a possible IoT internetworking scenario is depicted in Figure 1). The numerous initiatives conducted by mobile and wireless communication leading enablers of the twentytwenty information society (such as METIS European project [13], 5G-PPP association [14], Networld2020 platform [15], etc.), confirm the role of D2D in various scenarios such as vehicle-to-vehicle communications, national security and public safety, cellular network offloading, or service advertisement. Nonetheless, when considering the possibility of D2D-based interconnection of IoT devices in cellular environment, severe challenges still need to be faced, such as efficient device discovery in heterogeneous environment, optimized link selection for highly dynamic multi-tenant networks, security issues, and so on [16].
The aim of this paper is precisely to discuss the benefits introduced by D2D technologies that may be suitably exploited within IoT ecosystems operating within future 5G systems. In detail, the expected contributions are: (i) highlighting the main features of D2D communications that may come in handy to fulfil the requirements of IoT; (ii) discussing the state of the art on D2D-enabled solutions and analysing possible enhancements to further boost the performance of D2D communications in IoT environments; (iii) introducing promising future trends and identifying relevant IoT research areas by assessing the role of D2D communications to accomplish the view of a fully integrated 5G IoT ecosystem.
The remainder of this paper is organized as follows. In Section 2 the D2D paradigm is briefly addresses by stressing the different implementation solutions and the current standardization activities. Section 3 illustrates the main requirements to comprehensively support IoT in future 5G scenarios. In Section 4 an extended analysis of how D2D may address the listed IoT requirements is provided, whereas Section 5 discusses open research areas for the evolution of D2D in the next-to-come 5G networks. Section 6 concludes the paper.

Device-to-Device Communication: Approaches, Enabling Technologies, and Standards
D2D communications aim to boost the performance of conventional cellular networks (in terms of metrics, such as power consumption, spectrum efficiency, throughput, etc.) by exploiting direct interaction between devices in proximity. Several solutions have been investigated in the literature, and different classifications have been provided.
A good taxonomy of D2D communications is given in [17], where a first distinction is made based on the spectrum adopted for D2D communications. This can be either cellular licensed spectrum, like for cellular communications (i.e., inband communication), or unlicensed bands such as Wi-Fi (i.e., outband communication). The inband solution, can be further classified in (i) underlay inband D2D mode [18] and (ii) overlay inband D2D mode. In the former, D2D and cellular communications share the same licensed cellular spectrum; in such a case, the main issue is the mitigation of the interference between D2D and cellular communications. In the latter, a portion of the cellular resources is dedicated to D2D communications for avoiding interference problems; in this case, the resource allocation becomes the key issue to address to avoid wasting precious spectrum resources. The outband solution aims to eliminate the interference between D2D and cellular link, but needs extra interfaces such as Wi-Fi Direct or Bluetooth. Therefore, it needs to coordinate the communication over two different radio spectrum ranges (e.g., when cellular and Wi-Fi Direct radio interfaces are involved). The coordination between radio interfaces is either controlled by the BS/AP, i.e., controlled mode, as illustrated in Figure 2 (a), or by the users, i.e., autonomous mode, as illustrated in Figure 2(b). Hence, the studies on outband D2D involve both aspects of power consumption and inter-technology architectural design [19] [20].

Radio Technologies for D2D Communications
From what said so far, any technology supporting the direct communication between devices can enable D2D communications. In the following, some details are given on those mainly considered to this purpose. In particular, notions about Wi-Fi Direct, Bluetooth, Radio Frequency Identification (RFID) and IEEE 802.15.4 are given, before going into the details of the cellular D2D technology (named LTE-Direct) and the 3GPP standardization achievement concerning D2D services. Table 1 summarizes the main features of the available technologies for D2D communications.

Wi-Fi Direct
Wi-Fi Direct [21] allows mobile devices (e.g., smartphones, tablets) to directly connect over unlicensed bands and transfer content or share applications anytime and anywhere. Although the idea of supporting direct links was already found in the original IEEE 802.11 standard through the ad-hoc mode, the lack of efficient power saving and enhanced QoS support has limited the market penetration of this functional mode [22]. Wi-Fi Alliance has recently certified Wi-Fi Direct to support peer-to-peer (P2P) communications between 802.11 devices by jointly exploiting the potentialities of ad-hoc and infrastructure modes. Wi-Fi Direct allows devices to implement the role of either a client or an access point (AP), and hence to take advantage of all the enhanced QoS, power saving, and security mechanisms typical of the infrastructure mode. Wi-Fi Direct devices can connect for a single exchange, or they can retain the memory of the connection and link together each time they are in proximity. Data communication is accomplished by creating a P2P group, where a device with a role of P2P group owner (P2P GO) can allow a cross-connection of devices belonging to its P2P group to an external network (e.g., a 3GPP network).  [23], which aims to increase the number of possible devices in the network and to lower energy consumption.

Bluetooth
Bluetooth, together with WiFi, is the most widely known D2D technology working at the 2.4GHz unlicensed band. Bluetooth intends to provide wireless connectivity in personal area networks. In order to enable short-range communications, one device becomes the master of the connection(s) serving up to seven slaves (clients) to form a piconet. Bluetooth Low Energy (BLE) has recently been standardized to meet constraints of IoT devices and opens up the doors for novel application scenarios, such as remote monitoring of BLE-enabled wearable sensors by exploiting smartphone connectivity [24].

NFC -RFID
The term RFID refers to a family of radio technologies whose main objective is to provide fast identification of objects through the interaction between transponders, also known as tags, and readers. The former answer with their identification codes when interrogated by the reader, which manages the overall data exchange process. Different classifications of RFID systems could be provided according to operating frequency, radio interface, communication range, tag autonomy (completely passive, semi-passive, active), and different standards have been ratified. For short-range communications, NFC technology [25] plays a prominent role for its wide adoption, as it is natively included in modern smartphones. In addition to interact with tags, it foresees a peer-to-peer mode by which devices can directly exchange any kind of data. On the other hand, UHF RFID systems are the most promising solution for long-range object identification and worldwide supply chain management. Evolution of smart UHF RFID tags with embedded sensors and miniaturization of readers promotes this technology for high pervasive IoT ecosystem [26].

Zigbee
Zigbee is a protocol stack tailored for resource constrained wireless sensor networks.

3GPP standardization for cellular D2D communications
The cellular D2D communications technology has been addressed in the Release 12 of 3GPP [27], and it is expected to have a complete standardization of proximity services in next 3GPP releases 13 and 14 [28]. 3GPP is focusing its efforts on D2D communications for public safety Proximity Services (ProSe). This strategy has been initially targeted to allow LTE becoming a competitive broadband communication technology for public safety networks used by first responders. In detail, the 3GPP Radio Access Network (RAN) working group has proposed in TR 36.843 Rel. 12 [29] two basic functions for supporting ProSe discovery and ProSe communications over the LTE radio interface. ProSe discovery allows a device using the LTE air interface (User Equipment -UE) to identify other UEs in proximity. Two kinds of ProSe discovery exist, namely restricted and open; the difference consists in whether the permission is necessary or not for the discovery for a UE. Instead, ProSe communication is the data communication between two UEs in proximity using the LTE air interface. Any UE supports ProSe Discovery and/or ProSe Communication is called as ProSe-enabled UE. 3GPP Services working group (SA1) has defined in specification TR 22.803 [30] the use cases and scenarios for ProSe. In the document, conditions for service flows and potential requirements for different use cases are analyzed to support D2D systems design. Examples of use cases for ProSe Discovery and ProSe Communication scenarios are defined by 3GPP SA1 in specification TR 22.803 [30].
The native support of D2D communications becomes crucial in 5G systems where the exponentially increasing data traffic exchanged over radio mobile systems requires novel communications paradigms. Research activities in this field are, therefore, numerous. A first example of D2D communications into the LTE-Advanced (LTE-A) network is provided by Qualcomm Company, which developed a mobile communication system called FlashLinq [31]. In particular, FlashLinq allows cellular devices automatically and continuously discovering thousands of other FlashLinq enabled devices within 1 kilometer and communicating peer-to-peer, at broadband speeds and without the need of intermediary infrastructures. Similarly, in [32] a first implementation for 3GPP LTE-Assisted Wi-Fi-Direct communication has been presented showing promising results.

IoT Requirements to be Supported by Forthcoming 5G Systems
In this Section we spot the main requirements and challenges to be met to exhaustively support IoT use cases in the next-to-come 5G cellular systems.

Energy efficiency
Energy handling during its harvesting, conservation, and consumption phases is one of the major issues characterizing IoT ecosystems and that claims for the design of novel energy efficient solutions [5]. Achieving high energy efficiency in communications is crucial to IoT devices, typically relying on either small batteries or on harvesting technologies. This is even more important to application scenarios involving remote areas, which are difficult to reach and make it hard or almost impossible to recharge or replace the objects power suppl. A noticeable contribution to energy consumption reduction may derive from the adoption of direct communication between IoT devices. A plethora of short-range standardized wireless technologies are already adopted to guarantee local connectivity among the IoT devices, while wireless gateways typically provide remote connectivity to the Internet. Recently, also wide area wireless technology with enhanced coverage capability, such as the modern LTE-A cellular networks, are being considered as enablers of the IoT. In this regards, energy-efficient networking solutions are being introduced, to account for the stringent battery constraints of sensors and actuators. These tend to exploit local communication to reduce transmission power consumption and/or data aggregation to lower the amount of data exchanged.

Scalability
The huge number of smart devices, willing to connect to the forthcoming IoT world, draws the researchers' attention on issues that may result challenging for current network infrastructures. Existing wireless networks could especially suffer from dynamic crowded IoT scenarios, where massive machine-type communications (MTC) need to be handled while also guaranteeing the requested quality of service. This aspect is particularly evident in cellular networks, where human-oriented and MTC shall be accommodated in the same infrastructure. Despite the recent efforts by 3GPP to efficiently support MTC in LTE-A, several challenges remain to be faced in the view of full 5G based IoT systems [33]. These include, among others, avoiding congestion in connection access, providing a high system capacity, guaranteeing efficient radio resource allocations and efficiently handling small size data communications.

Resiliency
The intrinsic dynamic nature of wireless IoT ecosystems requires guarantees of system continuity also in harsh conditions, including lack of the network infrastructure connectivity. Apart from the efforts made to provide a capillary network coverage (thanks to multi-tier cellular architectures), an unexpected lack of infrastructure support is highly likely in case of congestion due to crowded events, failures of network node, bad wireless link conditions, and disastrous events. These situations should not prevent the correct functional behavior of IoT solutions, typically relying on interoperation and cooperation among devices and often deployed in critical scenarios (eHealth, e-energy management, transportation systems, smart farms, etc.). In fact, a connection failure could cause tremendous consequences for critical usecases, such as safety road data dissemination, health alarm systems, and automated industrial processes. Also, realtime interactive application, e.g., multimedia IoT, could undergo a significant reduction of user quality of experience. Therefore, advanced and reliable IoT systems shall foresee a high-level network recovery capacity, quickly identify connectivity failures, and automatically establish alternative communication paths.

Interoperability
The IoT is populated by highly heterogeneous objects, each one providing specific functions accessible through its own dialect and network. Thus, one of the key requirements is to manage this intrinsic heterogeneity, i.e., to provide efficient solutions for the seamless integration of different types of devices, technologies, and services. On the communication side, IoT heterogeneity should account for the plethora of radio technologies involved in the support of low-power devices. An emerging trend is promoting cellular communication for IoT devices in the view of an all-inclusive 5G framework. However, to support the extremely differentiated IoT application scenarios, next generation cellular networks need of effective mechanism to handle heterogeneous data handling capabilities, flexibility in managing different radio technologies, integrated mobility management, etc.
Also from the application point of view, common interfaces to access services offered by IoT mobile devices are required. This requires appropriate virtualization techniques to abstract from the underlying networking protocol and to provide syntactic and semantic interoperability [34]. This attracts the attention from research and industrial communities on the "virtual" counterparts of physical objects. As a consequence, manifold IoT Cloud platforms have been designed to support large-scale applications which rely on heterogeneous sensor infrastructures. Still much efforts are required to reduce latency in the interaction between physical devices and their digital counterparts, to provide distributed virtualization functions, and to reduce network traffic generated by IoT devices by means of an efficient composition of their services.

Group communications
In IoT pervasive environments, data provided by a single object may not be reliable or useful enough to support specific applications and the desired Quality-of-Information. At the same time, automated IoT systems may have advantages in triggering simultaneous actions on multiple devices (such as, for example, street light lamps) in a smart city. The relevance of group communication in IoT is also testified to by the interest in this issue by the IETF Core working Group, involved in the standardization of an IPv6-based application protocol for resource-constrained devices [35].
Group communications can be provided by multicast and unicast-oriented approaches. The former case is the most challenging, as the network natively needs to support simultaneous packet delivery to a group of receivers. This allows to reduce network traffic and to enhance the efficient resource usage. However, multicast communication has some drawbacks: it does not provide reliable service in IP network and the group formation my result complex, especially in dynamic heterogeneous IoT scenarios. Thus, ad-hoc proxy must be exploited to forward data from/to a group of IoT devices by multiple unicast communications and to provide dynamic group management [36]. 5G systems shall provide efficient support for group IoT communication, by optionally leveraging on proximity communications to reduce energy consumption and traffic congestion.

Cloud-based IoT service environment
A further key challenge is the support of a dynamic execution environment for complex IoT applications. Ondemand processing and storage resources, provided by Cloud data centers, represent a fertile underground to develop and deploy scalable IoT platforms for: (i) virtualization of IoT devices; (ii) offloading of computationally intensive applications, such as complex sensor event processing, face recognition, video transcoding, etc.; (iii) addressing the so-called Big Data challenge, i.e., storage and analysis of the huge amount of data generated by IoT devices. However, Cloud-assisted solutions could suffer from high delays in interacting with remote data centers, and cause a remarkable increase of data traffic. To overcome these issues, the concept of Cloudlet [37] for vehicular networking and Fog computing [38] for the IoT have been introduced to define a distributed infrastructure of edge micro data centers, which offer Cloud services closer to the end-users. Thus, the role of network providers is evolving from straightforward flow traffic manager to a ubiquitous service enabler, which exploits its pervasive infrastructure to offer integrated service-network solutions. To this aim, the network provider becomes highly interested to exploit novel form of communications, which accommodate IoT devices' requirements in terms of delay and energy saving. In addition, to assure network interoperability, appropriate solutions shall be designed to allow also noncellular IoT devices, such as sensors and RFID tags, to interact with the distributed Fog architecture. For instance, this can be done by relying on multi-interface devices, such as smartphones, which act as access points to the envisaged platform. Relay-based approaches should also preferably provide in-network processing for data transformation and aggregation, to enable more efficient resource allocation.

Support to Multimedia IoT
To deploy a comprehensive IoT framework, also smart multimedia devices shall be properly included to sustain multimedia services. Sample use-cases include ambient assisted living and patient monitoring based on telemedicine, integrated monitoring systems of smart homes, advanced multimedia surveillance of smart cities involving real-time sensor data acquisition. Besides, the so-called "Internet of Multimedia Things" [39] introduces features and network requirements that are different from those of the typical resource-constrained IoT landscape. Multimedia things foresee higher computation capabilities to manage multimedia flows and, above all, communications are more focused on bandwidth, jitter, and loss rate to guarantee acceptable delivery of multimedia contents. Low-power radio technologies are not well suited to support these types of traffic, whereas cellular networks provide better performance for multimedia flows. However, accounting for the additional traffic generated by multimedia things, 5G shall include novel efficient techniques to meet both machine and human requirements, e.g., by leveraging on edge content caching and proximity content distribution.

D2D Features as Enabling Factors for the future 5G Internet of Things
This section will browse through the main features of D2D communications with the potential to meet the IoT requirements discussed in the previous Sections. In particular, we will discuss key research contributions and highlight what has been done so far and what still remain to do for allowing IoT to take advantage of 5G system features. Indeed, proximity communications enabled by D2D communications represent a fertile ground for use cases where devices detect their vicinity and subsequently trigger different services, such as social interactions and gaming, advertisements, local information exchange, etc. (Figure 3). By means of D2D discovery and communication functions, for instance, a user can find other near users to share data (multimedia content, environmental sensing, traffic condition, etc.), play interactive games, and so on. In applications for public safety support and emergency handling, devices can provide at least local connectivity in case of damage to the network infrastructure. Similarly, D2D communications may contribute to solve problems in emerging wireless communication scenarios, such as vehicle-to-vehicle (V2V) communication in Intelligent Traffic Systems (ITS) for traffic control/safety applications, or indirect indoor localization.
High data rate/Low delay Short-range communications are typically characterized by higher throughput, lower delay and energy consumption when compared to long-range communications (clearly, this also depends on the D2D technology being adopted -see Table I in Section 2 -and on the scenario considered). The cited features are attractive for several application scenarios involving the support of multimedia traffic over future IoT systems. In particular, the authors of [40] consider base station controlled D2D communications to transmit cached video files in modern smartphones to other users through multiple D2D links over the same time/frequency resources within one cell. This leads to a huge increase in the spectral efficiency. Similarly, the higher data rate over D2D links is used for multimedia content dissemination in [41] [42], and for social-aware video multicasting in [43]. The possibility to cluster devices into groups connected through D2D links has also been widely investigated. Examples of applications exploiting D2D-based grouping are content sharing & dissemination (e.g., multicasting) [44] [45] [46] [47].
All the cited examples confirm that D2D can help, not only to meet the group communication requirements of multimedia IoT devices. It also allows to overcome typical scalability and heterogeneity issues of IoT. In fact, clustering the devices in a network may ease the handling of the expected large number of IoT devices with different capabilities and available communication technologies.
Low energy consumption communication D2D communications guarantees a lower energy consumption [48] w.r.t. to classic transmission modalities, where devices communicate to the BS/AP. This feature makes D2D communications very attractive in the view of meeting the energy efficiency requirements of the IoT [49]. The lower energy consumption is a direct consequence of the lower transmission power necessary over short-range connections with neighboring devices. Furthermore, the channel quality achievable on shortrange links is better than that on long-range links [50]. This implies that the active time for the device in data transmission and reception can be severely reduced, with a consequent energy consumption reduction, highly valuable to typical IoT things.
The idea of adopting short-range links for energy consumption reduction is not novel per-se, as several contributions in the literature investigate on this aspect. A very recent survey of cooperative content delivery techniques based on multiple wireless interfaces available on mobile devices has been presented in [51]. In particular, wireless cooperative networking, guaranteeing performance enhancements to handheld devices, is a well investigated research field. More specifically, cooperative content sharing have been in focus thanks to its easy implementation by modern multi-interface mobile devices and the many applications that can derive from it. According to this paradigm, users share portions of data of common interest downloaded over costly long-range cellular links while exchanging the downloaded portions over short-range radio links. Significant research activity has been conducted to design strategies that simultaneously exploit the multiple radio interfaces of modern wireless devices and maximize the gains. As an example, the beneficial effects of integrating cellular and Wi-Fi networks are shown in [52] and [53]. The rewards of cooperation in terms of energy consumption and transfer delay are demonstrated also for cellular-Bluetooth scenarios [54]. Several other contributions investigated on the energy savings introduced by the synergistic use of multiple wireless network interfaces either located within the same device, or associated to several devices. At the same time, the short-range communication capability of modern wireless devices over unlicensed frequencies fostered the proliferation of a significant number of decentralized, spontaneous, and ubiquitous user interactions for content exchange.
When specifically considering the IoT scenarios, further constraints influencing the energy efficiency requirements shall be considered because exchanged data may vary greatly in size down to very small amounts in several scenarios. However, experiences made over the past years may be used to exploit at the best the assessed energy savings potentialities in the field of D2D communications.

Aggregation
In IoT environments, most of the interactions are expected to take place locally, i.e., between physically co-located devices [5]. Where needed, end-to-end interactions can be addressed by smart ways of aggregation, where small data from several objects (close to each other, either with similar traffic patterns or belonging to the same IoT application) are collected by a terminal, namely the aggregator, which then forwards the aggregated data to the final destination. In these cases, the D2D paradigm is natively appropriated to support aggregation of data from neighboring nodes. An example of D2D aggregation in 5G environment is depicted in Figure 4, which shows the differences and the introduced benefits compared to legacy uplink data transmission.
Aggregation of industrial IoT (M2M) traffic is considered in [55], where D2D links are exploited to mitigate the capacity limitations of traditional large-scale transmissions (i.e., limited radio resources shared among a large set of users). Aiming at properly managing the D2D transmissions by a potentially large group of devices, the work defines a D2D-based access procedure: devices contend for access through an access reservation mechanism that allocates the slots of time for data transmission toward the aggregator. Following the packet aggregation over D2D links, the aggregator adds its own data and performs a transmission to the BS by adapting to the channel conditions the power, the transmission rate, and the actual amount of data to send.  Moreover, novel solutions are needed to enable the efficient use of radio resources to convey small data packets in cellular environment (i.e., LTE/LTE-A), which are designed for supporting high data rates and big data sizes. As shown in [56], it is possible to improve the communication and the energy efficiency for small data transmission by using more robust Modulation and Coding Schemes (MCS) in the uplink, thus reducing data rate and lowering the transmission power. This simple approach guarantees better energy efficiency w.r.t. classic cellular-mode uplink transmissions. Building on this concept and on the possibility to aggregate data, D2D communication techniques may introduce further power savings. As proposed in [57], by smartly adapting the MCS of the aggregator node, radio resource utilization could be maximized depending on the total amount of data to send upon aggregation. If properly designed, this approach will allow low power transmissions both in intra-cluster communications over IoT D2D links, and in the uplink transmissions from the aggregator; thus reducing the overall energy consumption of the IoT devices.
The benefits introduced by D2D-based aggregation solutions motivate further work on this field. Possible trends are the definition of multi-criteria algorithms tailored to properly select the most suitable IoT device to act as aggregator. Further benefits are also expected by the design of enhanced D2D procedures aiming at boosting the performance (e.g., reducing the latency and the energy consumption) during the phase of data collection.

Coverage extension
The possibility to exploit local D2D communications among devices supports coverage extension that may allow to reach nodes otherwise out of coverage of a cellular communication [58]. The idea of enabling D2D communications as a means for performing relaying in cellular networks was already addressed in ad hoc networks, e.g. in [59]. Nevertheless, the concept of allowing local D2D communications to (re)use cellular spectrum resources simultaneously with ongoing cellular traffic is relatively new [60] and coverage extension may be enhanced by relay-assisted multi-hop communications [61] [62]. In particular, network assisted two-hop D2D communications enhances the coverage and the energy efficiency of cellular networks and can be useful in providing national security and public safety services [63] [64] [65]. In a recent paper also multi-cell cellular systems have been modeled where UEs assist cell-edge users for relaying, and different approaches (amplify-andforward and decode and-forward with either digital or analogue network coding) are compared to optimize the system performance [66]. Although the focus so far has been mainly on downlink services; uplink direction scenarios are of undoubted interest as witnessed by recent publications, such as [67], where relaying by smartphones is proposed to send out emergency messages from disconnected areas.
The mentioned researches are an undoubted good starting point to conceive and design mechanisms able to meet the scalability and resiliency requirements typical of IoT in future 5G scenarios. The simultaneous presence of highly mobile and stationary devices in the IoT may be particularly challenging. Mobile devices may get disconnected from the network as they move, which may lead to intermittent connectivity, thus causing unpredictable network topology changes that may benefit from D2D assistance from devices, as proposed for instance in [68].

Multicast/Group communication
Researchers are currently active in the definition of multicast communications over D2D links in a similar way as it is known for classic cellular downlink transmissions.
In particular, for D2D-based communications, direct multicast transmissions where the same packets from a UE are sent to multiple receivers are important in scenarios such as Local file transfer/video streaming (e.g., advertising messages), Device discovery, Cluster head selection/coordination (e.g., reaching out of coverage devices), Group/broadcast communications (e.g., for safety networks) [69]. Multicast transmission will support the deployment of IoT ecosystems and help in overcoming issues of scalability, energy efficiency, and efficient support of IoT group communications.
To efficiently support user diversity and serving more (or all) receivers in each multicast cluster, either retransmissions are required or more robust modulation and coding schemes should be used. Moreover, having a UE instead of the BS performing multicast, introduces additional challenges due to limited capabilities of the UE. This issue is partially alleviated in cellular environments, where the UEs are assisted by the BS. Solutions for network-assisted multicast D2D communications have been proposed in research papers like [70] [71] and patenting activities [72]. These have paved the way to the future required activities specifically targeted to design similar methods performing well in IoT environments.

D2D for Multi-RAT Heterogeneous Networks
Future IoT environments will foresee the presence of wireless networked devices employing multiple radio access technologies (RAT) to perform device-to infrastructure and device-to-device communications; this will lead to heterogeneous multi-radio architectures. In this regard, a key aspect to investigate is how to deliver uniform connectivity and service experience in future 5G technologies. As an example, [73] investigate on the way a distributed unlicensed-band network (e.g., WiFi) takes advantage of the centralized control function residing in the cellular network (e.g., 3GPP LTE). In such an heterogeneous scenario, D2D communications may contribute to the proper management of devices. For instance, in [74] D2D communications allow to improve the performance of a converged network. In particular, a resource allocation scheme is proposed to perform mode selection and allocate resources in the involved networks, i.e., LTE-A cellular network and IEEE 802.11n WLANs.
A further example, more closely related to the IoT environment, is presented in [75], where the authors explore the opportunity of supporting low-rate low-power IoT traffic through D2D links with human-related devices (i.e., smartphones). In the proposed scheme, a multiple access channel for IoT devices is created by relying on underlying D2D transmissions from IoT terminals to a smartphone, which acts as a gateway for the IoT nodes.
The key observation is that the low rate and the low power of the IoT traffic may allow the gateway to successfully decode the downlink transmissions from the BS to other devices, cancel them, and then attempt to decode the signal sent by IoT terminals via D2D links. In this scenario, heterogeneity is granted by the BS, which being aware about the presence of D2D links, can therefore adjust the power/rate of its transmissions to improve the IoT traffic reliability and to guarantee the simultaneous transmission of heterogeneous IoT/non-IoT traffic.
The IoT ecosystem can benefit from the use of D2D also in scenarios with multi-interface devices. In this case, the availability of different access technologies introduces the opportunity of properly selecting the best connection link. An example in [57] considers the pros and cons of D2D via LTE-Direct and WiFi-Direct by assuming different application requirements and network load conditions. This study outlines that LTE-Direct D2D technology is able to provide the most energy-efficient communication scheme when the number of user is relatively high (i.e., better scalability). However, WiFi-Direct outperforms LTE-Direct in terms of energy efficiency in case of small amount of data. The results shown in [57] motivate the definition of algorithms that, according to IoT traffic patterns (e.g., packet size), network conditions (e.g., device load) and device capabilities (e.g., level of residual battery charge), properly select the most suitable D2D technology to guarantee traffic/network optimization in heterogeneous IoT scenarios.

Higher cellular system capacity
The use of D2D communications has an overall positive impact also on the system capacity in cellular environments. The motivations behind this are mainly related to two factors: data offloading and reuse gain. Several studies in the literature investigated the positive impact of mobile data offloading [76] [77], that reduces the amount of data being carried over the cellular bands and, consequently, frees bandwidth for other users. However, the possibility to adopt underlay frequencies allows for data offloading solutions also on cellular radio resources [78] [60]. As for the reuse gain, the capacity of cellular networks is known to be strongly limited by interference at the receiver from communications ongoing on the same frequencies. Advanced methods for management of the interference between local D2D communications and with the BS (e.g., [58]), resource allocation in the cell (e.g., [79]) and mode selection techniques (e.g., [50]), have fostered frequency reuse techniques that tremendously increase the spectral efficiency and consequently the network capacity. Considering the future IoT applications, higher capacity systems will play in favor of scalable environments able to support also high capacity demanding multimedia services in densely deployed IoT scenarios.

Concluding remarks
To summarize the analysis reported in this Section, in Figure 5 the mapping between IoT requirements and features of D2D communication for 5G is reported. A visual idea is reported on the contribution that D2D communications can give to meet the expected requirements of IoT in 5G systems.

Rethinking D2D for IoT in 5G Systems: Towards a Device-oriented Anything-asa-Service Ecosystem
In the last years, the capabilities of mobile devices are constantly improving in terms of computation, storage, and networking capabilities. This has recently pushed research towards innovative networking paradigms that exploit the potentialities of the single devices. Among these, local edge-clouds [80] are proposed as a means to cooperatively share computing, storage and network capabilities among devices in close proximity. In this view, D2D communications may play a fundamental role to enable efficient exchange of data and services among mobile devices without necessarily relying on a cellular network. Besides, smart devices can provide virtualization of IoT objects. This would allow to include also resource constrained wearable sensors and their relevant functionalities in the local mobile clouds [81]. Nonetheless, infrastructure-less mobile cloud computing solutions present various obstacles towards an effective deployment, such as complex distributed management, weak authentication, and others. The network provider is expected to still play a key role by offering appropriate orchestration functionalities in a new networking landscape where the border between infrastructure and devices becomes even more blurred. Related to this, the METIS project has proposed a new concept of radio access network, the so-called RAN 2.0, where end-user devices can be in charge of network infrastructure nodes to provide seamless connectivity [82]. However, supporting ubiquitous networking only represents the first step towards a complete integration of the IoT into nextgeneration cellular systems. By leveraging on virtualization, telco providers can indeed integrate heterogeneous systems into a unified service environment, which facilitates the development and execution of highly integrated and distributed IoT applications. According to this vision, 5G should not be considered as a straightforward evolution of the current 4G network, but as a novel framework to enable the socalled "Anything-as-a-Service" paradigm [83], where also end-user devices can be directly exploited to provide "any type of service". This solution allows to go beyond the concepts of Cloudlet and Fog architectures. Telco providers (i), on the one hand, are relieved of the financial costs related to the deployment of a large number of micro data centers (e.g., femtoclouds [84]) located very close to the customers, and, (ii) on the other hand, are evolving into ubiquitous service providers, by maintaining control, authentication and coordination functions, whereas delegating task execution to end-user devices. According to their capabilities, IoT objects will offer manifold services, ranging from computation to storage, from sensing and actuation to networking where D2D communication will be the core technology to provide the requested flexible interactions among end-user devices.
To enable the envisaged framework, great efforts are required in the next future to enhance the current networkoriented 3GPP ProSe by integrating functionalities for application service delivery. In this direction, softwarization and virtualization may come in handy to realize the view where devices, by acting as small-cells, become "active" units of 3GPP networks. In particular, ProSe discovery could be enriched to provide registration of both services offered by devices, and application requests of end-users, which will operate as prosumers of data and services. Furthermore, this novel paradigm opens up several research areas which will be detailed below and that should be in focus for future activities.

Joint service-network optimization
Also for delay-constrained IoT applications (e.g., industry-chain management), one of the key challenges is to guarantee the desired Quality of Service (QoS). Dynamic resource allocation schemes shall be designed to jointly consider service deployment and network status to the purpose of achieving adequate levels of user experience. Emerging paradigms, such as SDN (Software Defined Networking) and NFV (Network Function Virtualization), are considered as key enablers of 5G system to introduce flexibility in network and service functionalities. These support D2D communications as recently shown in [85], [86], [87]. However, the process of integration is still in its infancy. The evolution of D2D communications in 5G systems moves away from the current view of providing just bit pipes. In the forthcoming 5G systems, ProSe are expected to offer ondemand advanced services, such as protocol conversion, in-network processing, semantic data transformation, thus guaranteeing high degree of network and application interoperability.
Efficient IoT service proximity discovery Efficient procedures to minimize the cost of peer discovery in terms of energy and traffic exchange are highly recommended for battery-enabled IoT devices.
When accounting for their sensing, actuation, and data processing capabilities, appropriate abstraction layers shall be implemented to provide common understanding between interacting devices. The establishment of D2D communications should also guarantee the most suitable matching between user requests and available device capabilities, while considering wireless channel conditions and network load. Besides, to improve resource reusability in IoT scenarios [88], traffic routes could be properly selected for sharing common service links among multi-hop D2D paths. Another approach to enhance the IoT navigability is proposed in [89] where, based on social networking concepts integrated into the IoT, links are selected to exploit overall network navigability.

Incentives for user participation
Classic cellular-based transmissions require a user subscription to the wireless network provider, whereas D2D communications are typically based on spontaneous cooperation between end-users where either reciprocal benefits are obtained or support is offered as a form of altruism. In this latter case, when users are actually rational in the sense that they pursue their own payoff, novel incentive mechanisms are a basic requirement for realistic implementations of any D2D-based solution. As an example, rational users may be willing to provide their personal device resources only if sufficiently rewarded for the additional power consumption this may require. These incentives may come in different forms according to the considered scenarios and the devices/users being involved. For instance, besides the intrinsic networking benefits introduced by D2D (e.g., energy savings, lower delay, higher capacity), also economic incentives and social-based incentives may be considered [90]. In the futuristic vision where users' devices expose further capabilities, such as computation, storage, and sensing, in the Anything-as-a-Service paradigm, the above discussed challenge becomes even more arduous and critical for a successful implementation. Thus, network and service providers, as well as application developers, should design well-defined incentive schemes to stimulate user cooperation [91].

Service provisioning with multiple operators and networks
The support of D2D and proximity services may require new complex modalities of interaction between different network and service providers. Users with subscriptions to different cellular operators should be allowed to reciprocally authenticate and cooperate. Furthermore, in absence of services provided by other intra-operator subscribers, a user can receive the requested services from subscribers of different operators, similarly to the case of roaming for network connectivity. Further challenges are linked to the extremely heterogeneous IoT ecosystem, composed of a large set of different scenarios, such as those where D2D and non-D2D devices coexist in the same coverage area. A further issue, pushed by the heterogeneity in the requirements of IoT over 5G systems, is the dependence on cellular networks. This introduces additional challenges to integrate devices such as RFID tags and sensors that are part of the IoT. This is of high relevance in the IoT vision, where devices differ as a result of their diverse functionality and offered service and have the ability to interconnect and communicate anytime in a collaborative manner with any other device. Moreover, D2D communications within the IoT ecosystem involves devices that belong to network domains with different characteristics.
To give an answer to the mentioned challenges, some architectural solutions that can be envisaged are: (i) relying on a centralized third-entity node, e.g., a broker, which mediates cooperation among multiple operators and networks; (ii) promoting direct interactions between the interested operators in a distributed way; and (iii) defining inter-operator control information exchange via the device, which shall be temporary registered to the foreign operator as long as the user needs the service.
Mobility support D2D-based interaction is unpredictable by nature because the chances that the users meet each other and, as a consequence, establish a D2D connection are strongly influenced by their mobility patterns. This results in highly opportunistic contacts due to potential mobility of all involved user devices. Therefore, on the way to integrate the native support of D2D communication into the 5G system architecture, the effects of user mobility have to be thoroughly characterized as they may have a profound impact on the resulting system performance. Mobility-related parameters determine the individual D2D link performance (length, duration, throughput, etc.) and the overall D2D system performance. The resulting performance depend also on other factors, including the type of application running on top of the D2D links. Although supporting communication in dynamic scenarios is essential for seamless service provisioning, still a few works in the literature address the issues of mobile D2D communications. As an example, the impact of mobility and network assistance (i.e. allowing the network to relay the multicast signals) has been studied in [69] where solutions on how to optimize multicasting by choosing the optimal multicast rate and the optimal number of retransmission times are proposed. Noteworthy, in heterogeneous IoT scenarios, a service orchestrator can more efficiently distribute tasks among devices accounting for both the required time of task processing and estimated contact time interval between users, based on their mobility prediction [92] as the effects of mobility may be very different for alternative user movement patterns.

Privacy and security issues
Another key issue, which could lag the large-scale adoption of D2D communications for proximity-based services, is the risk for privacy and security attacks. These aspects are also of utmost importance for IoT applications, e.g., in scenarios where wearable devices interact with external entities to transfer personal health information. Similarly, in industrial automation systems, which rely on remote actuation control to trigger real-time operations, this is of high interest. As also discussed in [93], multi-hop D2D communication introduce potential security risks when not trusted relays are used to forward/aggregate data from multiple devices. Thus, novel reputation-based mechanism shall be included to identify and avoid malicious users. A viable solution may be to exploit social network relationships among users and device themselves [94] to provide a trustworthy D2D system [95].

Conclusions
In this paper, the potentialities of D2D communications for the Internet of Things are investigated. A broad overview of ongoing research and standardization activities for D2D communications technology in future generation systems is given. Particular attention has been devoted to possible use cases and benefits this technology may introduce to meet the manifold key requirements and open issues in the IoT. Finally, a look into the novel and futuristic visions of the IoT is reported. This highlighted the manifold challenges ahead of us and research directions that need further investigation to realize the full convergence of IoT in next-to-come 5G systems, where a device-oriented Anything-as-a-Service ecosystem is expected to be the reality.