ex_slp v0.1.1 ExSlp.Client

Summary

Functions

Returns the list of the attributes specified for the service url provided. Takes service_url as a mandatory parameter, args and opts keyword lists as optional arguments. See ExSlp.Client.findsrvs/3 for details on args and opts. Returns:

{ :ok, [ ( { "key1", "val1" }(, { "key2", "val2 }(, ... ) ) ) ] # in case of success,
{ :error, message } # otherwise.

Example:

> ExSlp.Server.register("myservice://127.0.0.1", [ attr1: "val1", attr2: "val2" ])
{:ok, ""}
> ExSlp.Client.findattrs("service:myservice://127.0.0.1")
{:ok, [{"attr1", "val1"}, {"attr2", "val2"}]}

Finds all the scopes specified by the services. Takes a standard args keyword list. Returns:

{ :ok, [ ( scope1(, scope2(, ...) ) ) ] # in case of success,
{ :error, message } # otherwise

Sends a multicast/broadcast service discovery request to the local network. Takes service_type as a mandatory parameter, args and opts keyword lists as optional arguments. Allowed args keys:

s: scopes, a comma-separated list of scopes
l: language tag
t: lifetame tag
i: a comma-separated list of interfaces
u: specifies a single interface

opts Returns:

{ :ok, [ ( service_url1(, service_url2(, ...) ) ) ] } # in case of success,
{ :error, message } # otherwise.

Examples:

findsrvs( "myservice" )
findsrvs( "service:myservice", [ attr1: value1, attr2: value2 ] )
findsrvs( "myservice", [ i: "10.77.13.240,192.168.250.240" ], [] )
findsrvs( "service:myservice", [ u: "10.77.13.237" ], [ attr1: value1 ] )

See http://www.openslp.org/doc/html/ProgrammersGuide/SLPFindSrvs.html for more method internals

Sends a discovery request and fetched all the services registered in the network. Takes authority and args as optional arguments. authority is a string identifying the service. args is a regular slptool keyword list, see ExSlp.Client.findsrvs/3 for more details. Returns:

{ :ok, [ ( service_type1(, service_type2(, ...) ) ) ] # in case of success,
{ :error, message } # otherwise.

Example:

> ExSlp.Server.register "myservice1://127.0.0.1"
{:ok, ""}
> ExSlp.Server.register "myservice2://127.0.0.1"
{:ok, ""}
> ExSlp.Client.findsrvtypes
{:ok, ["service:myservice1", "service:myservice2"]}
> ExSlp.Server.register "myservice3.x://127.0.0.1"
{:ok, ""}
> ExSlp.Client.findsrvtypes "x" # Note: we provide the authority here
{:ok, ["service:myservice3.x"]}

Reads the property of the local service. Takes a mandatory property parameter and args as a list of slptool arguments. Returns:

{ :ok, property_value } # in case of success,
{ :error, message } # otherwise

Functions

findattrs(service_url)

Returns the list of the attributes specified for the service url provided. Takes service_url as a mandatory parameter, args and opts keyword lists as optional arguments. See ExSlp.Client.findsrvs/3 for details on args and opts. Returns:

{ :ok, [ ( { "key1", "val1" }(, { "key2", "val2 }(, ... ) ) ) ] # in case of success,
{ :error, message } # otherwise.

Example:

> ExSlp.Server.register("myservice://127.0.0.1", [ attr1: "val1", attr2: "val2" ])
{:ok, ""}
> ExSlp.Client.findattrs("service:myservice://127.0.0.1")
{:ok, [{"attr1", "val1"}, {"attr2", "val2"}]}
findattrs(service_url, opts)
findattrs(service_url, args, opts)
findscopes()

Finds all the scopes specified by the services. Takes a standard args keyword list. Returns:

{ :ok, [ ( scope1(, scope2(, ...) ) ) ] # in case of success,
{ :error, message } # otherwise.
findscopes(args)
findsrvs(service_type)

Sends a multicast/broadcast service discovery request to the local network. Takes service_type as a mandatory parameter, args and opts keyword lists as optional arguments. Allowed args keys:

s: scopes, a comma-separated list of scopes
l: language tag
t: lifetame tag
i: a comma-separated list of interfaces
u: specifies a single interface

opts Returns:

{ :ok, [ ( service_url1(, service_url2(, ...) ) ) ] } # in case of success,
{ :error, message } # otherwise.

Examples:

findsrvs( "myservice" )
findsrvs( "service:myservice", [ attr1: value1, attr2: value2 ] )
findsrvs( "myservice", [ i: "10.77.13.240,192.168.250.240" ], [] )
findsrvs( "service:myservice", [ u: "10.77.13.237" ], [ attr1: value1 ] )

See http://www.openslp.org/doc/html/ProgrammersGuide/SLPFindSrvs.html for more method internals.

findsrvs(service_type, opts)
findsrvs(service_type, args, opts)
findsrvtypes()

Sends a discovery request and fetched all the services registered in the network. Takes authority and args as optional arguments. authority is a string identifying the service. args is a regular slptool keyword list, see ExSlp.Client.findsrvs/3 for more details. Returns:

{ :ok, [ ( service_type1(, service_type2(, ...) ) ) ] # in case of success,
{ :error, message } # otherwise.

Example:

> ExSlp.Server.register "myservice1://127.0.0.1"
{:ok, ""}
> ExSlp.Server.register "myservice2://127.0.0.1"
{:ok, ""}
> ExSlp.Client.findsrvtypes
{:ok, ["service:myservice1", "service:myservice2"]}
> ExSlp.Server.register "myservice3.x://127.0.0.1"
{:ok, ""}
> ExSlp.Client.findsrvtypes "x" # Note: we provide the authority here
{:ok, ["service:myservice3.x"]}
findsrvtypes(authority)
findsrvtypes(authority, args)
getproperty(property)

Reads the property of the local service. Takes a mandatory property parameter and args as a list of slptool arguments. Returns:

{ :ok, property_value } # in case of success,
{ :error, message } # otherwise.
getproperty(property, args)