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).
66 initializes a new connection structure using file descriptors
70 (which may be the same)
71 for reading and writing.
73 dials the given network address
76 and returns a corresponding connection.
77 It returns nil if the connection cannot be established.
80 exchanges version information with the remote side
83 The negotiated version is stored in
94 should be a formatted Venti message as might
98 will add the two-byte length field
108 reads a packet from the connection
112 the data read from the connection must start with
113 a two-byte length, but the returned packet will omit them.
119 block until the packet can be written or read from the network.
120 In a threaded program
123 this may not be desirable.
124 If the caller arranges for
128 to run in their own procs
129 (typically by calling
135 will yield the proc in which they are run
136 to other threads when waiting on the network.
143 must be the connection structure
147 prints the formatted message to standard error
150 is set. Otherwise it is a no-op.
153 hangs up a connection.
154 It closes the associated file descriptors
155 and shuts down send and receive procs if they have been
167 frees the connection structure, hanging it up first
170 If the global variable
172 is set, the library prints all Venti RPCs to standard error
173 as they are sent or received.
179 .IR venti-client (3),
180 .IR venti-packet (3),
181 .IR venti-server (3),
184 Routines that return pointers return nil on error.
185 Routines returning integers return 0 on success, \-1 on error.