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 int vtreconn(VtConn *z, int infd, int outfd)
34 VtConn* vtdial(char *addr)
37 int vtredial(VtConn *z, char *addr)
40 int vtversion(VtConn *z)
43 int vtsend(VtConn *z, Packet *p)
46 Packet* vtrecv(VtConn *z)
49 void vtrecvproc(void *z)
52 void vtsendproc(void *z)
55 void vtdebug(VtConn *z, char *fmt, ...)
58 void vthangup(VtConn *z)
61 void vtfreeconn(VtConn *z)
64 extern int chattyventi; /* default 0 */
68 structure represents a connection to a Venti server
69 (when used by a client) or to a client (when used by a server).
70 It contains the following user-visible fields:
72 a flag enabling debugging prints;
74 the protocol version in use;
76 the (unverified) name of the client;
78 the (unverified) name of the server;
81 the network address of the remote side.
84 initializes a new connection structure using file descriptors
88 (which may be the same)
89 for reading and writing.
91 dials the given network address
94 and returns a corresponding connection.
95 It returns nil if the connection cannot be established.
98 exchanges version information with the remote side
101 The negotiated version is stored in
107 .IR venti-packet (3))
112 should be a formatted Venti message as might
116 will add the two-byte length field
126 reads a packet from the connection
130 the data read from the connection must start with
131 a two-byte length, but the returned packet will omit them.
137 block until the packet can be written or read from the network.
138 In a threaded program
141 this may not be desirable.
142 If the caller arranges for
146 to run in their own procs
147 (typically by calling
153 will yield the proc in which they are run
154 to other threads when waiting on the network.
161 must be the connection structure
165 prints the formatted message to standard error
168 is set. Otherwise it is a no-op.
171 hangs up a connection.
172 It closes the associated file descriptors
173 and shuts down send and receive procs if they have been
185 frees the connection structure, hanging it up first
188 If the global variable
190 is set, the library prints all Venti RPCs to standard error
191 as they are sent or received.
197 .IR venti-client (3),
198 .IR venti-packet (3),
199 .IR venti-server (3),
202 Routines that return pointers return nil on error.
203 Routines returning integers return 0 on success, \-1 on error.