  In this paper, we describe the design and implementation of D2D communication
functionality for LTE. To our knowledge, this is the first such implementation
that is compliant with the LTE Release 12 standard. In this paper, we design
and demonstrate an experiment on mode selection between infrastructure mode and
D2D communication mode in LTE networks. We implement our system on a
software-defined radio SDR testbed, augmenting the open-source LTE eNodeB and
UE implementation provided by the srsLTE software suite. Our measurements
demonstrate the cell extension capabilities of D2D and quantify the SNR and
throughput obtained by a subscriber when directly served by the eNodeB and when
provided connectivity through the relay UE. Our implementation of sidelink,
relaying, and mode selection functionality enables experimentation and
prototyping of D2D communication that can assist in standardization, research,
and development.
