{-------------------------------------------------------------------------------
Translated form headers/ssl2.h

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      THIS ISN'T COMPLETE TRANSLATION OF C++ HEADERS AND NEVER WILL BE.

  FOR COPYRIGHT OF ORIGINAL ERIC YOUNG SOFTWARE LOOK AT FILES IN HEADER FOLDER.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      Copyright (C) 1998 by Jan Tomasek <xtomasej@fel.cvut.cz>
      All rights reserved.

      This library is free for commercial and non-commercial use as long as
      the following conditions are aheared to.  The following conditions
      apply to all code found in this distribution.  The documentation
      included with this distribution is covered by the same copyright terms.

      Copyright remains Jan Tomasek's, and as such any Copyright notices in
      the code are not to be removed.
      If this package is used in a product, Jan Tomasek should be given
      attribution as the author of the parts of the library used.
      This can be in the form of a textual message at program startup or
      in documentation (online or textual) provided with the package.

      Redistribution and use in source and binary forms, with or without
      modification, are permitted provided that the following conditions
      are met:
      1. Redistributions of source code must retain the copyright
         notice, this list of conditions and the following disclaimer.
      2. Redistributions in binary form must reproduce the above copyright
         notice, this list of conditions and the following disclaimer in the
         documentation and/or other materials provided with the distribution.
      3. All advertising materials mentioning features or use of this software
         must display the following acknowledgement:
             "This product includes software written by
              Jan Tomasek <xtomasej@fel.cvut.cz>"

      THIS SOFTWARE IS PROVIDED BY JAN TOMASEK ``AS IS'' AND
      ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
      ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
      FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
      DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
      OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
      HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
      LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
      OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
      SUCH DAMAGE.

      The licence and distribution terms for any publically available version or
      derivative of this code cannot be changed.  i.e. this code cannot simply
      be copied and put under another distribution licence
      [including the GNU Public Licence.]
-------------------------------------------------------------------------------}

  TSSL2_CTX_tmp = record
    conn_id_length           : uint;             { unsigned int conn_id_length; }
    cert_type                : uint;             { unsigned int cert_type; }
    cert_length              : uint;             { unsigned int cert_length; }
    csl                      : int;              { int csl; }
    clear                    : int;              { int clear; }
    enc                      : uint;             { unsigned int enc; }
    ccl                      : Array[0..SSL2_MAX_CERT_CHALLENGE_LENGTH-1] of Char;
                                                 { unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH]; }
    cipher_spec_length       : int;              { int cipher_spec_length; }
    session_id_length        : uint;             { unsigned int session_id_length; }
    clen                     : uint;             { unsigned int clen; }
    rlen                     : uint;             { unsigned int rlen; }
  End;


  TSSL2_CTX = record
    { enable first packet checking in server }
    first_packet             : int;              { int first_packet; }
    three_byte_header        : int;              { int three_byte_header; }
    clear_text               : int;              { int clear_text;  /* clear text */}
    { not used in SSLv2 }
    escape                   : int;              { int escape;}
    { used if SSLv23 rolled back to SSLv2 }
    ssl2_rollback            : int;              { int ssl2_rollback;}
    { non-blocking io info, used to make sure the same
      args were passwd }
    { number of bytes sent so far }
    wnum                     : uint;             { unsigned int wnum; }
    wpend_tot                : int;              { int wpend_tot; }
    wpend_buf                : PChar;            { char *wpend_buf; }

    { offset to data to write }
    wpend_off                : int;              { int wpend_off; }
    { number of bytes passwd to write }
    wpend_len                : int;              { int wpend_len; }
    { number of bytes to return to caller }
    wpend_ret                : int;              { int wpend_ret; }
    { buffer raw data }
    rbuf_left                : int;              { int rbuf_left; }
    rbuf_offs                : int;              { int rbuf_offs; }
    rbuf                     : PChar;            { unsigned char *rbuf;}
    wbuf                     : PChar;            { unsigned char *wbuf;}
    { used to point to the start due to 2/3 byte header. }
    write_ptr                : PChar;            { unsigned char *write_ptr;}
    padding                  : uint;             { unsigned int padding; }
    { passed to ssl2_enc }
    rlength                  : uint;             { unsigned int rlength; }
    { Set when things are encrypted. }
    ract_data_length         : int;              { int ract_data_length; }
    { passed to ssl2_enc }
    wlength                  : uint;             { unsigned int wlength; }
    { Set when things are decrypted. }
    wact_data_length         : int;              { int wact_data_length; }

    ract_data                : PChar;            { unsigned char *ract_data; }
    wact_data                : PChar;            { unsigned char *wact_data; }
    mac_data                 : PChar;            { unsigned char *mac_data;  }
    pad_data                 : PChar;            { unsigned char *pad_data;  }

    read_key                 : PChar;            { unsigned char *read_key; }
    write_key                : PChar;            { unsigned char *write_key; }
    { Stuff specifically to do with this SSL session }
    challenge_length         : uint;             { unsigned int challenge_length; }
    challenge                : Array[0..SSL2_MAX_CHALLENGE_LENGTH-1] of Char;
                                                 { unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH]; }
    conn_id_length           : uint;             { unsigned int conn_id_length; }
    conn_id                  : Array[0..SSL2_MAX_CONNECTION_ID_LENGTH-1] of Char;
                                                 { unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH]; }
    key_material_length      : uint;             { unsigned int key_material_length; }
    key_material             : Array[0..((SSL2_MAX_KEY_MATERIAL_LENGTH*2)-1)] of Char;
                                                 { unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2]; }

    read_sequence            : ulong;            { unsigned long read_sequence; }
    write_sequence           : ulong;            { unsigned long write_sequence; }

    tmp                      : TSSL2_CTX_tmp;
  End;

