Diff

Differences From Artifact [cad97cf7a0]:

To Artifact [a2664d9c85]:


34
35
36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
52
34
35
36
37
38
39
40



41


42
43
44
45
46
47
48







-
-
-
+
-
-







static int BioWrite	_ANSI_ARGS_ ((BIO *h, CONST char *buf, int num));
static int BioRead	_ANSI_ARGS_ ((BIO *h, char *buf, int num));
static int BioPuts	_ANSI_ARGS_ ((BIO *h, CONST char *str));
static long BioCtrl	_ANSI_ARGS_ ((BIO *h, int cmd, long arg1, void *ptr));
static int BioNew	_ANSI_ARGS_ ((BIO *h));
static int BioFree	_ANSI_ARGS_ ((BIO *h));

BIO *
BIO_new_tcl(statePtr, flags)
    State *statePtr;
BIO * BIO_new_tcl(State *statePtr, int flags) {
    int flags;
{
    BIO *bio;
    static BIO_METHOD *BioMethods = NULL;

    dprintf("BIO_new_tcl() called");

    if (BioMethods == NULL) {
        BioMethods = BIO_meth_new(BIO_TYPE_TCL, "tcl");
63
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78
79
80
81
82
59
60
61
62
63
64
65

66





67
68
69
70
71
72
73







-
+
-
-
-
-
-







    BIO_set_data(bio, statePtr);
    BIO_set_init(bio, 1);
    BIO_set_shutdown(bio, flags);

    return bio;
}

static int
static int BioWrite(BIO *bio, CONST char *buf, int bufLen) {
BioWrite (bio, buf, bufLen)
    BIO *bio;
    CONST char *buf;
    int bufLen;
{
    Tcl_Channel chan = Tls_GetParent((State*)BIO_get_data(bio));
    int ret;

    dprintf("BioWrite(%p, <buf>, %d) [%p]",
	    (void *) bio, bufLen, (void *) chan);

    if (channelTypeVersion == TLS_CHANNEL_VERSION_2) {
98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
113
114
115
116
117
89
90
91
92
93
94
95

96





97
98
99
100
101
102
103







-
+
-
-
-
-
-







    }
    if (BIO_should_read(bio)) {
	BIO_set_retry_read(bio);
    }
    return ret;
}

static int
static int BioRead(BIO *bio, char *buf, int bufLen) {
BioRead (bio, buf, bufLen)
    BIO *bio;
    char *buf;
    int bufLen;
{
    Tcl_Channel chan = Tls_GetParent((State*)BIO_get_data(bio));
    int ret = 0;
    int tclEofChan;

    dprintf("BioRead(%p, <buf>, %d) [%p]", (void *) bio, bufLen, (void *) chan);

    if (buf == NULL) return 0;
145
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160
161

162
163
164
165
166
167
168
169
170
171
172
173
174
131
132
133
134
135
136
137

138




139
140
141
142

143






144
145
146
147
148
149
150







-
+
-
-
-
-




-
+
-
-
-
-
-
-







    }

    dprintf("BioRead(%p, <buf>, %d) [%p] returning %i", (void *) bio, bufLen, (void *) chan, ret);

    return ret;
}

static int
static int BioPuts(BIO *bio, CONST char *str) {
BioPuts	(bio, str)
    BIO *bio;
    CONST char *str;
{
    dprintf("BioPuts(%p, <string:%p>) called", bio, str);
    return BioWrite(bio, str, (int) strlen(str));
}

static long
static long BioCtrl(BIO *bio, int cmd, long num, void *ptr) {
BioCtrl	(bio, cmd, num, ptr)
    BIO *bio;
    int cmd;
    long num;
    void *ptr;
{
    Tcl_Channel chan = Tls_GetParent((State*)BIO_get_data(bio));
    long ret = 1;

    dprintf("BioCtrl(%p, 0x%x, 0x%x, %p)",
	    (void *) bio, (unsigned int) cmd, (unsigned int) num,
	    (void *) ptr);

221
222
223
224
225
226
227
228

229
230
231
232
233
234
235
236
237
238
239
240
241
242

243
244
245
246
247
248
249
250
251
252
197
198
199
200
201
202
203

204




205
206
207
208
209
210
211
212
213

214



215
216
217
218
219
220
221







-
+
-
-
-
-









-
+
-
-
-







    default:
	ret = 0;
	break;
    }
    return(ret);
}

static int
static int BioNew(BIO *bio) {
BioNew	(bio)
    BIO *bio;
{

    dprintf("BioNew(%p) called", bio);

    BIO_set_init(bio, 0);
    BIO_set_data(bio, NULL);
    BIO_clear_flags(bio, -1);

    return 1;
}

static int
static int BioFree(BIO *bio) {
BioFree	(bio)
    BIO *bio;
{
    if (bio == NULL) {
	return 0;
    }

    dprintf("BioFree(%p) called", bio);

    if (BIO_get_shutdown(bio)) {