F.1.2. rascal_accept_service

rrid_t rascal_accept_service(
	const char *name,
	const char *proto,
	const char *domain,
	dispatcher,
	void *context OPTIONAL
);

This function begins accepting connections to the specified service. It performs a service descovery DNS query, then attempts to install a listener on all listed addresses.

On success, this function installs multiple different listeners; the behaviour of this function can be resembled by a call to rascal_connect_service with a filter which calls rascal_accept then declines the outgoing connection attempt.

Parameters. 

name, domain, proto
Service identification information. See rascal_connect_service.
dispatcher

The address of an event dispatcher function.

The rop_listen event will be delivered after each particular listener corresponding to the service is installed; the handler may return false to cancel a particular listener. The identifiers of listeners must be stored if a need to uninstall them may arise in future; the request identifier returned by rascal_accept_service is not suitable for that. Also, all further rop_accept notifications will carry the identifier of each particular listener, not the identifier returned by rascal_accept_service either.

context
Opaque user data passed back to the specified dispatcher when an event occurs.

Return value. 

When the return value indicates success, which means an operation is being performed in background, it may be used in conjunction with rascal_cancel to abort installing the listeners. It can not be used to uninstall them later.

Sample use. 

rascal_accept_service("http", "tcp",
	"faerion.oss", my_dispatcher, NULL);