Adding a device name to an ESP8266 shield

Does anyone know if this is possible and how to do it?

I.E. So that when you view the device in the ADSL modem home network you can see you named device rather than just a MAC address.

#include <ESP8266WiFi.h>

extern "C" {
#include "user_interface.h"
}

char hostname[] = "Alarm";

WiFiServer server(80);

void setup() {
  wifi_station_set_hostname(hostname);
}

void loop() {
}