1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
/*
* Copyright (C) 1997-2000 Matt Newman <[email protected]>
*
* Provides BIO layer to interface openssl to Tcl.
*/
#include "tlsInt.h"
/*
* Forward declarations
*/
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));
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/*
* Copyright (C) 1997-2000 Matt Newman <[email protected]>
*
* Provides BIO layer to interface openssl to Tcl.
*/
#include "tlsInt.h"
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define BIO_get_data(bio) ((bio)->ptr)
#define BIO_get_init(bio) ((bio)->init)
#define BIO_get_shutdown(bio) ((bio)->shutdown)
#define BIO_set_data(bio, val) (bio)->ptr = (val)
#define BIO_set_init(bio, val) (bio)->init = (val)
#define BIO_set_shutdown(bio, val) (bio)->shutdown = (val)
/* XXX: This assumes the variable being assigned to is BioMethods */
#define BIO_meth_new(type_, name_) (BIO_METHOD *)Tcl_Alloc(sizeof(BIO_METHOD)); \
memset(BioMethods, 0, sizeof(BIO_METHOD)); \
BioMethods->type = type_; \
BioMethods->name = name_;
#define BIO_meth_set_write(bio, val) (bio)->bwrite = val;
#define BIO_meth_set_read(bio, val) (bio)->bread = val;
#define BIO_meth_set_puts(bio, val) (bio)->bputs = val;
#define BIO_meth_set_ctrl(bio, val) (bio)->ctrl = val;
#define BIO_meth_set_create(bio, val) (bio)->create = val;
#define BIO_meth_set_destroy(bio, val) (bio)->destroy = val;
#endif
/*
* Forward declarations
*/
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));
|
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
case BIO_CTRL_FLUSH:
dprintf("BIO_CTRL_FLUSH");
if (channelTypeVersion == TLS_CHANNEL_VERSION_2) {
ret = ((Tcl_WriteRaw(chan, "", 0) >= 0) ? 1 : -1);
} else {
ret = ((Tcl_Flush(chan) == TCL_OK) ? 1 : -1);
}
break;
default:
ret = 0;
break;
}
return(ret);
}
|
>
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
case BIO_CTRL_FLUSH:
dprintf("BIO_CTRL_FLUSH");
if (channelTypeVersion == TLS_CHANNEL_VERSION_2) {
ret = ((Tcl_WriteRaw(chan, "", 0) >= 0) ? 1 : -1);
} else {
ret = ((Tcl_Flush(chan) == TCL_OK) ? 1 : -1);
}
dprintf("BIO_CTRL_FLUSH returning value %li", ret);
break;
default:
ret = 0;
break;
}
return(ret);
}
|