3 VtConn, vtconn, vtdial, vtfreeconn, vtsend, vtrecv, vtversion,
4 vtdebug, vthangup \- Venti network connections
17 typedef struct VtConn {
26 .ta \w'\fLextern int 'u
28 VtConn* vtconn(int infd, int outfd)
31 VtConn* vtdial(char *addr)
34 int vtversion(VtConn *z)
37 int vtsend(VtConn *z, Packet *p)
40 Packet* vtrecv(VtConn *z)
43 void vtrecvproc(void *z)
46 void vtsendproc(void *z)
49 void vtdebug(VtConn *z, char *fmt, ...)
52 void vthangup(VtConn *z)
55 void vtfreeconn(VtConn *z)
58 extern int chattyventi; /* default 0 */
62 structure represents a connection to a Venti server
63 (when used by a client) or to a client (when used by a server).
64 It contains the following user-visible fields:
66 a flag enabling debugging prints;
68 the protocol version in use;
70 the (unverified) name of the client;
72 the (unverified) name of the server;
75 the network address of the remote side.
78 initializes a new connection structure using file descriptors
82 (which may be the same)
83 for reading and writing.
85 dials the given network address
88 and returns a corresponding connection.
89 It returns nil if the connection cannot be established.
92 exchanges version information with the remote side
95 The negotiated version is stored in
101 .IR venti-packet (2))
106 should be a formatted Venti message as might
110 will add the two-byte length field
120 reads a packet from the connection
124 the data read from the connection must start with
125 a two-byte length, but the returned packet will omit them.
131 block until the packet can be written or read from the network.
132 In a threaded program
135 this may not be desirable.
136 If the caller arranges for
140 to run in their own procs
141 (typically by calling
147 will yield the proc in which they are run
148 to other threads when waiting on the network.
155 must be the connection structure
159 prints the formatted message to standard error
162 is set. Otherwise it is a no-op.
165 hangs up a connection.
166 It closes the associated file descriptors
167 and shuts down send and receive procs if they have been
179 frees the connection structure, hanging it up first
182 If the global variable
184 is set, the library prints all Venti RPCs to standard error
185 as they are sent or received.
191 .IR venti-client (2),
192 .IR venti-packet (2),
193 .IR venti-server (2),
196 Routines that return pointers return nil on error.
197 Routines returning integers return 0 on success, \-1 on error.