A reputation mechanism to support cooperation of IoT devices