19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
+
+
+
+
|
#include "tlsInt.h"
/*
* Forward declarations
*/
static int TlsBlockModeProc (ClientData instanceData, int mode);
#if TCL_MAJOR_VERSION < 9
static int TlsCloseProc (ClientData instanceData, Tcl_Interp *interp);
#else
static int TlsClose2Proc (ClientData instanceData, Tcl_Interp *interp, int flags);
#endif
static int TlsInputProc (ClientData instanceData, char *buf, int bufSize, int *errorCodePtr);
static int TlsOutputProc (ClientData instanceData, const char *buf, int toWrite, int *errorCodePtr);
static int TlsGetOptionProc (ClientData instanceData, Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr);
static void TlsWatchProc (ClientData instanceData, int mask);
static int TlsGetHandleProc (ClientData instanceData, int direction, ClientData *handlePtr);
static int TlsNotifyProc (ClientData instanceData, int mask);
#if 0
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
+
+
+
+
|
/*
* Common elements of the structure (no changes in location or name)
* close2Proc, seekProc, setOptionProc stay NULL.
*/
tlsChannelType->typeName = "tls";
#if TCL_MAJOR_VERSION < 9
tlsChannelType->closeProc = TlsCloseProc;
#else
tlsChannelType->close2Proc = TlsClose2Proc;
#endif
tlsChannelType->inputProc = TlsInputProc;
tlsChannelType->outputProc = TlsOutputProc;
tlsChannelType->getOptionProc = TlsGetOptionProc;
tlsChannelType->watchProc = TlsWatchProc;
tlsChannelType->getHandleProc = TlsGetHandleProc;
/*
|
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
|
*
* Side effects:
* Closes the socket of the channel.
*
*-------------------------------------------------------------------
*/
static int TlsCloseProc(ClientData instanceData, Tcl_Interp *interp) {
State *statePtr = (State *) instanceData;
dprintf("TlsCloseProc(%p)", (void *) statePtr);
Tls_Clean(statePtr);
Tcl_EventuallyFree((ClientData)statePtr, Tls_Free);
dprintf("Returning TCL_OK");
return(TCL_OK);
/* Interp is unused. */
interp = interp;
}
static int TlsClose2Proc(ClientData instanceData, Tcl_Interp *interp, int flags) {
if ((flags & (TCL_CLOSE_READ|TCL_CLOSE_WRITE)) == 0) {
State *statePtr = (State *) instanceData;
dprintf("TlsCloseProc(%p)", (void *) statePtr);
Tls_Clean(statePtr);
Tcl_EventuallyFree((ClientData)statePtr, Tls_Free);
dprintf("Returning TCL_OK");
return(TCL_OK);
/* Interp is unused. */
interp = interp;
}
/* Interp is unused. */
interp = interp;
}
/*
*------------------------------------------------------*
*
* Tls_WaitForConnect --
*
|