Hex Artifact Content

Artifact 3f35632d0eb0a882eeea6529759a1507e420c88d:


0000: 2f 2a 0a 20 2a 20 43 6f 70 79 72 69 67 68 74 20  /*. * Copyright 
0010: 28 43 29 20 31 39 39 37 2d 32 30 30 30 20 4d 61  (C) 1997-2000 Ma
0020: 74 74 20 4e 65 77 6d 61 6e 20 3c 6d 61 74 74 40  tt Newman <matt@
0030: 6e 6f 76 61 64 69 67 6d 2e 63 6f 6d 3e 0a 20 2a  novadigm.com>. *
0040: 0a 20 2a 20 24 48 65 61 64 65 72 3a 20 2f 68 6f  . * $Header: /ho
0050: 6d 65 2f 72 6b 65 65 6e 65 2f 74 6d 70 2f 63 76  me/rkeene/tmp/cv
0060: 73 32 66 6f 73 73 69 6c 2f 2e 2e 2f 74 63 6c 74  s2fossil/../tclt
0070: 6c 73 2f 74 6c 73 2f 74 6c 73 2f 74 6c 73 49 6e  ls/tls/tls/tlsIn
0080: 74 2e 68 2c 76 20 31 2e 39 20 32 30 30 33 2f 30  t.h,v 1.9 2003/0
0090: 35 2f 31 35 20 32 30 3a 34 34 3a 34 36 20 72 61  5/15 20:44:46 ra
00a0: 7a 7a 65 6c 6c 20 45 78 70 20 24 0a 20 2a 0a 20  zzell Exp $. *. 
00b0: 2a 20 54 4c 53 20 28 61 6b 61 20 53 53 4c 29 20  * TLS (aka SSL) 
00c0: 43 68 61 6e 6e 65 6c 20 2d 20 63 61 6e 20 62 65  Channel - can be
00d0: 20 6c 61 79 65 72 65 64 20 6f 6e 20 61 6e 79 20   layered on any 
00e0: 62 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c 0a 20  bi-directional. 
00f0: 2a 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 28 4e  * Tcl_Channel (N
0100: 6f 74 65 3a 20 52 65 71 75 69 72 65 73 20 54 72  ote: Requires Tr
0110: 66 20 43 6f 72 65 20 50 61 74 63 68 29 0a 20 2a  f Core Patch). *
0120: 0a 20 2a 20 54 68 69 73 20 77 61 73 20 62 75 69  . * This was bui
0130: 6c 74 20 66 72 6f 6d 20 73 63 72 61 74 63 68 20  lt from scratch 
0140: 62 61 73 65 64 20 75 70 6f 6e 20 6f 62 73 65 72  based upon obser
0150: 76 61 74 69 6f 6e 20 6f 66 20 4f 70 65 6e 53 53  vation of OpenSS
0160: 4c 20 30 2e 39 2e 32 42 0a 20 2a 0a 20 2a 20 41  L 0.9.2B. *. * A
0170: 64 64 69 74 69 6f 6e 20 63 72 65 64 69 74 20 69  ddition credit i
0180: 73 20 64 75 65 20 66 6f 72 20 41 6e 64 72 65 61  s due for Andrea
0190: 73 20 4b 75 70 72 69 65 73 20 28 61 2e 6b 75 70  s Kupries (a.kup
01a0: 72 69 65 73 40 77 65 73 74 65 6e 64 2e 63 6f 6d  ries@westend.com
01b0: 29 2c 20 66 6f 72 0a 20 2a 20 70 72 6f 76 69 64  ), for. * provid
01c0: 69 6e 67 20 74 68 65 20 54 63 6c 5f 52 65 70 6c  ing the Tcl_Repl
01d0: 61 63 65 43 68 61 6e 6e 65 6c 20 6d 65 63 68 61  aceChannel mecha
01e0: 6e 69 73 6d 20 61 6e 64 20 77 6f 72 6b 69 6e 67  nism and working
01f0: 20 63 6c 6f 73 65 6c 79 20 77 69 74 68 20 6d 65   closely with me
0200: 0a 20 2a 20 74 6f 20 65 6e 68 61 6e 63 65 20 69  . * to enhance i
0210: 74 20 74 6f 20 73 75 70 70 6f 72 74 20 66 75 6c  t to support ful
0220: 6c 20 66 69 6c 65 65 76 65 6e 74 20 73 65 6d 61  l fileevent sema
0230: 6e 74 69 63 73 2e 0a 20 2a 0a 20 2a 20 41 6c 73  ntics.. *. * Als
0240: 6f 20 77 6f 72 6b 20 64 6f 6e 65 20 62 79 20 74  o work done by t
0250: 68 65 20 66 6f 6c 6c 6f 77 20 70 65 6f 70 6c 65  he follow people
0260: 20 70 72 6f 76 69 64 65 64 20 74 68 65 20 69 6d   provided the im
0270: 70 65 74 75 73 20 74 6f 20 64 6f 20 74 68 69 73  petus to do this
0280: 20 22 72 69 67 68 74 22 3a 2d 0a 20 2a 09 74 63   "right":-. *.tc
0290: 6c 53 53 4c 20 28 43 6f 6c 69 6e 20 4d 63 43 6f  lSSL (Colin McCo
02a0: 72 6d 61 63 6b 2c 20 53 68 61 72 65 64 20 54 65  rmack, Shared Te
02b0: 63 68 6e 6f 6c 6f 67 79 29 0a 20 2a 09 53 53 4c  chnology). *.SSL
02c0: 74 63 6c 20 28 50 65 74 65 72 20 41 6e 74 6d 61  tcl (Peter Antma
02d0: 6e 29 0a 20 2a 0a 20 2a 2f 0a 23 69 66 6e 64 65  n). *. */.#ifnde
02e0: 66 20 5f 54 53 4c 49 4e 54 5f 48 0a 23 64 65 66  f _TSLINT_H.#def
02f0: 69 6e 65 20 5f 54 4c 53 49 4e 54 5f 48 0a 0a 23  ine _TLSINT_H..#
0300: 69 6e 63 6c 75 64 65 20 22 74 6c 73 2e 68 22 0a  include "tls.h".
0310: 23 69 6e 63 6c 75 64 65 20 3c 65 72 72 6e 6f 2e  #include <errno.
0320: 68 3e 0a 0a 23 69 66 64 65 66 20 4e 4f 5f 50 41  h>..#ifdef NO_PA
0330: 54 45 4e 54 53 0a 23 64 65 66 69 6e 65 20 4e 4f  TENTS.#define NO
0340: 5f 49 44 45 41 0a 23 64 65 66 69 6e 65 20 4e 4f  _IDEA.#define NO
0350: 5f 52 43 32 0a 23 64 65 66 69 6e 65 20 4e 4f 5f  _RC2.#define NO_
0360: 52 43 34 0a 23 64 65 66 69 6e 65 20 4e 4f 5f 52  RC4.#define NO_R
0370: 43 35 0a 23 64 65 66 69 6e 65 20 4e 4f 5f 52 53  C5.#define NO_RS
0380: 41 0a 23 64 65 66 69 6e 65 20 4e 4f 5f 53 53 4c  A.#define NO_SSL
0390: 32 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 65 66  2.#endif..#ifdef
03a0: 20 42 53 41 46 45 0a 23 69 6e 63 6c 75 64 65 20   BSAFE.#include 
03b0: 3c 73 73 6c 2e 68 3e 0a 23 69 6e 63 6c 75 64 65  <ssl.h>.#include
03c0: 20 3c 65 72 72 2e 68 3e 0a 23 65 6c 73 65 0a 23   <err.h>.#else.#
03d0: 69 6e 63 6c 75 64 65 20 3c 6f 70 65 6e 73 73 6c  include <openssl
03e0: 2f 73 73 6c 2e 68 3e 0a 23 69 6e 63 6c 75 64 65  /ssl.h>.#include
03f0: 20 3c 6f 70 65 6e 73 73 6c 2f 65 72 72 2e 68 3e   <openssl/err.h>
0400: 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 65 66 20  .#endif..#ifdef 
0410: 54 43 4c 5f 53 54 4f 52 41 47 45 5f 43 4c 41 53  TCL_STORAGE_CLAS
0420: 53 0a 23 20 75 6e 64 65 66 20 54 43 4c 5f 53 54  S.# undef TCL_ST
0430: 4f 52 41 47 45 5f 43 4c 41 53 53 0a 23 65 6e 64  ORAGE_CLASS.#end
0440: 69 66 0a 23 69 66 64 65 66 20 42 55 49 4c 44 5f  if.#ifdef BUILD_
0450: 74 6c 73 0a 23 20 64 65 66 69 6e 65 20 54 43 4c  tls.# define TCL
0460: 5f 53 54 4f 52 41 47 45 5f 43 4c 41 53 53 20 44  _STORAGE_CLASS D
0470: 4c 4c 45 58 50 4f 52 54 0a 23 65 6c 73 65 0a 23  LLEXPORT.#else.#
0480: 20 64 65 66 69 6e 65 20 54 43 4c 5f 53 54 4f 52   define TCL_STOR
0490: 41 47 45 5f 43 4c 41 53 53 20 44 4c 4c 49 4d 50  AGE_CLASS DLLIMP
04a0: 4f 52 54 0a 23 65 6e 64 69 66 0a 20 0a 23 69 66  ORT.#endif. .#if
04b0: 6e 64 65 66 20 45 43 4f 4e 4e 41 42 4f 52 54 45  ndef ECONNABORTE
04c0: 44 0a 23 64 65 66 69 6e 65 20 45 43 4f 4e 4e 41  D.#define ECONNA
04d0: 42 4f 52 54 45 44 09 31 33 30 09 2f 2a 20 53 6f  BORTED.130./* So
04e0: 66 74 77 61 72 65 20 63 61 75 73 65 64 20 63 6f  ftware caused co
04f0: 6e 6e 65 63 74 69 6f 6e 20 61 62 6f 72 74 20 2a  nnection abort *
0500: 2f 0a 23 65 6e 64 69 66 0a 23 69 66 6e 64 65 66  /.#endif.#ifndef
0510: 20 45 43 4f 4e 4e 52 45 53 45 54 0a 23 64 65 66   ECONNRESET.#def
0520: 69 6e 65 20 45 43 4f 4e 4e 52 45 53 45 54 09 31  ine ECONNRESET.1
0530: 33 31 09 2f 2a 20 43 6f 6e 6e 65 63 74 69 6f 6e  31./* Connection
0540: 20 72 65 73 65 74 20 62 79 20 70 65 65 72 20 2a   reset by peer *
0550: 2f 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 65 66  /.#endif..#ifdef
0560: 20 44 45 42 55 47 0a 23 64 65 66 69 6e 65 20 64   DEBUG.#define d
0570: 70 72 69 6e 74 66 20 66 70 72 69 6e 74 66 0a 23  printf fprintf.#
0580: 65 6c 73 65 0a 23 64 65 66 69 6e 65 20 64 70 72  else.#define dpr
0590: 69 6e 74 66 20 69 66 20 28 30 29 20 66 70 72 69  intf if (0) fpri
05a0: 6e 74 66 0a 23 65 6e 64 69 66 0a 0a 23 64 65 66  ntf.#endif..#def
05b0: 69 6e 65 20 53 53 4c 5f 45 52 52 4f 52 28 73 73  ine SSL_ERROR(ss
05c0: 6c 2c 65 72 72 29 09 5c 0a 09 20 20 20 20 28 28  l,err).\..    ((
05d0: 63 68 61 72 2a 29 45 52 52 5f 72 65 61 73 6f 6e  char*)ERR_reason
05e0: 5f 65 72 72 6f 72 5f 73 74 72 69 6e 67 28 53 53  _error_string(SS
05f0: 4c 5f 67 65 74 5f 65 72 72 6f 72 28 28 73 73 6c  L_get_error((ssl
0600: 29 2c 28 65 72 72 29 29 29 29 0a 2f 2a 0a 20 2a  ),(err))))./*. *
0610: 20 4f 70 65 6e 53 53 4c 20 42 49 4f 20 52 6f 75   OpenSSL BIO Rou
0620: 74 69 6e 65 73 0a 20 2a 2f 0a 23 64 65 66 69 6e  tines. */.#defin
0630: 65 20 42 49 4f 5f 54 59 50 45 5f 54 43 4c 09 28  e BIO_TYPE_TCL.(
0640: 31 39 7c 30 78 30 34 30 30 29 0a 0a 2f 2a 0a 20  19|0x0400)../*. 
0650: 2a 20 44 65 66 69 6e 65 73 20 66 6f 72 20 53 74  * Defines for St
0660: 61 74 65 2e 66 6c 61 67 73 0a 20 2a 2f 0a 23 64  ate.flags. */.#d
0670: 65 66 69 6e 65 20 54 4c 53 5f 54 43 4c 5f 41 53  efine TLS_TCL_AS
0680: 59 4e 43 09 28 31 3c 3c 30 29 09 2f 2a 20 6e 6f  YNC.(1<<0)./* no
0690: 6e 2d 62 6c 6f 63 6b 69 6e 67 20 6d 6f 64 65 20  n-blocking mode 
06a0: 2a 2f 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f 54  */.#define TLS_T
06b0: 43 4c 5f 53 45 52 56 45 52 09 28 31 3c 3c 31 29  CL_SERVER.(1<<1)
06c0: 09 2f 2a 20 53 65 72 76 65 72 2d 53 69 64 65 20  ./* Server-Side 
06d0: 2a 2f 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f 54  */.#define TLS_T
06e0: 43 4c 5f 49 4e 49 54 09 28 31 3c 3c 32 29 09 2f  CL_INIT.(1<<2)./
06f0: 2a 20 49 6e 69 74 69 61 6c 69 7a 69 6e 67 20 63  * Initializing c
0700: 6f 6e 6e 65 63 74 69 6f 6e 20 2a 2f 0a 23 64 65  onnection */.#de
0710: 66 69 6e 65 20 54 4c 53 5f 54 43 4c 5f 44 45 42  fine TLS_TCL_DEB
0720: 55 47 09 28 31 3c 3c 33 29 09 2f 2a 20 53 68 6f  UG.(1<<3)./* Sho
0730: 77 20 64 65 62 75 67 20 74 72 61 63 69 6e 67 20  w debug tracing 
0740: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f  */..#define TLS_
0750: 54 43 4c 5f 44 45 4c 41 59 20 28 35 29 0a 0a 2f  TCL_DELAY (5)../
0760: 2a 0a 20 2a 20 54 68 69 73 20 73 74 72 75 63 74  *. * This struct
0770: 75 72 65 20 64 65 73 63 72 69 62 65 73 20 74 68  ure describes th
0780: 65 20 70 65 72 2d 69 6e 73 74 61 6e 63 65 20 73  e per-instance s
0790: 74 61 74 65 0a 20 2a 20 6f 66 20 61 6e 20 73 73  tate. * of an ss
07a0: 6c 20 63 68 61 6e 6e 65 6c 2e 0a 20 2a 0a 20 2a  l channel.. *. *
07b0: 20 54 68 65 20 53 53 4c 20 70 72 6f 63 65 73 73   The SSL process
07c0: 69 6e 67 20 63 6f 6e 74 65 78 74 20 69 73 20 6d  ing context is m
07d0: 61 69 6e 74 61 69 6e 65 64 20 68 65 72 65 2c 20  aintained here, 
07e0: 69 6e 20 74 68 65 20 43 6c 69 65 6e 74 44 61 74  in the ClientDat
07f0: 61 0a 20 2a 2f 0a 74 79 70 65 64 65 66 20 73 74  a. */.typedef st
0800: 72 75 63 74 20 53 74 61 74 65 20 7b 0a 20 20 20  ruct State {.   
0810: 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 73 65 6c   Tcl_Channel sel
0820: 66 3b 09 2f 2a 20 74 68 69 73 20 73 6f 63 6b 65  f;./* this socke
0830: 74 20 63 68 61 6e 6e 65 6c 20 2a 2f 0a 20 20 20  t channel */.   
0840: 20 54 63 6c 5f 54 69 6d 65 72 54 6f 6b 65 6e 20   Tcl_TimerToken 
0850: 74 69 6d 65 72 3b 0a 0a 20 20 20 20 69 6e 74 20  timer;..    int 
0860: 66 6c 61 67 73 3b 09 09 2f 2a 20 63 75 72 72 65  flags;../* curre
0870: 6e 74 6c 79 20 6f 6e 6c 79 20 43 48 41 4e 4e 45  ntly only CHANNE
0880: 4c 5f 41 53 59 4e 43 20 2a 2f 0a 20 20 20 20 69  L_ASYNC */.    i
0890: 6e 74 20 77 61 74 63 68 4d 61 73 6b 3b 09 2f 2a  nt watchMask;./*
08a0: 20 63 75 72 72 65 6e 74 20 57 61 74 63 68 50 72   current WatchPr
08b0: 6f 63 20 6d 61 73 6b 20 2a 2f 0a 20 20 20 20 69  oc mask */.    i
08c0: 6e 74 20 6d 6f 64 65 3b 09 09 2f 2a 20 63 75 72  nt mode;../* cur
08d0: 72 65 6e 74 20 6d 6f 64 65 20 6f 66 20 70 61 72  rent mode of par
08e0: 65 6e 74 20 63 68 61 6e 6e 65 6c 20 2a 2f 0a 0a  ent channel */..
08f0: 20 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a      Tcl_Interp *
0900: 69 6e 74 65 72 70 3b 09 2f 2a 20 69 6e 74 65 72  interp;./* inter
0910: 70 72 65 74 65 72 20 69 6e 20 77 68 69 63 68 20  preter in which 
0920: 74 68 69 73 20 72 65 73 69 64 65 73 20 2a 2f 0a  this resides */.
0930: 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 63 61 6c      Tcl_Obj *cal
0940: 6c 62 61 63 6b 3b 09 2f 2a 20 73 63 72 69 70 74  lback;./* script
0950: 20 63 61 6c 6c 65 64 20 66 6f 72 20 74 72 61 63   called for trac
0960: 69 6e 67 2c 20 76 65 72 69 66 79 69 6e 67 20 61  ing, verifying a
0970: 6e 64 20 65 72 72 6f 72 73 20 2a 2f 0a 20 20 20  nd errors */.   
0980: 20 54 63 6c 5f 4f 62 6a 20 2a 70 61 73 73 77 6f   Tcl_Obj *passwo
0990: 72 64 3b 09 2f 2a 20 73 63 72 69 70 74 20 63 61  rd;./* script ca
09a0: 6c 6c 65 64 20 66 6f 72 20 63 65 72 74 69 66 69  lled for certifi
09b0: 63 61 74 65 20 70 61 73 73 77 6f 72 64 20 2a 2f  cate password */
09c0: 0a 0a 20 20 20 20 69 6e 74 20 76 66 6c 61 67 73  ..    int vflags
09d0: 3b 09 09 2f 2a 20 76 65 72 69 66 79 20 66 6c 61  ;../* verify fla
09e0: 67 73 20 2a 2f 0a 20 20 20 20 53 53 4c 20 2a 73  gs */.    SSL *s
09f0: 73 6c 3b 09 09 2f 2a 20 53 74 72 75 63 74 20 66  sl;../* Struct f
0a00: 6f 72 20 53 53 4c 20 70 72 6f 63 65 73 73 69 6e  or SSL processin
0a10: 67 20 2a 2f 0a 20 20 20 20 53 53 4c 5f 43 54 58  g */.    SSL_CTX
0a20: 20 2a 63 74 78 3b 09 2f 2a 20 53 53 4c 20 43 6f   *ctx;./* SSL Co
0a30: 6e 74 65 78 74 20 2a 2f 0a 20 20 20 20 42 49 4f  ntext */.    BIO
0a40: 20 2a 62 69 6f 3b 09 09 2f 2a 20 53 74 72 75 63   *bio;../* Struc
0a50: 74 20 66 6f 72 20 53 53 4c 20 70 72 6f 63 65 73  t for SSL proces
0a60: 73 69 6e 67 20 2a 2f 0a 20 20 20 20 42 49 4f 20  sing */.    BIO 
0a70: 2a 70 5f 62 69 6f 3b 09 09 2f 2a 20 50 61 72 65  *p_bio;../* Pare
0a80: 6e 74 20 42 49 4f 20 28 74 68 61 74 20 69 73 20  nt BIO (that is 
0a90: 6c 61 79 65 72 65 64 20 6f 6e 20 54 63 6c 5f 43  layered on Tcl_C
0aa0: 68 61 6e 6e 65 6c 29 20 2a 2f 0a 0a 20 20 20 20  hannel) */..    
0ab0: 63 68 61 72 20 2a 65 72 72 3b 0a 7d 20 53 74 61  char *err;.} Sta
0ac0: 74 65 3b 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66  te;../*. * The f
0ad0: 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74  ollowing definit
0ae0: 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 65 20  ions have to be 
0af0: 75 73 61 62 6c 65 20 66 6f 72 20 38 2e 32 2e 30  usable for 8.2.0
0b00: 2d 38 2e 33 2e 31 20 61 6e 64 20 38 2e 33 2e 32  -8.3.1 and 8.3.2
0b10: 2b 2e 0a 20 2a 20 54 68 65 20 64 69 66 66 65 72  +.. * The differ
0b20: 65 6e 63 65 73 20 62 65 74 77 65 65 6e 20 74 68  ences between th
0b30: 65 73 65 20 76 65 72 73 69 6f 6e 73 3a 0a 20 2a  ese versions:. *
0b40: 0a 20 2a 20 38 2e 30 2d 38 2e 31 3a 09 54 68 65  . * 8.0-8.1:.The
0b50: 72 65 20 69 73 20 6e 6f 20 73 75 70 70 6f 72 74  re is no support
0b60: 20 66 6f 72 20 74 68 65 73 65 20 69 6e 20 54 4c   for these in TL
0b70: 53 20 31 2e 34 20 28 67 65 74 20 31 2e 33 29 2e  S 1.4 (get 1.3).
0b80: 20 20 54 68 69 73 0a 20 2a 09 09 77 61 73 20 74    This. *..was t
0b90: 68 65 20 76 65 72 73 69 6f 6e 20 77 69 74 68 20  he version with 
0ba0: 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 61 74  the original pat
0bb0: 63 68 2e 0a 20 2a 0a 20 2a 20 38 2e 32 2e 30 2d  ch.. *. * 8.2.0-
0bc0: 09 43 68 61 6e 67 65 64 20 73 65 6d 61 6e 74 69  .Changed semanti
0bd0: 63 73 20 66 6f 72 20 54 63 6c 5f 53 74 61 63 6b  cs for Tcl_Stack
0be0: 43 68 61 6e 6e 65 6c 20 28 54 63 6c 5f 52 65 70  Channel (Tcl_Rep
0bf0: 6c 61 63 65 43 68 61 6e 6e 65 6c 29 2e 0a 20 2a  laceChannel).. *
0c00: 20 38 2e 33 2e 31 3a 09 43 68 65 63 6b 20 61 74   8.3.1:.Check at
0c10: 20 72 75 6e 74 69 6d 65 20 74 6f 20 73 77 69 74   runtime to swit
0c20: 63 68 20 74 68 65 20 62 65 68 61 76 69 6f 75 72  ch the behaviour
0c30: 2e 20 54 68 65 20 70 61 74 63 68 20 69 73 20 70  . The patch is p
0c40: 61 72 74 0a 20 2a 09 09 6f 66 20 74 68 65 20 63  art. *..of the c
0c50: 6f 72 65 20 66 72 6f 6d 20 6e 6f 77 20 6f 6e 2e  ore from now on.
0c60: 0a 20 2a 0a 20 2a 20 38 2e 33 2e 32 2b 3a 09 53  . *. * 8.3.2+:.S
0c70: 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 73 20  tacked channels 
0c80: 72 65 77 72 69 74 74 65 6e 20 66 6f 72 20 62 65  rewritten for be
0c90: 74 74 65 72 20 62 65 68 61 76 69 6f 75 72 20 69  tter behaviour i
0ca0: 6e 20 73 6f 6d 65 0a 20 2a 09 09 73 69 74 75 61  n some. *..situa
0cb0: 74 69 6f 6e 73 20 28 63 6c 6f 73 69 6e 67 29 2e  tions (closing).
0cc0: 20 53 6f 6d 65 20 6e 65 77 20 41 50 49 27 73 2c   Some new API's,
0cd0: 20 73 65 6d 61 6e 74 69 63 20 63 68 61 6e 67 65   semantic change
0ce0: 73 2e 0a 20 2a 0a 20 2a 20 54 68 65 20 66 6f 6c  s.. *. * The fol
0cf0: 6c 6f 77 69 6e 67 20 6d 61 67 69 63 20 77 61 73  lowing magic was
0d00: 20 61 64 61 70 74 65 64 20 66 72 6f 6d 20 54 72   adapted from Tr
0d10: 66 20 32 2e 31 20 28 4b 75 70 72 69 65 73 29 2e  f 2.1 (Kupries).
0d20: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 4c  . */..#define TL
0d30: 53 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f  S_CHANNEL_VERSIO
0d40: 4e 5f 31 09 30 78 31 0a 23 64 65 66 69 6e 65 20  N_1.0x1.#define 
0d50: 54 4c 53 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53  TLS_CHANNEL_VERS
0d60: 49 4f 4e 5f 32 09 30 78 32 0a 65 78 74 65 72 6e  ION_2.0x2.extern
0d70: 20 69 6e 74 20 63 68 61 6e 6e 65 6c 54 79 70 65   int channelType
0d80: 56 65 72 73 69 6f 6e 3b 0a 0a 23 69 66 64 65 66  Version;..#ifdef
0d90: 20 55 53 45 5f 54 43 4c 5f 53 54 55 42 53 0a 23   USE_TCL_STUBS.#
0da0: 69 66 6e 64 65 66 20 54 63 6c 5f 53 74 61 63 6b  ifndef Tcl_Stack
0db0: 43 68 61 6e 6e 65 6c 0a 2f 2a 0a 20 2a 20 54 68  Channel./*. * Th
0dc0: 65 20 63 6f 72 65 20 77 65 20 61 72 65 20 63 6f  e core we are co
0dd0: 6d 70 69 6c 69 6e 67 20 61 67 61 69 6e 73 74 20  mpiling against 
0de0: 69 73 20 6e 6f 74 20 70 61 74 63 68 65 64 2c 20  is not patched, 
0df0: 73 6f 20 73 75 70 70 6c 79 20 74 68 65 0a 20 2a  so supply the. *
0e00: 20 6e 65 63 65 73 73 73 61 72 79 20 64 65 66 69   necesssary defi
0e10: 6e 69 74 69 6f 6e 73 20 68 65 72 65 20 62 79 20  nitions here by 
0e20: 6f 75 72 73 65 6c 76 65 73 2e 20 54 68 65 20 66  ourselves. The f
0e30: 6f 72 6d 20 63 68 6f 73 65 6e 20 66 6f 72 0a 20  orm chosen for. 
0e40: 2a 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20  * the procedure 
0e50: 6d 61 63 72 6f 73 20 28 72 65 73 65 72 76 65 64  macros (reserved
0e60: 58 58 58 29 20 77 69 6c 6c 20 6e 6f 74 69 66 79  XXX) will notify
0e70: 20 75 73 20 69 66 20 74 68 65 20 63 6f 72 65 0a   us if the core.
0e80: 20 2a 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 65   * does not have
0e90: 20 74 68 65 73 65 20 72 65 73 65 72 76 65 64 20   these reserved 
0ea0: 6c 6f 63 61 74 69 6f 6e 73 20 61 6e 79 6d 6f 72  locations anymor
0eb0: 65 2e 0a 20 2a 0a 20 2a 20 21 21 20 53 79 6e 63  e.. *. * !! Sync
0ec0: 68 72 6f 6e 69 7a 65 20 74 68 65 20 70 72 6f 63  hronize the proc
0ed0: 65 64 75 72 65 20 69 6e 64 69 63 65 73 20 69 6e  edure indices in
0ee0: 20 74 68 65 69 72 20 64 65 66 69 6e 69 74 69 6f   their definitio
0ef0: 6e 73 20 77 69 74 68 0a 20 2a 20 20 20 20 74 68  ns with. *    th
0f00: 65 20 70 61 74 63 68 20 74 6f 20 74 63 6c 2e 64  e patch to tcl.d
0f10: 65 63 6c 73 2c 20 61 73 20 74 68 65 79 20 68 61  ecls, as they ha
0f20: 76 65 20 74 6f 20 62 65 20 74 68 65 20 73 61 6d  ve to be the sam
0f30: 65 2e 0a 20 2a 2f 0a 0a 2f 2a 20 32 38 31 20 2a  e.. */../* 281 *
0f40: 2f 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 43 68  /.typedef Tcl_Ch
0f50: 61 6e 6e 65 6c 20 28 74 6c 73 5f 53 74 61 63 6b  annel (tls_Stack
0f60: 43 68 61 6e 6e 65 6c 29 20 5f 41 4e 53 49 5f 41  Channel) _ANSI_A
0f70: 52 47 53 5f 28 28 54 63 6c 5f 49 6e 74 65 72 70  RGS_((Tcl_Interp
0f80: 2a 20 69 6e 74 65 72 70 2c 0a 09 09 09 09 09 09  * interp,.......
0f90: 20 20 20 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 54      Tcl_ChannelT
0fa0: 79 70 65 2a 20 74 79 70 65 50 74 72 2c 0a 09 09  ype* typePtr,...
0fb0: 09 09 09 09 20 20 20 20 43 6c 69 65 6e 74 44 61  ....    ClientDa
0fc0: 74 61 20 69 6e 73 74 61 6e 63 65 44 61 74 61 2c  ta instanceData,
0fd0: 0a 09 09 09 09 09 09 20 20 20 20 69 6e 74 20 6d  .......    int m
0fe0: 61 73 6b 2c 0a 09 09 09 09 09 09 20 20 20 20 54  ask,.......    T
0ff0: 63 6c 5f 43 68 61 6e 6e 65 6c 20 70 72 65 76 43  cl_Channel prevC
1000: 68 61 6e 29 29 3b 0a 2f 2a 20 32 38 32 20 2a 2f  han));./* 282 */
1010: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 74  .typedef void (t
1020: 6c 73 5f 55 6e 73 74 61 63 6b 43 68 61 6e 6e 65  ls_UnstackChanne
1030: 6c 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28  l) _ANSI_ARGS_((
1040: 54 63 6c 5f 49 6e 74 65 72 70 2a 20 69 6e 74 65  Tcl_Interp* inte
1050: 72 70 2c 0a 09 09 09 09 09 20 20 20 20 20 20 20  rp,......       
1060: 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 63 68 61 6e  Tcl_Channel chan
1070: 29 29 3b 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c  ));..#define Tcl
1080: 5f 53 74 61 63 6b 43 68 61 6e 6e 65 6c 20 20 20  _StackChannel   
1090: 20 20 28 28 74 6c 73 5f 53 74 61 63 6b 43 68 61    ((tls_StackCha
10a0: 6e 6e 65 6c 2a 29 20 74 63 6c 53 74 75 62 73 50  nnel*) tclStubsP
10b0: 74 72 2d 3e 72 65 73 65 72 76 65 64 32 38 31 29  tr->reserved281)
10c0: 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 55 6e 73  .#define Tcl_Uns
10d0: 74 61 63 6b 43 68 61 6e 6e 65 6c 20 28 28 74 6c  tackChannel ((tl
10e0: 73 5f 55 6e 73 74 61 63 6b 43 68 61 6e 6e 65 6c  s_UnstackChannel
10f0: 2a 29 20 74 63 6c 53 74 75 62 73 50 74 72 2d 3e  *) tclStubsPtr->
1100: 72 65 73 65 72 76 65 64 32 38 32 29 0a 0a 23 65  reserved282)..#e
1110: 6e 64 69 66 20 2f 2a 20 54 63 6c 5f 53 74 61 63  ndif /* Tcl_Stac
1120: 6b 43 68 61 6e 6e 65 6c 20 2a 2f 0a 0a 23 69 66  kChannel */..#if
1130: 6e 64 65 66 20 54 63 6c 5f 47 65 74 53 74 61 63  ndef Tcl_GetStac
1140: 6b 65 64 43 68 61 6e 6e 65 6c 0a 2f 2a 0a 20 2a  kedChannel./*. *
1150: 20 53 65 70 61 72 61 74 65 20 64 65 66 69 6e 69   Separate defini
1160: 74 69 6f 6e 2c 20 61 76 61 69 6c 61 62 6c 65 20  tion, available 
1170: 69 6e 20 38 2e 32 2c 20 62 75 74 20 6e 6f 74 20  in 8.2, but not 
1180: 38 2e 31 20 61 6e 64 20 62 65 66 6f 72 65 20 21  8.1 and before !
1190: 0a 20 2a 2f 0a 0a 2f 2a 20 32 38 33 20 2a 2f 0a  . */../* 283 */.
11a0: 74 79 70 65 64 65 66 20 54 63 6c 5f 43 68 61 6e  typedef Tcl_Chan
11b0: 6e 65 6c 20 28 74 6c 73 5f 47 65 74 53 74 61 63  nel (tls_GetStac
11c0: 6b 65 64 43 68 61 6e 6e 65 6c 29 20 5f 41 4e 53  kedChannel) _ANS
11d0: 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 43 68 61  I_ARGS_((Tcl_Cha
11e0: 6e 6e 65 6c 20 63 68 61 6e 29 29 3b 0a 0a 23 64  nnel chan));..#d
11f0: 65 66 69 6e 65 20 54 63 6c 5f 47 65 74 53 74 61  efine Tcl_GetSta
1200: 63 6b 65 64 43 68 61 6e 6e 65 6c 20 28 28 74 6c  ckedChannel ((tl
1210: 73 5f 47 65 74 53 74 61 63 6b 65 64 43 68 61 6e  s_GetStackedChan
1220: 6e 65 6c 2a 29 20 74 63 6c 53 74 75 62 73 50 74  nel*) tclStubsPt
1230: 72 2d 3e 72 65 73 65 72 76 65 64 32 38 33 29 0a  r->reserved283).
1240: 0a 23 65 6e 64 69 66 20 2f 2a 20 54 63 6c 5f 47  .#endif /* Tcl_G
1250: 65 74 53 74 61 63 6b 65 64 43 68 61 6e 6e 65 6c  etStackedChannel
1260: 20 2a 2f 0a 0a 0a 23 69 66 6e 64 65 66 20 54 43   */...#ifndef TC
1270: 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f  L_CHANNEL_VERSIO
1280: 4e 5f 32 0a 2f 2a 0a 20 2a 20 43 6f 72 65 20 69  N_2./*. * Core i
1290: 73 20 6f 6c 64 65 72 20 74 68 61 6e 20 38 2e 33  s older than 8.3
12a0: 2e 32 2e 20 20 53 75 70 70 6c 79 20 74 68 65 20  .2.  Supply the 
12b0: 6d 69 73 73 69 6e 67 20 64 65 66 69 6e 69 74 69  missing definiti
12c0: 6f 6e 73 20 66 6f 72 0a 20 2a 20 74 68 65 20 6e  ons for. * the n
12d0: 65 77 20 41 50 49 27 73 20 69 6e 20 38 2e 33 2e  ew API's in 8.3.
12e0: 32 2e 0a 20 2a 2f 0a 23 64 65 66 69 6e 65 20 45  2.. */.#define E
12f0: 4d 55 4c 41 54 45 5f 43 48 41 4e 4e 45 4c 5f 56  MULATE_CHANNEL_V
1300: 45 52 53 49 4f 4e 5f 32 0a 0a 74 79 70 65 64 65  ERSION_2..typede
1310: 66 20 73 74 72 75 63 74 20 54 6c 73 43 68 61 6e  f struct TlsChan
1320: 6e 65 6c 54 79 70 65 56 65 72 73 69 6f 6e 5f 2a  nelTypeVersion_*
1330: 20 54 6c 73 43 68 61 6e 6e 65 6c 54 79 70 65 56   TlsChannelTypeV
1340: 65 72 73 69 6f 6e 3b 0a 23 64 65 66 69 6e 65 20  ersion;.#define 
1350: 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53  TCL_CHANNEL_VERS
1360: 49 4f 4e 5f 32 09 28 28 54 6c 73 43 68 61 6e 6e  ION_2.((TlsChann
1370: 65 6c 54 79 70 65 56 65 72 73 69 6f 6e 29 20 30  elTypeVersion) 0
1380: 78 32 29 0a 0a 74 79 70 65 64 65 66 20 69 6e 74  x2)..typedef int
1390: 20 28 54 6c 73 44 72 69 76 65 72 48 61 6e 64 6c   (TlsDriverHandl
13a0: 65 72 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52  erProc) _ANSI_AR
13b0: 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 61 20  GS_((ClientData 
13c0: 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 0a 09 09  instanceData,...
13d0: 09 09 09 69 6e 74 20 69 6e 74 65 72 65 73 74 4d  ...int interestM
13e0: 61 73 6b 29 29 3b 0a 2f 2a 20 33 39 34 20 2a 2f  ask));./* 394 */
13f0: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 74 6c  .typedef int (tl
1400: 73 5f 52 65 61 64 52 61 77 29 20 20 5f 41 4e 53  s_ReadRaw)  _ANS
1410: 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 43 68 61  I_ARGS_((Tcl_Cha
1420: 6e 6e 65 6c 20 63 68 61 6e 2c 20 63 68 61 72 20  nnel chan, char 
1430: 2a 64 73 74 2c 0a 09 09 09 09 09 69 6e 74 20 62  *dst,......int b
1440: 79 74 65 73 54 6f 52 65 61 64 29 29 3b 0a 2f 2a  ytesToRead));./*
1450: 20 33 39 35 20 2a 2f 0a 74 79 70 65 64 65 66 20   395 */.typedef 
1460: 69 6e 74 20 28 74 6c 73 5f 57 72 69 74 65 52 61  int (tls_WriteRa
1470: 77 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28  w) _ANSI_ARGS_((
1480: 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 63 68 61 6e  Tcl_Channel chan
1490: 2c 20 63 68 61 72 20 2a 73 72 63 2c 0a 09 09 09  , char *src,....
14a0: 09 09 69 6e 74 20 73 72 63 4c 65 6e 29 29 3b 0a  ..int srcLen));.
14b0: 2f 2a 20 33 39 37 20 2a 2f 0a 74 79 70 65 64 65  /* 397 */.typede
14c0: 66 20 69 6e 74 20 28 74 6c 73 5f 47 65 74 54 6f  f int (tls_GetTo
14d0: 70 43 68 61 6e 6e 65 6c 29 20 5f 41 4e 53 49 5f  pChannel) _ANSI_
14e0: 41 52 47 53 5f 28 28 54 63 6c 5f 43 68 61 6e 6e  ARGS_((Tcl_Chann
14f0: 65 6c 20 63 68 61 6e 29 29 3b 0a 0a 2f 2a 0a 20  el chan));../*. 
1500: 2a 20 47 65 6e 65 72 61 74 69 6e 67 20 63 6f 64  * Generating cod
1510: 65 20 66 6f 72 20 61 63 63 65 73 73 69 6e 67 20  e for accessing 
1520: 74 68 65 73 65 20 70 61 72 74 73 20 6f 66 20 74  these parts of t
1530: 68 65 20 73 74 75 62 20 74 61 62 6c 65 20 77 68  he stub table wh
1540: 65 6e 0a 20 2a 20 63 6f 6d 70 69 6c 69 6e 67 20  en. * compiling 
1550: 61 67 61 69 6e 73 74 20 61 20 63 6f 72 65 20 6f  against a core o
1560: 6c 64 65 72 20 74 68 61 6e 20 38 2e 33 2e 32 20  lder than 8.3.2 
1570: 69 73 20 61 20 68 61 73 73 6c 65 20 62 65 63 61  is a hassle beca
1580: 75 73 65 20 65 76 65 6e 0a 20 2a 20 74 68 65 20  use even. * the 
1590: 27 72 65 73 65 72 76 65 64 58 58 58 27 20 66 69  'reservedXXX' fi
15a0: 65 6c 64 73 20 6f 66 20 74 68 65 20 73 74 72 75  elds of the stru
15b0: 63 74 75 72 65 20 61 72 65 20 6e 6f 74 20 64 65  cture are not de
15c0: 66 69 6e 65 64 20 79 65 74 2e 20 53 6f 0a 20 2a  fined yet. So. *
15d0: 20 77 65 20 68 61 76 65 20 74 6f 20 77 72 69 74   we have to writ
15e0: 65 20 75 70 20 73 6f 6d 65 20 6d 61 63 72 6f 73  e up some macros
15f0: 20 68 69 64 69 6e 67 20 73 6f 6d 65 20 76 65 72   hiding some ver
1600: 79 20 68 61 63 6b 69 73 68 20 70 6f 69 6e 74 65  y hackish pointe
1610: 72 0a 20 2a 20 61 72 69 74 68 6d 65 74 69 63 73  r. * arithmetics
1620: 20 74 6f 20 67 65 74 20 61 74 20 74 68 65 73 65   to get at these
1630: 20 66 69 65 6c 64 73 2e 20 57 65 20 61 73 73 75   fields. We assu
1640: 6d 65 20 74 68 61 74 20 70 6f 69 6e 74 65 72 20  me that pointer 
1650: 74 6f 0a 20 2a 20 66 75 6e 63 74 69 6f 6e 73 20  to. * functions 
1660: 61 72 65 20 61 6c 77 61 79 73 20 6f 66 20 74 68  are always of th
1670: 65 20 73 61 6d 65 20 73 69 7a 65 2e 0a 20 2a 2f  e same size.. */
1680: 0a 0a 23 64 65 66 69 6e 65 20 53 54 55 42 5f 42  ..#define STUB_B
1690: 41 53 45 20 20 20 28 28 63 68 61 72 2a 29 28 26  ASE   ((char*)(&
16a0: 28 74 63 6c 53 74 75 62 73 50 74 72 2d 3e 74 63  (tclStubsPtr->tc
16b0: 6c 5f 55 74 66 4e 63 61 73 65 63 6d 70 29 29 29  l_UtfNcasecmp)))
16c0: 20 2f 2a 20 66 69 65 6c 64 20 33 37 30 20 2a 2f   /* field 370 */
16d0: 0a 23 64 65 66 69 6e 65 20 70 72 6f 63 50 74 72  .#define procPtr
16e0: 53 69 7a 65 20 28 73 69 7a 65 6f 66 20 28 54 63  Size (sizeof (Tc
16f0: 6c 5f 44 72 69 76 65 72 42 6c 6f 63 6b 4d 6f 64  l_DriverBlockMod
1700: 65 50 72 6f 63 20 2a 29 29 0a 23 64 65 66 69 6e  eProc *)).#defin
1710: 65 20 49 44 58 28 6e 29 20 20 20 20 20 20 28 28  e IDX(n)      ((
1720: 28 6e 29 2d 33 37 30 29 20 2a 20 70 72 6f 63 50  (n)-370) * procP
1730: 74 72 53 69 7a 65 29 0a 23 64 65 66 69 6e 65 20  trSize).#define 
1740: 53 4c 4f 54 28 6e 29 20 20 20 20 20 28 53 54 55  SLOT(n)     (STU
1750: 42 5f 42 41 53 45 20 2b 20 49 44 58 28 6e 29 29  B_BASE + IDX(n))
1760: 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 52 65  ..#define Tcl_Re
1770: 61 64 52 61 77 09 09 28 2a 28 28 74 6c 73 5f 52  adRaw..(*((tls_R
1780: 65 61 64 52 61 77 2a 2a 29 09 28 53 4c 4f 54 28  eadRaw**).(SLOT(
1790: 33 39 34 29 29 29 29 0a 23 64 65 66 69 6e 65 20  394)))).#define 
17a0: 54 63 6c 5f 57 72 69 74 65 52 61 77 09 09 28 2a  Tcl_WriteRaw..(*
17b0: 28 28 74 6c 73 5f 57 72 69 74 65 52 61 77 2a 2a  ((tls_WriteRaw**
17c0: 29 09 28 53 4c 4f 54 28 33 39 35 29 29 29 29 0a  ).(SLOT(395)))).
17d0: 23 64 65 66 69 6e 65 20 54 63 6c 5f 47 65 74 54  #define Tcl_GetT
17e0: 6f 70 43 68 61 6e 6e 65 6c 09 28 2a 28 28 74 6c  opChannel.(*((tl
17f0: 73 5f 47 65 74 54 6f 70 43 68 61 6e 6e 65 6c 2a  s_GetTopChannel*
1800: 2a 29 28 53 4c 4f 54 28 33 39 36 29 29 29 29 0a  *)(SLOT(396)))).
1810: 0a 2f 2a 0a 20 2a 20 52 65 71 75 69 72 65 64 2c  ./*. * Required,
1820: 20 65 61 73 79 20 65 6d 75 6c 61 74 69 6f 6e 2e   easy emulation.
1830: 0a 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 63 6c  . */.#define Tcl
1840: 5f 43 68 61 6e 6e 65 6c 47 65 74 4f 70 74 69 6f  _ChannelGetOptio
1850: 6e 50 72 6f 63 28 63 68 61 6e 44 72 69 76 65 72  nProc(chanDriver
1860: 29 20 28 28 63 68 61 6e 44 72 69 76 65 72 29 2d  ) ((chanDriver)-
1870: 3e 67 65 74 4f 70 74 69 6f 6e 50 72 6f 63 29 0a  >getOptionProc).
1880: 0a 23 65 6e 64 69 66 20 2f 2a 20 54 43 4c 5f 43  .#endif /* TCL_C
1890: 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f 4e 5f 32  HANNEL_VERSION_2
18a0: 20 2a 2f 0a 0a 23 65 6e 64 69 66 20 2f 2a 20 55   */..#endif /* U
18b0: 53 45 5f 54 43 4c 5f 53 54 55 42 53 20 2a 2f 0a  SE_TCL_STUBS */.
18c0: 0a 2f 2a 0a 20 2a 20 46 6f 72 77 61 72 64 20 64  ./*. * Forward d
18d0: 65 63 6c 61 72 61 74 69 6f 6e 73 0a 20 2a 2f 0a  eclarations. */.
18e0: 0a 45 58 54 45 52 4e 20 54 63 6c 5f 43 68 61 6e  .EXTERN Tcl_Chan
18f0: 6e 65 6c 54 79 70 65 20 2a 54 6c 73 5f 43 68 61  nelType *Tls_Cha
1900: 6e 6e 65 6c 54 79 70 65 20 5f 41 4e 53 49 5f 41  nnelType _ANSI_A
1910: 52 47 53 5f 28 28 76 6f 69 64 29 29 3b 0a 45 58  RGS_((void));.EX
1920: 54 45 52 4e 20 54 63 6c 5f 43 68 61 6e 6e 65 6c  TERN Tcl_Channel
1930: 09 54 6c 73 5f 47 65 74 50 61 72 65 6e 74 20 5f  .Tls_GetParent _
1940: 41 4e 53 49 5f 41 52 47 53 5f 28 28 53 74 61 74  ANSI_ARGS_((Stat
1950: 65 20 2a 73 74 61 74 65 50 74 72 29 29 3b 0a 0a  e *statePtr));..
1960: 45 58 54 45 52 4e 20 54 63 6c 5f 4f 62 6a 2a 09  EXTERN Tcl_Obj*.
1970: 09 54 6c 73 5f 4e 65 77 58 35 30 39 4f 62 6a 20  .Tls_NewX509Obj 
1980: 5f 41 4e 53 49 5f 41 52 47 53 5f 20 28 28 20 54  _ANSI_ARGS_ (( T
1990: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72  cl_Interp *inter
19a0: 70 2c 20 58 35 30 39 20 2a 63 65 72 74 29 29 3b  p, X509 *cert));
19b0: 0a 45 58 54 45 52 4e 20 76 6f 69 64 09 09 54 6c  .EXTERN void..Tl
19c0: 73 5f 45 72 72 6f 72 20 5f 41 4e 53 49 5f 41 52  s_Error _ANSI_AR
19d0: 47 53 5f 20 28 28 53 74 61 74 65 20 2a 73 74 61  GS_ ((State *sta
19e0: 74 65 50 74 72 2c 20 63 68 61 72 20 2a 6d 73 67  tePtr, char *msg
19f0: 29 29 3b 0a 45 58 54 45 52 4e 20 76 6f 69 64 09  ));.EXTERN void.
1a00: 09 54 6c 73 5f 46 72 65 65 20 5f 41 4e 53 49 5f  .Tls_Free _ANSI_
1a10: 41 52 47 53 5f 20 28 28 63 68 61 72 20 2a 62 6c  ARGS_ ((char *bl
1a20: 6f 63 6b 50 74 72 29 29 3b 0a 45 58 54 45 52 4e  ockPtr));.EXTERN
1a30: 20 76 6f 69 64 09 09 54 6c 73 5f 43 6c 65 61 6e   void..Tls_Clean
1a40: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 20 28 28 53   _ANSI_ARGS_ ((S
1a50: 74 61 74 65 20 2a 73 74 61 74 65 50 74 72 29 29  tate *statePtr))
1a60: 3b 0a 45 58 54 45 52 4e 20 69 6e 74 09 09 54 6c  ;.EXTERN int..Tl
1a70: 73 5f 57 61 69 74 46 6f 72 43 6f 6e 6e 65 63 74  s_WaitForConnect
1a80: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 20 53   _ANSI_ARGS_(( S
1a90: 74 61 74 65 20 2a 73 74 61 74 65 50 74 72 2c 0a  tate *statePtr,.
1aa0: 09 09 09 09 09 09 09 69 6e 74 20 2a 65 72 72 6f  .......int *erro
1ab0: 72 43 6f 64 65 50 74 72 29 29 3b 0a 0a 45 58 54  rCodePtr));..EXT
1ac0: 45 52 4e 20 42 49 4f 5f 4d 45 54 48 4f 44 20 2a  ERN BIO_METHOD *
1ad0: 09 42 49 4f 5f 73 5f 74 63 6c 20 5f 41 4e 53 49  .BIO_s_tcl _ANSI
1ae0: 5f 41 52 47 53 5f 28 28 76 6f 69 64 29 29 3b 0a  _ARGS_((void));.
1af0: 45 58 54 45 52 4e 20 42 49 4f 20 2a 09 09 42 49  EXTERN BIO *..BI
1b00: 4f 5f 6e 65 77 5f 74 63 6c 20 5f 41 4e 53 49 5f  O_new_tcl _ANSI_
1b10: 41 52 47 53 5f 28 28 53 74 61 74 65 2a 20 73 74  ARGS_((State* st
1b20: 61 74 65 50 74 72 2c 20 69 6e 74 20 66 6c 61 67  atePtr, int flag
1b30: 73 29 29 3b 0a 0a 23 65 6e 64 69 66 20 2f 2a 20  s));..#endif /* 
1b40: 5f 54 4c 53 49 4e 54 5f 48 20 2a 2f 0a           _TLSINT_H */.