#ifndef SSHSTRC_H
#define SSHSTRC_H

#ifndef SOCKET
#define SOCKET int
#endif

typedef unsigned int word32;
typedef unsigned int uint32;

struct Packet {
    WLong length;
    WInt type;
    WULong crc;
    WUChar *data;
    WUChar *body;
    WLong maxlen;
};

typedef struct
{
  word32 key_schedule[32];
} DESContext;


/* structures of all the statics defined in various functions */

typedef struct {
  DESContext ekey1, ekey2, ekey3;
  unsigned char eiv1[8], eiv2[8], eiv3[8];

  DESContext dkey1, dkey2, dkey3;
  unsigned char div1[8], div2[8], div3[8];
} SSHDESSession;

typedef struct {
  WLong len, biglen, to_read;
  WUChar c, *p;
  WInt i, pad;
  WChar padding[8];
  WUChar word[4];
  WInt chunk;
} SSHGotDataPrivate;

typedef struct {
  WChar username[100];
  WChar password[100];
  WInt uPos; /* =0 */
  WInt pPos; /* =0 */
  WChar c;
} SSHProtocolPrivate;

typedef struct {
  /* values needed by PuTTY's SSH code - don't blame me that they
   * don't match the namespace
   */

  SOCKET s; /* = NULL */
  WInt crLine[2]; /* =0 */
  WUChar session_key[32];
  struct ssh_cipher *cipher; /* = NULL */
  WChar *savedhost;
  WInt size_needed; /* = FALSE */
  enum {
    SSH_STATE_BEFORE_SIZE,
    SSH_STATE_INTERMED,
    SSH_STATE_SESSION
  } ssh_state; /* = SSH_STATE_BEFORE_SIZE */
  struct Packet pktin; /* = { 0, 0, 0, NULL, 0 };*/
  struct Packet pktout; /* = { 0, 0, 0, NULL, 0 };*/
  WInt rows, cols;
  WUChar inbuf[INBUF_SIZE];
  WInt inbuf_head, inbuf_reap;
  Config cfg;
  SSHDESSession des;
  SOCKET telnetSocket;
  SSHGotDataPrivate gD; /* cryptic otherwise code will be huge & unreadable */
  SSHProtocolPrivate pr; /* we make it small and unreadable instead... */
} SSHSession;


#endif
