DESCRIPTION

Vtsrvhello
executes the server side of the initial
hello
transaction.
It sets
z->uid
with the user name claimed by the other side.
Each new connection must be initialized by running
vtversion
and then
vtsrvhello.
The framework below takes care of this detail automatically;
vtsrvhello
is provided for programs that do not use the functions below.

Vtgetreq
waits for and returns
the next
read,write,sync,
or
ping
request from any client connected to
the service
srv.Hello
and
goodbye
messages are handled internally and not returned to the client.
The interface does not distinguish between the
different clients that may be connected at any given time.
The request can be found in the
tx
field of the returned
VtReq.

Once a request has been served and a response stored in
r->rx,
the server should call
vtrespond
to send the response to the client.
Vtrespond
frees the structure
r
as well as the packets
r->tx.data
and
r->rx.data.

EXAMPLE

/sys/src/cmd/venti
contains two simple Venti servers
ro.c
and
devnull.c
written using these routines.
Ro
is a read-only Venti proxy (it rejects
write
requests).
Devnull
is a dangerous write-only Venti server: it discards all
blocks written to it and returns error on all reads.