smartglass-documentation

SmartGlass Protocol

Basic communication

The SmartGlass protocol communicates over UDP port 5050. Only the discovery and power on messages are transmitted in plain text, the rest is encrypted (see Cryptography).

Nano protocol uses dynamic ports (UDP/TCP), negotioated via SmartGlass protocol’s broadcast channel.

Client connection

  1. Console might be powered on by Power On packet
  2. Client sends Discovery Request to console
  3. Console responds with Discovery Response
  4. Client parses Certificate in that response
  5. Client sets up a Crypto Context using the console’s public key
  6. Client sends a Connect Request to the console
  7. Console responds with Connect Response
  8. Client sends a Local Join Message, announcing itself
  9. Upon Acknowledgement client opens several Channels
  10. Received / sent Heartbeat packets ensure that client/host is alive

Packet layout

General packet layout looks like the following:

Name Note
Packet Header Either SimpleMessage or Message
Unprotected Payload For all SimpleMessage packets
Protected Payload For Connect or Message packet
*Hash Only if packet has Protected Payload, see Message Authentication

NOTE: All numeric values in the SmartGlass Protocol are in network / big-endian byteorder.

Strings in SmartGlass packets

Usually strings are represented like the following:

Type Description
uint16 String length (excl. null-terminator)
uchar * length String
uchar ‘\0’ Null-terminator

In this documentation, these strings are referenced as SGString