Zeroconf (Bonjour)

Zeroconf support has been added to WebOS 2.0. Zeroconf uses multicast Domain Name System service records to discover printer services, computer services, and other local network device services.

Applications can use the com.palm.zeroconf to access this functionality.

*See also:


Methods


browse

Syntax

{
    regType       : string,
    domainName    : string,
    interfaceName : string,
    subscribe     : boolean       
}

Parameters

Argument Required Type Description
regType Yes string Registration type of service to browse; i.e. "_airport._tcp"
domainName No string If included, browsing is restricted to this domain. Otherwise, browsing occurs across all suitable domains.
interfaceName No string If included, the interface browsing is restricted to this interface. Otherwise, the interface browsing is done on all suitable interfaces.
subscribe No boolean Subscribe flag.

Returns

{
    timestampMonotonic : int,
    timestampClocktime : string,
    interfaceName      : string,
    eventType          : string,
    instanceName       : string,
    regType            : string,
    domainName         : string                
}
Argument Type Description
timestampMonotonic string Monotonic clock value when the browse reply returned.
timestampClocktime string System clock when the browse reply returned.
interfaceName string Name of interface where service was discovered.
eventType string Can be "Add" or "Rmv".
instanceName string Name of found service.
regType string Registration type of found service.
domainName string Domain where service that was discovered.

Example

luna-send -P -i "palm://com.palm.zeroconf/browse"
'{
    "regType":"_webos._tcp",
    "domainName": "local.",
    "subscribe": true
}'

{
    "returnValue": true,
    "subscribed": true
}

{
    "timestampMonotonic": 2953,
    "timestampClocktime": "Fri Nov 20 11:18:50 2009",
    "interfaceName": "eth0",
    "eventType": "Add",
    "instanceName": "webOS-Device",
    "regType": "_webos._tcp." ,
    "domainName": "local."
}

resolve

Syntax

{ 
   regType      : string,
   instanceName : string,
   domainName   : string,
   subscribe    : boolean
}

Parameters

Argument Required Type Description
regType Yes string Registration type of service to browse; i.e. "_airport._tcp"
instanceName No string Name of service to resolve; i.e. "angryleprechaun"
domainName No string If included, browsing is restricted to that domain. Otherwise, browsing occurs over all suitable domains.
subscribe No boolean Subscribe flag.

Returns

{
   timestampMonotonic : int,
   timestampClocktime : string,
   interfaceName      : string,
   fullName           : string,
   targetName         : string,
   textRecord         : string
   IPv4Address        : string,
   port               : int
}      

Argument Type Description
timestampMonotonic string Monotonic clock value when browse reply returned to service.
timestampClocktime string System clock time when browse reply returned to service.
interfaceName string Name of interface where service was discovered.
fullName string The full domain name of the service, suitable for passing to special purpose functions that take a full domain name parameter.
targetName string The hostname of the machine that provides the service.
textRecord string The primary TXT record for the service in standard TXT record format (that is, a length byte followed by data, followed by a length byte, followed by data, and so on).
IPv4Address string The IPv4 address where the service was resolved.
port int Port number of resolved service.

Example

luna-send -P -i "palm://com.palm.zeroconf/resolve"
'{
    "regType":"_webos._tcp",
    "instanceName": "webOS-Device",
    "domainName": "local.",
    "subscribe": true
}'

{
    "returnValue": true,
    "subscribed": true
}

{
   "timestampMonotonic":1822,
   "timestampClocktime":"Tue Sep 28 15:33:56 2010",
   "interfaceName":"eth0",
   "fullName":"webOS-Device._webos._tcp.local.",
   "targetName":"palm-webos.local.",
   "textRecord":
   [
      "name=~My webOS Device",
      "version=1.3.5",
      "device=castle",
      "carrier=sprint"
   ],
   "IPv4Address":"10.96.24.120",
   "port":42
}

register

Syntax

{ 
   regType       : string,
   interfaceName : string,
   port          : int,
   textRecords   : string array,
   domainName    : string,
   hostName      : string,
   subscribe     : boolean,
}   

Parameters

Argument Required Type Description
regType Yes string Registration type of service to be registered; i.e. "_novacom._tcp"
interfaceName No string Name of interface to advertise service.
port No int Number of port where service accepts connections.
textRecords No string array An array of strings containing one or more text records.
domainName No string If included, the service is registered to that domain. Otherwise, the service is registered in the default domain(s).
hostName No string The SRV target host name; pass NULL to use the computer's default host name.
subscribe No boolean Subscribe flag.

Returns

{
   timestampMonotonic : int,
   timestampClocktime : string,
   instanceName       : string,
   regType            : string,
   domainName         : string
}                      

Argument Type Description
timestampMonotonic string Monotonic clock value when browse reply returned to service.
timestampClocktime string System clock time when browse reply returned to service.
instanceName string Name of interface where service was registered.
regType string Registration type of service.
domainName string Domain where service was registered.

Example

luna-send -P -i "palm://com.palm.zeroconf/register"
'{
    "regType":"_webos._tcp",
    "interfaceName":"eth0",
    "domainName": "local.",
    "instanceName":"webOS-Device",
    "port":42,
    "textRecords":
    [
       "name=~My webOS Device",
       "version=1.3.5",
       "device=castle",
       "carrier=sprint"
    ],
    "subscribe": true
}'

{
   "returnValue": true,
   "subscribed": true
}

{
   "timestampMonotonic": 1836,
   "timestampClocktime": "Fri Nov 20 11:00:13 2009",
   "instanceName": "webOS-Device",
   "regType": "_webos._tcp.",
   "domainName": "local."
}