ex_slp v0.1.2 ExSlp.Service

Summary

Functions

Connects the 2 erlang nodes using the native Node.connect method. Takes service_url parameter which is either a regular node url or the fully qualified URL returned by ExSlp.Service.discover. Returns: see Node.connect/1

Cancells the service registration initialized by ExSlp.Service.register command. Takes 2 optional keyword lists: opts and slptool arguments. Opts might contain service key which corresponds to the service type registered using ExSlp.Service.register/3. Args is a standard extra argument list keyword you normally provide while calling slptool deregister. Make sure to call the method before the app termination. The service would remain registered otherwise. Returns:

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

Sends a lookup multicast/broafcast(depends on the slpd settings, check net.slp.isBroadcastOnly property) request and returns the list of the registered exslp services. Takes 2 optional keyword list parameters: slptool arguments and the service options. For more info on args see ExSlp.Server.register/3. For more info on opts see ExSlp.Server.register/3. Returns an array of the refistered service URLs filtering out the current node authority. Example: Given there are 2 nodes one@192.168.0.10 and two@192.168.0.20. Each registers itself as an exslp service. For node one the method returns

["service:exslp://two@192.168.0.20,65535"]

For node two the metod returns

["service:exslp://one@192.168.0.10,65535"]

The URLs returned are accepted as service_url parameter in ExSlp.Service.connect/1 method

Registers a new SLP service with type using the current Node name as the authority. Takes 2 optional keyword list parameters: slptool arguments and the service options. For more info on args see ExSlp.Server.register/3. Opts is a keyword list which is completely identical to the one you would use in ExSlp.Server.register/3 except one argument: service. This argument specifies the service type, which is set to exslp by default. In order to properly deregister a service on has to provide the service type once again (see ExSlp.Service.deregister/3). For more info on opts see ExSlp.Server.register/3. Example: given the node name

node@192.168.0.10

the service URL will look like:

service:exslp://node@192.168.0.10.

After being registered the node might be discovered by service type exslp. Make sure to call ExSlp.deregister/3 before the app termination in order to cancel the registration. slptool always use net.slp.watchRegistrationPID = false option to connect slpd. Returns

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

Checks whether the current node has been registered as a service. Takes 2 optional arguments: a keyword list of slptool arguments and a keyword list of findsrvs command options. Returns true if the authority of the current node has been found in the list of the services

Functions

connect(service_url)

Connects the 2 erlang nodes using the native Node.connect method. Takes service_url parameter which is either a regular node url or the fully qualified URL returned by ExSlp.Service.discover. Returns: see Node.connect/1.

deregister()

Cancells the service registration initialized by ExSlp.Service.register command. Takes 2 optional keyword lists: opts and slptool arguments. Opts might contain service key which corresponds to the service type registered using ExSlp.Service.register/3. Args is a standard extra argument list keyword you normally provide while calling slptool deregister. Make sure to call the method before the app termination. The service would remain registered otherwise. Returns:

{ :ok, :resp } in case of success
{ :error, message } otherwise.
deregister(opts)
deregister(args, opts)
discover()

Sends a lookup multicast/broafcast(depends on the slpd settings, check net.slp.isBroadcastOnly property) request and returns the list of the registered exslp services. Takes 2 optional keyword list parameters: slptool arguments and the service options. For more info on args see ExSlp.Server.register/3. For more info on opts see ExSlp.Server.register/3. Returns an array of the refistered service URLs filtering out the current node authority. Example: Given there are 2 nodes one@192.168.0.10 and two@192.168.0.20. Each registers itself as an exslp service. For node one the method returns

["service:exslp://two@192.168.0.20,65535"]

For node two the metod returns

["service:exslp://one@192.168.0.10,65535"]

The URLs returned are accepted as service_url parameter in ExSlp.Service.connect/1 method.

discover(opts)
discover(args, opts)
register()

Registers a new SLP service with type using the current Node name as the authority. Takes 2 optional keyword list parameters: slptool arguments and the service options. For more info on args see ExSlp.Server.register/3. Opts is a keyword list which is completely identical to the one you would use in ExSlp.Server.register/3 except one argument: service. This argument specifies the service type, which is set to exslp by default. In order to properly deregister a service on has to provide the service type once again (see ExSlp.Service.deregister/3). For more info on opts see ExSlp.Server.register/3. Example: given the node name

node@192.168.0.10

the service URL will look like:

service:exslp://node@192.168.0.10.

After being registered the node might be discovered by service type exslp. Make sure to call ExSlp.deregister/3 before the app termination in order to cancel the registration. slptool always use net.slp.watchRegistrationPID = false option to connect slpd. Returns

{ :ok, resp } in case of success
{ :error, message } otherwise.
register(opts)
register(args, opts)
registered?()

Checks whether the current node has been registered as a service. Takes 2 optional arguments: a keyword list of slptool arguments and a keyword list of findsrvs command options. Returns true if the authority of the current node has been found in the list of the services.

registered?(opts)
registered?(args, opts)
service_url()
service_url(cur_node, service \\ "exslp")