OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / man / man3 / Tcl_ChannelBuffered.3
1 '\"
2 '\" Copyright (c) 1996-1997 Sun Microsystems, Inc.
3 '\" Copyright (c) 1997-2000 Ajuba Solutions.
4 '\"
5 '\" See the file "license.terms" for information on usage and redistribution
6 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 '\"
8 '\" RCS: @(#) $Id: CrtChannel.3,v 1.16 2002/07/01 18:24:39 jenglish Exp $
9 '\" The definitions below are for supplemental macros used in Tcl/Tk
10 '\" manual entries.
11 '\"
12 '\" .AP type name in/out ?indent?
13 '\"     Start paragraph describing an argument to a library procedure.
14 '\"     type is type of argument (int, etc.), in/out is either "in", "out",
15 '\"     or "in/out" to describe whether procedure reads or modifies arg,
16 '\"     and indent is equivalent to second arg of .IP (shouldn't ever be
17 '\"     needed;  use .AS below instead)
18 '\"
19 '\" .AS ?type? ?name?
20 '\"     Give maximum sizes of arguments for setting tab stops.  Type and
21 '\"     name are examples of largest possible arguments that will be passed
22 '\"     to .AP later.  If args are omitted, default tab stops are used.
23 '\"
24 '\" .BS
25 '\"     Start box enclosure.  From here until next .BE, everything will be
26 '\"     enclosed in one large box.
27 '\"
28 '\" .BE
29 '\"     End of box enclosure.
30 '\"
31 '\" .CS
32 '\"     Begin code excerpt.
33 '\"
34 '\" .CE
35 '\"     End code excerpt.
36 '\"
37 '\" .VS ?version? ?br?
38 '\"     Begin vertical sidebar, for use in marking newly-changed parts
39 '\"     of man pages.  The first argument is ignored and used for recording
40 '\"     the version when the .VS was added, so that the sidebars can be
41 '\"     found and removed when they reach a certain age.  If another argument
42 '\"     is present, then a line break is forced before starting the sidebar.
43 '\"
44 '\" .VE
45 '\"     End of vertical sidebar.
46 '\"
47 '\" .DS
48 '\"     Begin an indented unfilled display.
49 '\"
50 '\" .DE
51 '\"     End of indented unfilled display.
52 '\"
53 '\" .SO
54 '\"     Start of list of standard options for a Tk widget.  The
55 '\"     options follow on successive lines, in four columns separated
56 '\"     by tabs.
57 '\"
58 '\" .SE
59 '\"     End of list of standard options for a Tk widget.
60 '\"
61 '\" .OP cmdName dbName dbClass
62 '\"     Start of description of a specific option.  cmdName gives the
63 '\"     option's name as specified in the class command, dbName gives
64 '\"     the option's name in the option database, and dbClass gives
65 '\"     the option's class in the option database.
66 '\"
67 '\" .UL arg1 arg2
68 '\"     Print arg1 underlined, then print arg2 normally.
69 '\"
70 '\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $
71 '\"
72 '\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
73 .if t .wh -1.3i ^B
74 .nr ^l \n(.l
75 .ad b
76 '\"     # Start an argument description
77 .de AP
78 .ie !"\\$4"" .TP \\$4
79 .el \{\
80 .   ie !"\\$2"" .TP \\n()Cu
81 .   el          .TP 15
82 .\}
83 .ta \\n()Au \\n()Bu
84 .ie !"\\$3"" \{\
85 \&\\$1  \\fI\\$2\\fP    (\\$3)
86 .\".b
87 .\}
88 .el \{\
89 .br
90 .ie !"\\$2"" \{\
91 \&\\$1  \\fI\\$2\\fP
92 .\}
93 .el \{\
94 \&\\fI\\$1\\fP
95 .\}
96 .\}
97 ..
98 '\"     # define tabbing values for .AP
99 .de AS
100 .nr )A 10n
101 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
102 .nr )B \\n()Au+15n
103 .\"
104 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
105 .nr )C \\n()Bu+\\w'(in/out)'u+2n
106 ..
107 .AS Tcl_Interp Tcl_CreateInterp in/out
108 '\"     # BS - start boxed text
109 '\"     # ^y = starting y location
110 '\"     # ^b = 1
111 .de BS
112 .br
113 .mk ^y
114 .nr ^b 1u
115 .if n .nf
116 .if n .ti 0
117 .if n \l'\\n(.lu\(ul'
118 .if n .fi
119 ..
120 '\"     # BE - end boxed text (draw box now)
121 .de BE
122 .nf
123 .ti 0
124 .mk ^t
125 .ie n \l'\\n(^lu\(ul'
126 .el \{\
127 .\"     Draw four-sided box normally, but don't draw top of
128 .\"     box if the box started on an earlier page.
129 .ie !\\n(^b-1 \{\
130 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
131 .\}
132 .el \}\
133 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
134 .\}
135 .\}
136 .fi
137 .br
138 .nr ^b 0
139 ..
140 '\"     # VS - start vertical sidebar
141 '\"     # ^Y = starting y location
142 '\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
143 .de VS
144 .if !"\\$2"" .br
145 .mk ^Y
146 .ie n 'mc \s12\(br\s0
147 .el .nr ^v 1u
148 ..
149 '\"     # VE - end of vertical sidebar
150 .de VE
151 .ie n 'mc
152 .el \{\
153 .ev 2
154 .nf
155 .ti 0
156 .mk ^t
157 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
158 .sp -1
159 .fi
160 .ev
161 .\}
162 .nr ^v 0
163 ..
164 '\"     # Special macro to handle page bottom:  finish off current
165 '\"     # box/sidebar if in box/sidebar mode, then invoked standard
166 '\"     # page bottom macro.
167 .de ^B
168 .ev 2
169 'ti 0
170 'nf
171 .mk ^t
172 .if \\n(^b \{\
173 .\"     Draw three-sided box if this is the box's first page,
174 .\"     draw two sides but no top otherwise.
175 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
176 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
177 .\}
178 .if \\n(^v \{\
179 .nr ^x \\n(^tu+1v-\\n(^Yu
180 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
181 .\}
182 .bp
183 'fi
184 .ev
185 .if \\n(^b \{\
186 .mk ^y
187 .nr ^b 2
188 .\}
189 .if \\n(^v \{\
190 .mk ^Y
191 .\}
192 ..
193 '\"     # DS - begin display
194 .de DS
195 .RS
196 .nf
197 .sp
198 ..
199 '\"     # DE - end display
200 .de DE
201 .fi
202 .RE
203 .sp
204 ..
205 '\"     # SO - start of list of standard options
206 .de SO
207 .SH "STANDARD OPTIONS"
208 .LP
209 .nf
210 .ta 5.5c 11c
211 .ft B
212 ..
213 '\"     # SE - end of list of standard options
214 .de SE
215 .fi
216 .ft R
217 .LP
218 See the \\fBoptions\\fR manual entry for details on the standard options.
219 ..
220 '\"     # OP - start of full description for a single option
221 .de OP
222 .LP
223 .nf
224 .ta 4c
225 Command-Line Name:      \\fB\\$1\\fR
226 Database Name:  \\fB\\$2\\fR
227 Database Class: \\fB\\$3\\fR
228 .fi
229 .IP
230 ..
231 '\"     # CS - begin code excerpt
232 .de CS
233 .RS
234 .nf
235 .ta .25i .5i .75i 1i
236 ..
237 '\"     # CE - end code excerpt
238 .de CE
239 .fi
240 .RE
241 ..
242 .de UL
243 \\$1\l'|0\(ul'\\$2
244 ..
245 .TH Tcl_CreateChannel 3 8.3 Tcl "Tcl Library Procedures"
246 .BS
247 '\" Note:  do not modify the .SH NAME line immediately below!
248 .SH NAME
249 Tcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, Tcl_GetChannelName, Tcl_GetChannelHandle, Tcl_GetChannelMode, Tcl_GetChannelBufferSize, Tcl_SetChannelBufferSize, Tcl_NotifyChannel, Tcl_BadChannelOption, Tcl_ChannelName, Tcl_ChannelVersion, Tcl_ChannelBlockModeProc, Tcl_ChannelCloseProc, Tcl_ChannelClose2Proc, Tcl_ChannelInputProc, Tcl_ChannelOutputProc, Tcl_ChannelSeekProc, Tcl_ChannelWideSeekProc, Tcl_ChannelSetOptionProc, Tcl_ChannelGetOptionProc, Tcl_ChannelWatchProc, Tcl_ChannelGetHandleProc, Tcl_ChannelFlushProc, Tcl_ChannelHandlerProc, Tcl_IsChannelShared, Tcl_IsChannelRegistered, Tcl_CutChannel, Tcl_SpliceChannel, Tcl_IsChannelExisting, Tcl_ClearChannelHandlers, Tcl_GetChannelThread, Tcl_ChannelBuffered \- procedures for creating and manipulating channels
250 .SH SYNOPSIS
251 .nf
252 \fB#include <tcl.h>\fR
253 .sp
254 Tcl_Channel
255 \fBTcl_CreateChannel\fR(\fItypePtr, channelName, instanceData, mask\fR)
256 .sp
257 ClientData
258 \fBTcl_GetChannelInstanceData\fR(\fIchannel\fR)
259 .sp
260 Tcl_ChannelType *
261 \fBTcl_GetChannelType\fR(\fIchannel\fR)
262 .sp
263 CONST char *
264 \fBTcl_GetChannelName\fR(\fIchannel\fR)
265 .sp
266 int
267 \fBTcl_GetChannelHandle\fR(\fIchannel, direction, handlePtr\fR)
268 .sp
269 .VS 8.4
270 Tcl_ThreadId
271 \fBTcl_GetChannelThread\fR(\fIchannel\fR)
272 .VE 8.4
273 .sp
274 int
275 \fBTcl_GetChannelBufferSize\fR(\fIchannel\fR)
276 .sp
277 \fBTcl_SetChannelBufferSize\fR(\fIchannel, size\fR)
278 .sp
279 \fBTcl_NotifyChannel\fR(\fIchannel, mask\fR)
280 .sp
281 int
282 \fBTcl_BadChannelOption\fR(\fIinterp, optionName, optionList\fR)
283 .VS 8.4
284 .sp
285 int
286 \fBTcl_IsChannelShared\fR(\fIchannel\fR)
287 .sp
288 int
289 \fBTcl_IsChannelRegistered\fR(\fIinterp, channel\fR)
290 .sp
291 int
292 \fBTcl_IsChannelExisting\fR(\fIchannelName\fR)
293 .sp
294 void
295 \fBTcl_CutChannel\fR(\fIchannel\fR)
296 .sp
297 void
298 \fBTcl_SpliceChannel\fR(\fIchannel\fR)
299 .sp
300 void
301 \fBTcl_ClearChannelHandlers\fR(\fIchannel\fR)
302 .VE 8.4
303 .sp
304 int
305 \fBTcl_ChannelBuffered\fR(\fIchannel\fR)
306 .sp
307 CONST char *
308 \fBTcl_ChannelName\fR(\fItypePtr\fR)
309 .sp
310 Tcl_ChannelTypeVersion
311 \fBTcl_ChannelVersion\fR(\fItypePtr\fR)
312 .sp
313 Tcl_DriverBlockModeProc *
314 \fBTcl_ChannelBlockModeProc\fR(\fItypePtr\fR)
315 .sp
316 Tcl_DriverCloseProc *
317 \fBTcl_ChannelCloseProc\fR(\fItypePtr\fR)
318 .sp
319 Tcl_DriverClose2Proc *
320 \fBTcl_ChannelClose2Proc\fR(\fItypePtr\fR)
321 .sp
322 Tcl_DriverInputProc *
323 \fBTcl_ChannelInputProc\fR(\fItypePtr\fR)
324 .sp
325 Tcl_DriverOutputProc *
326 \fBTcl_ChannelOutputProc\fR(\fItypePtr\fR)
327 .sp
328 Tcl_DriverSeekProc *
329 \fBTcl_ChannelSeekProc\fR(\fItypePtr\fR)
330 .sp
331 .VS 8.4
332 Tcl_DriverWideSeekProc *
333 \fBTcl_ChannelWideSeekProc\fR(\fItypePtr\fR)
334 .VE 8.4
335 .sp
336 Tcl_DriverSetOptionProc *
337 \fBTcl_ChannelSetOptionProc\fR(\fItypePtr\fR)
338 .sp
339 Tcl_DriverGetOptionProc *
340 \fBTcl_ChannelGetOptionProc\fR(\fItypePtr\fR)
341 .sp
342 Tcl_DriverWatchProc *
343 \fBTcl_ChannelWatchProc\fR(\fItypePtr\fR)
344 .sp
345 Tcl_DriverGetHandleProc *
346 \fBTcl_ChannelGetHandleProc\fR(\fItypePtr\fR)
347 .sp
348 Tcl_DriverFlushProc *
349 \fBTcl_ChannelFlushProc\fR(\fItypePtr\fR)
350 .sp
351 Tcl_DriverHandlerProc *
352 \fBTcl_ChannelHandlerProc\fR(\fItypePtr\fR)
353 .sp
354 .SH ARGUMENTS
355 .AS Tcl_ChannelType *channelName in
356 .AP Tcl_ChannelType *typePtr in
357 Points to a structure containing the addresses of procedures that
358 can be called to perform I/O and other functions on the channel.
359 .AP "CONST char" *channelName in
360 The name of this channel, such as \fBfile3\fR; must not be in use
361 by any other channel. Can be NULL, in which case the channel is
362 created without a name.
363 .AP ClientData instanceData in
364 Arbitrary one-word value to be associated with this channel.  This
365 value is passed to procedures in \fItypePtr\fR when they are invoked.
366 .AP int mask in
367 OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicate
368 whether a channel is readable and writable.
369 .AP Tcl_Channel channel in
370 The channel to operate on.
371 .AP int direction in
372 \fBTCL_READABLE\fR means the input handle is wanted; \fBTCL_WRITABLE\fR
373 means the output handle is wanted.
374 .AP ClientData *handlePtr out
375 Points to the location where the desired OS-specific handle should be
376 stored.
377 .AP int size in
378 The size, in bytes, of buffers to allocate in this channel.
379 .AP int mask in
380 An OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR
381 and \fBTCL_EXCEPTION\fR that indicates events that have occurred on
382 this channel.
383 .AP Tcl_Interp *interp in
384 Current interpreter. (can be NULL)
385 .AP "CONST char" *optionName in
386 Name of the invalid option.
387 .AP "CONST char" *optionList in
388 Specific options list (space separated words, without "-") 
389 to append to the standard generic options list.
390 Can be NULL for generic options error message only.
391
392 .BE
393
394 .SH DESCRIPTION
395 .PP
396 Tcl uses a two-layered channel architecture. It provides a generic upper
397 layer to enable C and Tcl programs to perform input and output using the
398 same APIs for a variety of files, devices, sockets etc. The generic C APIs
399 are described in the manual entry for \fBTcl_OpenFileChannel\fR.
400 .PP
401 The lower layer provides type-specific channel drivers for each type
402 of device supported on each platform.  This manual entry describes the
403 C APIs used to communicate between the generic layer and the
404 type-specific channel drivers.  It also explains how new types of
405 channels can be added by providing new channel drivers.
406 .PP
407 Channel drivers consist of a number of components: First, each channel
408 driver provides a \fBTcl_ChannelType\fR structure containing pointers to
409 functions implementing the various operations used by the generic layer to
410 communicate with the channel driver. The \fBTcl_ChannelType\fR structure
411 and the functions referenced by it are described in the section
412 TCL_CHANNELTYPE, below.
413 .PP
414 Second, channel drivers usually provide a Tcl command to create
415 instances of that type of channel. For example, the Tcl \fBopen\fR
416 command creates channels that use the file and command channel
417 drivers, and the Tcl \fBsocket\fR command creates channels that use
418 TCP sockets for network communication.
419 .PP
420 Third, a channel driver optionally provides a C function to open
421 channel instances of that type. For example, \fBTcl_OpenFileChannel\fR
422 opens a channel that uses the file channel driver, and
423 \fBTcl_OpenTcpClient\fR opens a channel that uses the TCP network
424 protocol.  These creation functions typically use
425 \fBTcl_CreateChannel\fR internally to open the channel.
426 .PP
427 To add a new type of channel you must implement a C API or a Tcl command
428 that opens a channel by invoking \fBTcl_CreateChannel\fR.
429 When your driver calls \fBTcl_CreateChannel\fR it passes in
430 a \fBTcl_ChannelType\fR structure describing the driver's I/O
431 procedures.
432 The generic layer will then invoke the functions referenced in that
433 structure to perform operations on the channel.
434 .PP
435 \fBTcl_CreateChannel\fR opens a new channel and associates the supplied
436 \fItypePtr\fR and \fIinstanceData\fR with it. The channel is opened in the
437 mode indicated by \fImask\fR.
438 For a discussion of channel drivers, their operations and the
439 \fBTcl_ChannelType\fR structure, see the section TCL_CHANNELTYPE, below.
440 .PP
441 \fBTcl_CreateChannel\fR interacts with the code managing the standard
442 channels. Once a standard channel was initialized either through a
443 call to \fBTcl_GetStdChannel\fR or a call to \fBTcl_SetStdChannel\fR
444 closing this standard channel will cause the next call to
445 \fBTcl_CreateChannel\fR to make the new channel the new standard
446 channel too. See \fBTcl_StandardChannels\fR for a general treatise
447 about standard channels and the behaviour of the Tcl library with
448 regard to them.
449 .PP
450 \fBTcl_GetChannelInstanceData\fR returns the instance data associated with
451 the channel in \fIchannel\fR. This is the same as the \fIinstanceData\fR
452 argument in the call to \fBTcl_CreateChannel\fR that created this channel.
453 .PP
454 \fBTcl_GetChannelType\fR returns a pointer to the \fBTcl_ChannelType\fR
455 structure used by the channel in the \fIchannel\fR argument. This is
456 the same as the \fItypePtr\fR argument in the call to
457 \fBTcl_CreateChannel\fR that created this channel.
458 .PP
459 \fBTcl_GetChannelName\fR returns a string containing the name associated
460 with the channel, or NULL if the \fIchannelName\fR argument to
461 \fBTcl_CreateChannel\fR was NULL.
462 .PP
463 \fBTcl_GetChannelHandle\fR places the OS-specific device handle
464 associated with \fIchannel\fR for the given \fIdirection\fR in the
465 location specified by \fIhandlePtr\fR and returns \fBTCL_OK\fR.  If
466 the channel does not have a device handle for the specified direction,
467 then \fBTCL_ERROR\fR is returned instead.  Different channel drivers
468 will return different types of handle.  Refer to the manual entries
469 for each driver to determine what type of handle is returned.
470 .VS 8.4
471 .PP
472 \fBTcl_GetChannelThread\fR returns the id of the thread currently managing
473 the specified \fIchannel\fR. This allows channel drivers to send their file
474 events to the correct event queue even for a multi-threaded core.
475 .VE 8.4
476 .PP
477 \fBTcl_GetChannelMode\fR returns an OR-ed combination of \fBTCL_READABLE\fR
478 and \fBTCL_WRITABLE\fR, indicating whether the channel is open for input
479 and output.
480 .PP
481 \fBTcl_GetChannelBufferSize\fR returns the size, in bytes, of buffers
482 allocated to store input or output in \fIchannel\fR. If the value was not set
483 by a previous call to \fBTcl_SetChannelBufferSize\fR, described below, then
484 the default value of 4096 is returned.
485 .PP
486 \fBTcl_SetChannelBufferSize\fR sets the size, in bytes, of buffers that
487 will be allocated in subsequent operations on the channel to store input or
488 output. The \fIsize\fR argument should be between ten and one million,
489 allowing buffers of ten bytes to one million bytes. If \fIsize\fR is
490 outside this range, \fBTcl_SetChannelBufferSize\fR sets the buffer size to
491 4096.
492 .PP
493 \fBTcl_NotifyChannel\fR is called by a channel driver to indicate to
494 the generic layer that the events specified by \fImask\fR have
495 occurred on the channel.  Channel drivers are responsible for invoking
496 this function whenever the channel handlers need to be called for the
497 channel.  See \fBWATCHPROC\fR below for more details.
498 .PP
499 \fBTcl_BadChannelOption\fR is called from driver specific set or get option
500 procs to generate a complete error message.
501 .PP
502 \fBTcl_ChannelBuffered\fR returns the number of bytes of input
503 currently buffered in the internal buffer (push back area) of the
504 channel itself. It does not report about the data in the overall
505 buffers for the stack of channels the supplied channel is part of.
506 .PP
507 .VS 8.4
508 \fBTcl_IsChannelShared\fR checks the refcount of the specified
509 \fIchannel\fR and returns whether the \fIchannel\fR was shared among
510 multiple interpreters (result == 1) or not (result == 0).
511 .PP
512 \fBTcl_IsChannelRegistered\fR checks whether the specified \fIchannel\fR is
513 registered in the given \fIinterp\fRreter (result == 1) or not
514 (result == 0).
515 .PP
516 \fBTcl_IsChannelExisting\fR checks whether a channel with the specified
517 name is registered in the (thread)-global list of all channels (result
518 == 1) or not (result == 0).
519 .PP
520 \fBTcl_CutChannel\fR removes the specified \fIchannel\fR from the
521 (thread)global list of all channels (of the current thread).
522 Application to a channel still registered in some interpreter
523 is not allowed.
524 .PP
525 \fBTcl_SpliceChannel\fR adds the specified \fIchannel\fR to the
526 (thread)global list of all channels (of the current thread).
527 Application to a channel registered in some interpreter is not allowed.
528 .PP
529 \fBTcl_ClearChannelHandlers\fR removes all channelhandlers and event
530 scripts associated with the specified \fIchannel\fR, thus shutting
531 down all event processing for this channel.
532 .VE 8.4
533
534 .SH TCL_CHANNELTYPE
535 .PP
536 A channel driver provides a \fBTcl_ChannelType\fR structure that contains
537 pointers to functions that implement the various operations on a channel;
538 these operations are invoked as needed by the generic layer.  The structure
539 was versioned starting in Tcl 8.3.2/8.4 to correct a problem with stacked
540 channel drivers.  See the \fBOLD CHANNEL TYPES\fR section below for
541 details about the old structure.
542 .PP
543 The \fBTcl_ChannelType\fR structure contains the following fields:
544 .CS
545 typedef struct Tcl_ChannelType {
546         char *\fItypeName\fR;
547         Tcl_ChannelTypeVersion \fIversion\fR;
548         Tcl_DriverCloseProc *\fIcloseProc\fR;
549         Tcl_DriverInputProc *\fIinputProc\fR;
550         Tcl_DriverOutputProc *\fIoutputProc\fR;
551         Tcl_DriverSeekProc *\fIseekProc\fR;
552         Tcl_DriverSetOptionProc *\fIsetOptionProc\fR;
553         Tcl_DriverGetOptionProc *\fIgetOptionProc\fR;
554         Tcl_DriverWatchProc *\fIwatchProc\fR;
555         Tcl_DriverGetHandleProc *\fIgetHandleProc\fR;
556         Tcl_DriverClose2Proc *\fIclose2Proc\fR;
557         Tcl_DriverBlockModeProc *\fIblockModeProc\fR;   
558         Tcl_DriverFlushProc *\fIflushProc\fR;   
559         Tcl_DriverHandlerProc *\fIhandlerProc\fR;       
560         Tcl_DriverWideSeekProc *\fIwideSeekProc\fR;
561 } Tcl_ChannelType;
562 .CE
563 .PP
564 The driver must provide implementations for all functions except
565 \fIblockModeProc\fR, \fIseekProc\fR, \fIsetOptionProc\fR,
566 \fIgetOptionProc\fR, and \fIclose2Proc\fR, which may be specified as
567 NULL.  Other functions that can not be implemented for this type of
568 device should return \fBEINVAL\fR when invoked to indicate that they
569 are not implemented, except in the case of \fIflushProc\fR and
570 \fIhandlerProc\fR, which should specified as NULL if not otherwise defined.
571 .PP
572 The user should only use the above structure for \fBTcl_ChannelType\fR
573 instantiation.  When referencing fields in a \fBTcl_ChannelType\fR
574 structure, the following functions should be used to obtain the values:
575 \fBTcl_ChannelName\fR, \fBTcl_ChannelVersion\fR,
576 \fBTcl_ChannelBlockModeProc\fR, \fBTcl_ChannelCloseProc\fR,
577 \fBTcl_ChannelClose2Proc\fR, \fBTcl_ChannelInputProc\fR,
578 \fBTcl_ChannelOutputProc\fR, \fBTcl_ChannelSeekProc\fR,
579 .VS 8.4
580 \fBTcl_ChannelWideSeekProc\fR,
581 .VE 8.4
582 \fBTcl_ChannelSetOptionProc\fR, \fBTcl_ChannelGetOptionProc\fR,
583 \fBTcl_ChannelWatchProc\fR, \fBTcl_ChannelGetHandleProc\fR,
584 \fBTcl_ChannelFlushProc\fR, or \fBTcl_ChannelHandlerProc\fR.
585 .PP
586 The change to the structures was made in such a way that standard channel
587 types are binary compatible.  However, channel types that use stacked
588 channels (ie: TLS, Trf) have new versions to correspond to the above change
589 since the previous code for stacked channels had problems.
590
591 .SH TYPENAME
592 .PP
593 The \fItypeName\fR field contains a null-terminated string that
594 identifies the type of the device implemented by this driver, e.g.
595 \fBfile\fR or \fBsocket\fR.
596 .PP
597 This value can be retrieved with \fBTcl_ChannelName\fR, which returns
598 a pointer to the string.
599
600 .SH VERSION
601 .PP
602 The \fIversion\fR field should be set to \fBTCL_CHANNEL_VERSION_2\fR.
603 If it is not set to this value \fBTCL_CHANNEL_VERSION_3\fR, then this
604 \fBTcl_ChannelType\fR is assumed to have the older structure.  See
605 \fBOLD CHANNEL TYPES\fR for more details.  While Tcl will recognize
606 and function with either structure, stacked channels must be of at
607 least \fBTCL_CHANNEL_VERSION_2\fR to function correctly.
608 .PP
609 This value can be retrieved with \fBTcl_ChannelVersion\fR, which returns
610 .VS 8.4
611 one of \fBTCL_CHANNEL_VERSION_3\fR,
612 .VE 8.4
613 \fBTCL_CHANNEL_VERSION_2\fR or \fBTCL_CHANNEL_VERSION_1\fR.
614
615 .SH BLOCKMODEPROC
616 .PP
617 The \fIblockModeProc\fR field contains the address of a function called by
618 the generic layer to set blocking and nonblocking mode on the device.
619 \fIBlockModeProc\fR should match the following prototype:
620 .PP
621 .CS
622 typedef int Tcl_DriverBlockModeProc(
623         ClientData \fIinstanceData\fR,
624         int \fImode\fR);
625 .CE
626 .PP
627 The \fIinstanceData\fR is the same as the value passed to
628 \fBTcl_CreateChannel\fR when this channel was created.  The \fImode\fR
629 argument is either \fBTCL_MODE_BLOCKING\fR or \fBTCL_MODE_NONBLOCKING\fR to
630 set the device into blocking or nonblocking mode. The function should
631 return zero if the operation was successful, or a nonzero POSIX error code
632 if the operation failed.
633 .PP
634 If the operation is successful, the function can modify the supplied
635 \fIinstanceData\fR to record that the channel entered blocking or
636 nonblocking mode and to implement the blocking or nonblocking behavior.
637 For some device types, the blocking and nonblocking behavior can be
638 implemented by the underlying operating system; for other device types, the
639 behavior must be emulated in the channel driver.
640 .PP
641 This value can be retrieved with \fBTcl_ChannelBlockModeProc\fR, which returns
642 a pointer to the function.
643
644 .SH "CLOSEPROC AND CLOSE2PROC"
645 .PP
646 The \fIcloseProc\fR field contains the address of a function called by the
647 generic layer to clean up driver-related information when the channel is
648 closed. \fICloseProc\fR must match the following prototype:
649 .PP
650 .CS
651 typedef int Tcl_DriverCloseProc(
652         ClientData \fIinstanceData\fR,
653         Tcl_Interp *\fIinterp\fR);
654 .CE
655 .PP
656 The \fIinstanceData\fR argument is the same as the value provided to
657 \fBTcl_CreateChannel\fR when the channel was created. The function should
658 release any storage maintained by the channel driver for this channel, and
659 close the input and output devices encapsulated by this channel. All queued
660 output will have been flushed to the device before this function is called,
661 and no further driver operations will be invoked on this instance after
662 calling the \fIcloseProc\fR. If the close operation is successful, the
663 procedure should return zero; otherwise it should return a nonzero POSIX
664 error code. In addition, if an error occurs and \fIinterp\fR is not NULL,
665 the procedure should store an error message in the interpreter's result.
666 .PP
667 Alternatively, channels that support closing the read and write sides
668 independently may set \fIcloseProc\fR to \fBTCL_CLOSE2PROC\fR and set
669 \fIclose2Proc\fR to the address of a function that matches the
670 following prototype:
671 .PP
672 .CS
673 typedef int Tcl_DriverClose2Proc(
674         ClientData \fIinstanceData\fR,
675         Tcl_Interp *\fIinterp\fR,
676         int \fIflags\fR);
677 .CE
678 .PP
679 The \fIclose2Proc\fR will be called with \fIflags\fR set to an OR'ed
680 combination of \fBTCL_CLOSE_READ\fR or \fBTCL_CLOSE_WRITE\fR to
681 indicate that the driver should close the read and/or write side of
682 the channel.  The channel driver may be invoked to perform
683 additional operations on the channel after \fIclose2Proc\fR is
684 called to close one or both sides of the channel.  If \fIflags\fR is
685 \fB0\fR (zero), the driver should close the channel in the manner
686 described above for \fIcloseProc\fR.  No further operations will be
687 invoked on this instance after \fIclose2Proc\fR is called with all
688 flags cleared.  In all cases, the \fIclose2Proc\fR function should
689 return zero if the close operation was successful; otherwise it should
690 return a nonzero POSIX error code. In addition, if an error occurs and
691 \fIinterp\fR is not NULL, the procedure should store an error message
692 in the interpreter's result.
693 .PP
694 These value can be retrieved with \fBTcl_ChannelCloseProc\fR or
695 \fBTcl_ChannelClose2Proc\fR, which returns a pointer to the respective
696 function.
697
698 .SH INPUTPROC
699 .PP
700 The \fIinputProc\fR field contains the address of a function called by the
701 generic layer to read data from the file or device and store it in an
702 internal buffer. \fIInputProc\fR must match the following prototype:
703 .PP
704 .CS
705 typedef int Tcl_DriverInputProc(
706         ClientData \fIinstanceData\fR,
707         char *\fIbuf\fR,
708         int \fIbufSize\fR,
709         int *\fIerrorCodePtr\fR);
710 .CE
711 .PP
712 \fIInstanceData\fR is the same as the value passed to
713 \fBTcl_CreateChannel\fR when the channel was created.  The \fIbuf\fR
714 argument points to an array of bytes in which to store input from the
715 device, and the \fIbufSize\fR argument indicates how many bytes are
716 available at \fIbuf\fR.
717 .PP
718 The \fIerrorCodePtr\fR argument points to an integer variable provided by
719 the generic layer. If an error occurs, the function should set the variable
720 to a POSIX error code that identifies the error that occurred.
721 .PP
722 The function should read data from the input device encapsulated by the
723 channel and store it at \fIbuf\fR.  On success, the function should return
724 a nonnegative integer indicating how many bytes were read from the input
725 device and stored at \fIbuf\fR. On error, the function should return -1. If
726 an error occurs after some data has been read from the device, that data is
727 lost.
728 .PP
729 If \fIinputProc\fR can determine that the input device has some data
730 available but less than requested by the \fIbufSize\fR argument, the
731 function should only attempt to read as much data as is available and
732 return without blocking. If the input device has no data available
733 whatsoever and the channel is in nonblocking mode, the function should
734 return an \fBEAGAIN\fR error. If the input device has no data available
735 whatsoever and the channel is in blocking mode, the function should block
736 for the shortest possible time until at least one byte of data can be read
737 from the device; then, it should return as much data as it can read without
738 blocking.
739 .PP
740 This value can be retrieved with \fBTcl_ChannelInputProc\fR, which returns
741 a pointer to the function.
742
743 .SH OUTPUTPROC
744 .PP
745 The \fIoutputProc\fR field contains the address of a function called by the
746 generic layer to transfer data from an internal buffer to the output device.
747 \fIOutputProc\fR must match the following prototype:
748 .PP
749 .CS
750 typedef int Tcl_DriverOutputProc(
751         ClientData \fIinstanceData\fR,
752         CONST char *\fIbuf\fR,
753         int \fItoWrite\fR,
754         int *\fIerrorCodePtr\fR);
755 .CE
756 .PP
757 \fIInstanceData\fR is the same as the value passed to
758 \fBTcl_CreateChannel\fR when the channel was created. The \fIbuf\fR
759 argument contains an array of bytes to be written to the device, and the
760 \fItoWrite\fR argument indicates how many bytes are to be written from the
761 \fIbuf\fR argument.
762 .PP
763 The \fIerrorCodePtr\fR argument points to an integer variable provided by
764 the generic layer. If an error occurs, the function should set this
765 variable to a POSIX error code that identifies the error.
766 .PP
767 The function should write the data at \fIbuf\fR to the output device
768 encapsulated by the channel. On success, the function should return a
769 nonnegative integer indicating how many bytes were written to the output
770 device.  The return value is normally the same as \fItoWrite\fR, but may be
771 less in some cases such as if the output operation is interrupted by a
772 signal. If an error occurs the function should return -1.  In case of
773 error, some data may have been written to the device.
774 .PP
775 If the channel is nonblocking and the output device is unable to absorb any
776 data whatsoever, the function should return -1 with an \fBEAGAIN\fR error
777 without writing any data.
778 .PP
779 This value can be retrieved with \fBTcl_ChannelOutputProc\fR, which returns
780 a pointer to the function.
781
782 .SH "SEEKPROC AND WIDESEEKPROC"
783 .PP
784 The \fIseekProc\fR field contains the address of a function called by the
785 generic layer to move the access point at which subsequent input or output
786 operations will be applied. \fISeekProc\fR must match the following
787 prototype:
788 .PP
789 .CS
790 typedef int Tcl_DriverSeekProc(
791         ClientData \fIinstanceData\fR,
792         long \fIoffset\fR,
793         int \fIseekMode\fR,
794         int *\fIerrorCodePtr\fR);
795 .CE
796 .PP
797 The \fIinstanceData\fR argument is the same as the value given to
798 \fBTcl_CreateChannel\fR when this channel was created.  \fIOffset\fR and
799 \fIseekMode\fR have the same meaning as for the \fBTcl_Seek\fR
800 procedure (described in the manual entry for \fBTcl_OpenFileChannel\fR).
801 .PP
802 The \fIerrorCodePtr\fR argument points to an integer variable provided by
803 the generic layer for returning \fBerrno\fR values from the function.  The
804 function should set this variable to a POSIX error code if an error occurs.
805 The function should store an \fBEINVAL\fR error code if the channel type
806 does not implement seeking.
807 .PP
808 The return value is the new access point or -1 in case of error. If an
809 error occurred, the function should not move the access point.
810 .PP
811 .VS 8.4
812 If there is a non-NULL \fIseekProc\fR field, the \fIwideSeekProc\fR
813 field may contain the address of an alternative function to use which
814 handles wide (i.e. larger than 32-bit) offsets, so allowing seeks
815 within files larger than 2GB.  The \fIwideSeekProc\fR will be called
816 in preference to the \fIseekProc\fR, but both must be defined if the
817 \fIwideSeekProc\fR is defined.  \fIWideSeekProc\fR must match the
818 following prototype:
819 .PP
820 .CS
821 typedef Tcl_WideInt Tcl_DriverWideSeekProc(
822         ClientData \fIinstanceData\fR,
823         Tcl_WideInt \fIoffset\fR,
824         int \fIseekMode\fR,
825         int *\fIerrorCodePtr\fR);
826 .CE
827 .PP
828 The arguments and return values mean the same thing as with
829 \fIseekProc\fR above, except that the type of offsets and the return
830 type are different.
831 .PP
832 The \fIseekProc\fR value can be retrieved with
833 \fBTcl_ChannelSeekProc\fR, which returns a pointer to the function,
834 and similarly the \fIwideSeekProc\fR can be retrieved with
835 \fBTcl_ChannelWideSeekProc\fR.
836 .VE 8.4
837
838 .SH SETOPTIONPROC
839 .PP
840 The \fIsetOptionProc\fR field contains the address of a function called by
841 the generic layer to set a channel type specific option on a channel.
842 \fIsetOptionProc\fR must match the following prototype:
843 .PP
844 .CS
845 typedef int Tcl_DriverSetOptionProc(
846         ClientData \fIinstanceData\fR,
847         Tcl_Interp *\fIinterp\fR,
848         CONST char *\fIoptionName\fR,
849         CONST char *\fInewValue\fR);
850 .CE
851 .PP
852 \fIoptionName\fR is the name of an option to set, and \fInewValue\fR is
853 the new value for that option, as a string. The \fIinstanceData\fR is the
854 same as the value given to \fBTcl_CreateChannel\fR when this channel was
855 created. The function should do whatever channel type specific action is
856 required to implement the new value of the option.
857 .PP
858 Some options are handled by the generic code and this function is never
859 called to set them, e.g. \fB-blockmode\fR. Other options are specific to
860 each channel type and the \fIsetOptionProc\fR procedure of the channel
861 driver will get called to implement them. The \fIsetOptionProc\fR field can
862 be NULL, which indicates that this channel type supports no type specific
863 options. 
864 .PP
865 If the option value is successfully modified to the new value, the function
866 returns \fBTCL_OK\fR.
867 It should call \fBTcl_BadChannelOption\fR which itself returns
868 \fBTCL_ERROR\fR if the \fIoptionName\fR is
869 unrecognized. 
870 If \fInewValue\fR specifies a value for the option that
871 is not supported or if a system call error occurs,
872 the function should leave an error message in the
873 \fIresult\fR field of \fIinterp\fR if \fIinterp\fR is not NULL. The
874 function should also call \fBTcl_SetErrno\fR to store an appropriate POSIX
875 error code.
876 .PP
877 This value can be retrieved with \fBTcl_ChannelSetOptionProc\fR, which returns
878 a pointer to the function.
879
880 .SH GETOPTIONPROC
881 .PP
882 The \fIgetOptionProc\fR field contains the address of a function called by
883 the generic layer to get the value of a channel type specific option on a
884 channel. \fIgetOptionProc\fR must match the following prototype:
885 .PP
886 .CS
887 typedef int Tcl_DriverGetOptionProc(
888         ClientData \fIinstanceData\fR,
889         Tcl_Interp *\fIinterp\fR,
890         CONST char *\fIoptionName\fR,
891         Tcl_DString *\fIoptionValue\fR);
892 .CE
893 .PP
894 \fIOptionName\fR is the name of an option supported by this type of
895 channel. If the option name is not NULL, the function stores its current
896 value, as a string, in the Tcl dynamic string \fIoptionValue\fR.
897 If \fIoptionName\fR is NULL, the function stores in \fIoptionValue\fR an
898 alternating list of all supported options and their current values.
899 On success, the function returns \fBTCL_OK\fR. 
900 It should call \fBTcl_BadChannelOption\fR which itself returns
901 \fBTCL_ERROR\fR if the \fIoptionName\fR is
902 unrecognized. If a system call error occurs,
903 the function should leave an error message in the
904 result of \fIinterp\fR if \fIinterp\fR is not NULL. The
905 function should also call \fBTcl_SetErrno\fR to store an appropriate POSIX
906 error code.
907 .PP
908 Some options are handled by the generic code and this function is never
909 called to retrieve their value, e.g. \fB-blockmode\fR. Other options are
910 specific to each channel type and the \fIgetOptionProc\fR procedure of the
911 channel driver will get called to implement them. The \fIgetOptionProc\fR
912 field can be NULL, which indicates that this channel type supports no type
913 specific options.
914 .PP
915 This value can be retrieved with \fBTcl_ChannelGetOptionProc\fR, which returns
916 a pointer to the function.
917
918 .SH WATCHPROC
919 .PP
920 The \fIwatchProc\fR field contains the address of a function called
921 by the generic layer to initialize the event notification mechanism to
922 notice events of interest on this channel.
923 \fIWatchProc\fR should match the following prototype:
924 .PP
925 .CS
926 typedef void Tcl_DriverWatchProc(
927         ClientData \fIinstanceData\fR,
928         int \fImask\fR);
929 .CE
930 .PP
931 The \fIinstanceData\fR is the same as the value passed to
932 \fBTcl_CreateChannel\fR when this channel was created. The \fImask\fR
933 argument is an OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR
934 and \fBTCL_EXCEPTION\fR; it indicates events the caller is interested in
935 noticing on this channel.
936 .PP
937 The function should initialize device type specific mechanisms to
938 notice when an event of interest is present on the channel.  When one
939 or more of the designated events occurs on the channel, the channel
940 driver is responsible for calling \fBTcl_NotifyChannel\fR to inform
941 the generic channel module.  The driver should take care not to starve
942 other channel drivers or sources of callbacks by invoking
943 Tcl_NotifyChannel too frequently.  Fairness can be insured by using
944 the Tcl event queue to allow the channel event to be scheduled in sequence
945 with other events.  See the description of \fBTcl_QueueEvent\fR for
946 details on how to queue an event.
947 .PP
948 This value can be retrieved with \fBTcl_ChannelWatchProc\fR, which returns
949 a pointer to the function.
950
951 .SH GETHANDLEPROC
952 .PP
953 The \fIgetHandleProc\fR field contains the address of a function called by
954 the generic layer to retrieve a device-specific handle from the channel.
955 \fIGetHandleProc\fR should match the following prototype:
956 .PP
957 .CS
958 typedef int Tcl_DriverGetHandleProc(
959         ClientData \fIinstanceData\fR,
960         int \fIdirection\fR,
961         ClientData *\fIhandlePtr\fR);
962 .CE
963 .PP
964 \fIInstanceData\fR is the same as the value passed to
965 \fBTcl_CreateChannel\fR when this channel was created. The \fIdirection\fR
966 argument is either \fBTCL_READABLE\fR to retrieve the handle used
967 for input, or \fBTCL_WRITABLE\fR to retrieve the handle used for
968 output.
969 .PP
970 If the channel implementation has device-specific handles, the
971 function should retrieve the appropriate handle associated with the
972 channel, according the \fIdirection\fR argument.  The handle should be
973 stored in the location referred to by \fIhandlePtr\fR, and
974 \fBTCL_OK\fR should be returned.  If the channel is not open for the
975 specified direction, or if the channel implementation does not use
976 device handles, the function should return \fBTCL_ERROR\fR.
977 .PP
978 This value can be retrieved with \fBTcl_ChannelGetHandleProc\fR, which returns
979 a pointer to the function.
980
981 .SH FLUSHPROC
982 .PP
983 The \fIflushProc\fR field is currently reserved for future use.
984 It should be set to NULL.
985 \fIFlushProc\fR should match the following prototype:
986 .PP
987 .CS
988 typedef int Tcl_DriverFlushProc(
989         ClientData \fIinstanceData\fR);
990 .CE
991 .PP
992 This value can be retrieved with \fBTcl_ChannelFlushProc\fR, which returns
993 a pointer to the function.
994
995 .SH HANDLERPROC
996 .PP
997 The \fIhandlerProc\fR field contains the address of a function called by
998 the generic layer to notify the channel that an event occurred.  It should
999 be defined for stacked channel drivers that wish to be notified of events
1000 that occur on the underlying (stacked) channel.
1001 \fIHandlerProc\fR should match the following prototype:
1002 .PP
1003 .CS
1004 typedef int Tcl_DriverHandlerProc(
1005         ClientData \fIinstanceData\fR,
1006         int \fIinterestMask\fR);
1007 .CE
1008 .PP
1009 \fIInstanceData\fR is the same as the value passed to \fBTcl_CreateChannel\fR
1010 when this channel was created.  The \fIinterestMask\fR is an OR-ed
1011 combination of \fBTCL_READABLE\fR or \fBTCL_WRITABLE\fR; it indicates what
1012 type of event occurred on this channel.
1013 .PP
1014 This value can be retrieved with \fBTcl_ChannelHandlerProc\fR, which returns
1015 a pointer to the function.
1016
1017 .SH TCL_BADCHANNELOPTION
1018 .PP
1019 This procedure generates a "bad option" error message in an
1020 (optional) interpreter.  It is used by channel drivers when 
1021 a invalid Set/Get option is requested. Its purpose is to concatenate
1022 the generic options list to the specific ones and factorize
1023 the generic options error message string.
1024 .PP
1025 It always return \fBTCL_ERROR\fR
1026 .PP
1027 An error message is generated in \fIinterp\fR's result object to
1028 indicate that a command was invoked with the a bad option
1029 The message has the form
1030 .CS
1031     bad option "blah": should be one of 
1032     <...generic options...>+<...specific options...>
1033 so you get for instance:
1034     bad option "-blah": should be one of -blocking,
1035     -buffering, -buffersize, -eofchar, -translation,
1036     -peername, or -sockname
1037 when called with \fIoptionList\fR="peername sockname"
1038 .CE
1039 ``blah'' is the \fIoptionName\fR argument and ``<specific options>''
1040 is a space separated list of specific option words.
1041 The function takes good care of inserting minus signs before
1042 each option, commas after, and an ``or'' before the last option.
1043
1044 .SH "OLD CHANNEL TYPES"
1045
1046 The original (8.3.1 and below) \fBTcl_ChannelType\fR structure contains
1047 the following fields:
1048 .PP
1049 .CS
1050 typedef struct Tcl_ChannelType {
1051         char *\fItypeName\fR;
1052         Tcl_DriverBlockModeProc *\fIblockModeProc\fR;   
1053         Tcl_DriverCloseProc *\fIcloseProc\fR;
1054         Tcl_DriverInputProc *\fIinputProc\fR;
1055         Tcl_DriverOutputProc *\fIoutputProc\fR;
1056         Tcl_DriverSeekProc *\fIseekProc\fR;
1057         Tcl_DriverSetOptionProc *\fIsetOptionProc\fR;
1058         Tcl_DriverGetOptionProc *\fIgetOptionProc\fR;
1059         Tcl_DriverWatchProc *\fIwatchProc\fR;
1060         Tcl_DriverGetHandleProc *\fIgetHandleProc\fR;
1061         Tcl_DriverClose2Proc *\fIclose2Proc\fR;
1062 } Tcl_ChannelType;
1063 .CE
1064 .PP
1065 It is still possible to create channel with the above structure.  The
1066 internal channel code will determine the version.  It is imperative to use
1067 the new \fBTcl_ChannelType\fR structure if you are creating a stacked
1068 channel driver, due to problems with the earlier stacked channel
1069 implementation (in 8.2.0 to 8.3.1).
1070 .PP
1071 .VS 8.4
1072 Prior to 8.4.0 (i.e. during the later releases of 8.3 and early part
1073 of the 8.4 development cycle) the \fBTcl_ChannelType\fR structure
1074 contained the following fields:
1075 .PP
1076 .CS
1077 typedef struct Tcl_ChannelType {
1078         char *\fItypeName\fR;
1079         Tcl_ChannelTypeVersion \fIversion\fR;
1080         Tcl_DriverCloseProc *\fIcloseProc\fR;
1081         Tcl_DriverInputProc *\fIinputProc\fR;
1082         Tcl_DriverOutputProc *\fIoutputProc\fR;
1083         Tcl_DriverSeekProc *\fIseekProc\fR;
1084         Tcl_DriverSetOptionProc *\fIsetOptionProc\fR;
1085         Tcl_DriverGetOptionProc *\fIgetOptionProc\fR;
1086         Tcl_DriverWatchProc *\fIwatchProc\fR;
1087         Tcl_DriverGetHandleProc *\fIgetHandleProc\fR;
1088         Tcl_DriverClose2Proc *\fIclose2Proc\fR;
1089         Tcl_DriverBlockModeProc *\fIblockModeProc\fR;   
1090         Tcl_DriverFlushProc *\fIflushProc\fR;   
1091         Tcl_DriverHandlerProc *\fIhandlerProc\fR;       
1092 } Tcl_ChannelType;
1093 .CE
1094 .PP
1095 When the above structure is registered as a channel type, the
1096 \fIversion\fR field should always be \fBTCL_CHANNEL_VERSION_2\fR.
1097 .VE 8.4
1098
1099 .SH "SEE ALSO"
1100 Tcl_Close(3), Tcl_OpenFileChannel(3), Tcl_SetErrno(3), Tcl_QueueEvent(3), Tcl_StackChannel(3), Tcl_GetStdChannel(3)
1101
1102 .SH KEYWORDS
1103 blocking, channel driver, channel registration, channel type, nonblocking