18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
*/
#include "tlsInt.h"
/*
* Forward declarations
*/
static int TlsBlockModeProc _ANSI_ARGS_((ClientData instanceData, int mode));
static int TlsCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp));
static int TlsInputProc _ANSI_ARGS_((ClientData instanceData, char *buf, int bufSize, int *errorCodePtr));
static int TlsOutputProc _ANSI_ARGS_((ClientData instanceData, CONST char *buf, int toWrite, int *errorCodePtr));
static int TlsGetOptionProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp, CONST84 char *optionName, Tcl_DString *dsPtr));
static void TlsWatchProc _ANSI_ARGS_((ClientData instanceData, int mask));
static int TlsGetHandleProc _ANSI_ARGS_((ClientData instanceData, int direction, ClientData *handlePtr));
static int TlsNotifyProc _ANSI_ARGS_((ClientData instanceData, int mask));
#if 0
static void TlsChannelHandler _ANSI_ARGS_((ClientData clientData, int mask));
#endif
static void TlsChannelHandlerTimer _ANSI_ARGS_((ClientData clientData));
/*
* TLS Channel Type
*/
static Tcl_ChannelType *tlsChannelType = NULL;
/*
|
|
|
|
|
|
|
|
|
|
|
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
*/
#include "tlsInt.h"
/*
* Forward declarations
*/
static int TlsBlockModeProc (ClientData instanceData, int mode);
static int TlsCloseProc (ClientData instanceData, Tcl_Interp *interp);
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
static void TlsChannelHandler (ClientData clientData, int mask);
#endif
static void TlsChannelHandlerTimer (ClientData clientData);
/*
* TLS Channel Type
*/
static Tcl_ChannelType *tlsChannelType = NULL;
/*
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
* (2) With stubs we just determine the difference between the older
* and modern variant and overallocate accordingly if compiled
* against an older variant.
*/
size = sizeof(Tcl_ChannelType); /* Base size */
tlsChannelType = (Tcl_ChannelType *) ckalloc(size);
memset((VOID *) tlsChannelType, 0, size);
/*
* Common elements of the structure (no changes in location or name)
* close2Proc, seekProc, setOptionProc stay NULL.
*/
tlsChannelType->typeName = "tls";
|
|
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
* (2) With stubs we just determine the difference between the older
* and modern variant and overallocate accordingly if compiled
* against an older variant.
*/
size = sizeof(Tcl_ChannelType); /* Base size */
tlsChannelType = (Tcl_ChannelType *) ckalloc(size);
memset(tlsChannelType, 0, size);
/*
* Common elements of the structure (no changes in location or name)
* close2Proc, seekProc, setOptionProc stay NULL.
*/
tlsChannelType->typeName = "tls";
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/*
* For the 8.3.2 core we present ourselves as a version 2
* driver. This means a special value in version (ex
* blockModeProc), blockModeProc in a different place and of
* course usage of the handlerProc.
*/
tlsChannelType->version = TCL_CHANNEL_VERSION_2;
tlsChannelType->blockModeProc = TlsBlockModeProc;
tlsChannelType->handlerProc = TlsNotifyProc;
}
return(tlsChannelType);
}
|
|
|
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/*
* For the 8.3.2 core we present ourselves as a version 2
* driver. This means a special value in version (ex
* blockModeProc), blockModeProc in a different place and of
* course usage of the handlerProc.
*/
tlsChannelType->version = TCL_CHANNEL_VERSION_5;
tlsChannelType->blockModeProc = TlsBlockModeProc;
tlsChannelType->handlerProc = TlsNotifyProc;
}
return(tlsChannelType);
}
|
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
|
*
* Side effects:
* Writes output on the output device of the channel.
*
*-------------------------------------------------------------------
*/
static int TlsOutputProc(ClientData instanceData, CONST char *buf, int toWrite, int *errorCodePtr) {
unsigned long backingError;
State *statePtr = (State *) instanceData;
int written, err;
int tlsConnect;
*errorCodePtr = 0;
|
|
|
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
|
*
* Side effects:
* Writes output on the output device of the channel.
*
*-------------------------------------------------------------------
*/
static int TlsOutputProc(ClientData instanceData, const char *buf, int toWrite, int *errorCodePtr) {
unsigned long backingError;
State *statePtr = (State *) instanceData;
int written, err;
int tlsConnect;
*errorCodePtr = 0;
|
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
|
* None.
*
*-------------------------------------------------------------------
*/
static int
TlsGetOptionProc(ClientData instanceData, /* Socket state. */
Tcl_Interp *interp, /* For errors - can be NULL. */
CONST84 char *optionName, /* Name of the option to
* retrieve the value for, or
* NULL to get all options and
* their values. */
Tcl_DString *dsPtr) /* Where to store the computed value
* initialized by caller. */
{
State *statePtr = (State *) instanceData;
|
|
|
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
|
* None.
*
*-------------------------------------------------------------------
*/
static int
TlsGetOptionProc(ClientData instanceData, /* Socket state. */
Tcl_Interp *interp, /* For errors - can be NULL. */
const char *optionName, /* Name of the option to
* retrieve the value for, or
* NULL to get all options and
* their values. */
Tcl_DString *dsPtr) /* Where to store the computed value
* initialized by caller. */
{
State *statePtr = (State *) instanceData;
|