This document explains a bit about working of service discovery extension. The
work is based on Rajeev Koodli's draft on service discovery.

Modifications and extension in the source code are marked with "//sandy" at
appropriate places for easy reference. Modifications do not affect the actual
working of AODV code.

Here is how the code works:

Each node that wants to provide some service, binds itself to that service. Each
service should have a port no. and service name associated with it. On the lines
of routing table, there is a service table [aodv_rtable.h/cc] in which the
service provider node adds its own binding with lifetime as infinite. All nodes
use this service table for recording various service bindings offered in the
network. This table has these fields: port no., service string, destination
address (of service provider), expiry time of service binding, number of hops to
the service provider.

Now when a node wants to start service discovery, it must know either service
port no. or service name. Accordingly, it makes a RREQ message with service
request (SREQ) port extension or SREQ URL extension. The format of these
extensions can be seen in aodv_packet.h. It also maintains a queue of service
discoveries initiated by it. [aodv.h]

Each node receiving RREQ, first checks for SREQ extensions and processes it if
they are present. If it has service binding or it itself offers the service,
then it can form a service reply extension (SREP) and send back to the
inititator of service discovery. If it has service binding but expired/no route
to service provider, it rebroadcasts the SREQ with destination set to that of
service provider. Otherwise, it simply rebroadcasts the request.

Service discovery initiator waits for a predetermined time (SDISEXTIME) before
it reports failure.

Service predicate field in SREQ URL extension would depend on actual application
sending the request. eg. application sending requests to find printer service
can add that it needs laser printer, in predicate field.

Three commands, viz. 'svc-bind', 'svc-disc-port' and 'svc-disc-string', provide
interface to tcl scripts for service binding, service discovery with port no.
and service discovery with string/name, respectively

Present implementation only prints out whether a service discovery was
successful or not (and address of node providing service, in case of success).
Agents can be easily be written on top of this implementation which can use it
to find such service and then communicate with service providers.

-Sandeep Gupta, May 2003
