Exploiting D2D Communications at the Network Edge for Mission-Critical IoT Applications