"Fossies" - the Fresh Open Source Software Archive

Member "tlswrap-1.04/tlswrap.h" (25 Nov 2006, 3327 Bytes) of package /linux/privat/old/tlswrap-1.04.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "tlswrap.h" see the Fossies "Dox" file reference documentation.

    1 #ifndef __TLSWRAP_H__
    2 #define __TLSWRAP_H__
    3 
    4 #include "conf.h"
    5 
    6 //#include <netdb.h>
    7 #include <openssl/ssl.h>
    8 #include <openssl/rand.h>
    9 #include <openssl/err.h>
   10 
   11 #define U2S_SIZE 4096 /* Buffered data going from user to server */
   12 #define S2U_SIZE 4096 /* Buffered data going from server to user */
   13 #define BUF_SIZE 4096 /* Input from user to program */
   14 
   15 
   16 #if !defined __CYGWIN__ && !defined WIN32
   17 #define DBUF_SIZE 8192 /* Data buffer */
   18 #else
   19 #define DBUF_SIZE 4096 //16384
   20 #endif
   21 
   22 #ifndef NI_MAXHOST
   23 #define NI_MAXHOST 1025
   24 #endif
   25 
   26 enum {  CONN_NO,
   27     CONN_NICK,
   28     CONN_USER,
   29     CONN_PASS,
   30     CONN_CMD,
   31     CONN_DNS,
   32     CONN_IN_PROG,
   33     CONN_YES, 
   34 
   35     /* data only */
   36     CONN_DATA_LISTEN,
   37     CONN_DATA_TLS,
   38     CONN_DATA_OK
   39 };
   40 
   41 enum {  AUTH_NO,
   42     AUTH_YES };
   43 
   44 enum {  DATA_UP,
   45         DATA_DOWN,
   46         DATA_PORT};
   47 
   48 enum {  TLS_NONE,
   49     TLS_READ,
   50     TLS_WRITE };
   51 
   52 enum {  CLOSE_NONE,
   53     CLOSE_READ,
   54     CLOSE_WRITE };
   55 
   56 enum {  SERV_NONE,
   57     SERV_CONN,  /* Connected to server */
   58     SERV_AUTH,  /* Sent AUTH TLS to server */
   59     SERV_TLS,   /* TLS negotiation in progress */
   60     SERV_TLS_OK,
   61     SERV_PBSZ,
   62     SERV_PROT,
   63     SERV_FLOW };
   64 
   65 #define TLS_DATA 1
   66 #define TLS_CTRL 2
   67 
   68 struct dns_msg{                 /* Stucture to communicate with the DNS child */
   69   int ud;                       /* Index of iud structure doing this request */
   70   char port[6];                 /* Just convenient */
   71   char hostname[NI_MAXHOST];    /* Use for both request and reply */
   72 };
   73 
   74 struct user_data {
   75   int user_fd;
   76   int user_data_fd;
   77   int serv_fd;
   78   int serv_data_fd;
   79   char serv_host[NI_MAXHOST];
   80   char serv_port[6];
   81   char serv_data_host[NI_MAXHOST];  /* Remote host from PASV */
   82   char serv_data_port[6];
   83   struct dns_msg serv_dns;
   84   char local_data_host[NI_MAXHOST]; /* PASV */
   85   char local_data_port[6];
   86   char u2s_buf[U2S_SIZE];  /* from user to server        */
   87   char s2u_buf[S2U_SIZE];  /* from server to user        */
   88   char *u2s_i;        /* user to server, input ptr  */
   89   char *u2s_o;        /* user to server, output ptr */
   90   char *s2u_i;        /* server to user, input ptr  */
   91   char *s2u_o;        /* server to user, output ptr */
   92   char *user_ptr, user_input[BUF_SIZE]; /* Not really a string */
   93   char *serv_ptr, serv_input[BUF_SIZE];
   94   char dc2s_buf[DBUF_SIZE]; /* Data - Client to Server */
   95   char ds2c_buf[DBUF_SIZE]; /* Data - Server to Client */
   96   char *dc2s_i;
   97   char *dc2s_o;
   98   char *ds2c_i;
   99   char *ds2c_o;
  100   unsigned int user_read_cnt;
  101   unsigned int serv_read_cnt;
  102   char prot; /* PROT C or PROT P */
  103   int connected;
  104   int data_connected;
  105   int serv_data_close;
  106   int user_data_close;
  107   int data_direction;
  108   int authenticated;
  109   int serv_status;
  110   int tls_status;
  111   SSL *ssl_ctrl;
  112   SSL *ssl_data;
  113   int ssl_ctrl_fd_mode;     /* the RESYNC mode */
  114   int ssl_data_fd_mode;
  115   int ssl_ctrl_func;        /* Called from what function */
  116   int ssl_data_func;
  117   char user[160];              /* complete USER command */
  118   char pass[160];
  119   unsigned int lport; /* Local port */
  120   unsigned int rport; /* Remote port */
  121   int active;
  122   int epsv;
  123   int issl; /* implicit ssl */
  124   int retry; /* We filled the buffer, so there is probably more to read */
  125   int retry_data;
  126   SSL_SESSION *ssl_sess;
  127   SSL_CTX *ssl_ctx;
  128   int sec_level;
  129   int delay_prot;
  130 };
  131 
  132 extern char *cfg_tlsrsafile;
  133 extern char *cfg_tlsciphers;
  134 
  135 //int print_to_user(struct user_data *, const char *);
  136 #endif /* !__TLSWRAP_H__ */