Automatic Service Discovery

Automatic Service Discovery feature enables possibility to discover VSMs in case UgCS server and VSM is using dynamic addresses. Used SSDP protocol (https://tools.ietf.org/html/draft-cai-ssdp-v1-03) as basis and actual data from packet captures when Windows and iOS searches for various stuff on my LAN.

Protocol Description

There are three messages invloved. They are HTTP messages without body, formatted according to HTTP specs, rfc7230.

  1. Search. Issued by locator (UgCS server, in our case) on all interfaces using multicast address 239.198.46.46 to locate the requested service by type (ST). For example:

    M-SEARCH * HTTP/1.1
    Host: 239.198.46.46:1900
    Man: "ssdp:discover"
    ST: ugcs:vsm:ardupilot
    MX: 3
    
  2. Response to search. Sent by service as a response to M-SEARCH. Unicast. Contains service type (ST), unique service name (USN) and location (Location). For example:

    HTTP/1.1 200 OK
    ST: ugcs:vsm:ardupilot
    USN: Ardupilot VSM
    Location: 192.168.1.33:5556
    ID: 12345678
    
  3. Notification. Sent by service when it becomes available. Multicast. Contains service type (NT), unique service name (USN) and location (Location). For example:

    NOTIFY * HTTP/1.1
    Host: 239.198.46.46:1900
    NT: ugcs:vsm:ardupilot
    NTS: ssdp:alive
    USN: Ardupilot VSM
    Location: 192.168.1.33:5556
    ID: 12345678
    

    There is a field “ID” added to the response and notify message. It specifies the service instance. Service client can use the ID field to distinguish between several locations of the same service instance to avoud multiple simultaneous connections. The ID is randomly generated on VSM startup and does change with each restart.

Service discovery support in SDK

VSM SDK has support of automatic service discovery based on the above protocol.

Both ends are implemented in SDK, so developer can create both service advertisers and service locators with minimal effort. Five functions provide interface to service discovery protocol:

Function

Description

See file service_discovery_processor.h for details.

Service advertise support is already enabled by default and can be used by any VSM by adding lines to vsm.conf file.