#ifndef TOR_TORTLS_ST_H
#define TOR_TORTLS_ST_H
#include "lib/net/socket.h"
#define TOR_TLS_MAGIC 0x71571571
typedef enum {
TOR_TLS_ST_HANDSHAKE, TOR_TLS_ST_OPEN, TOR_TLS_ST_GOTCLOSE,
TOR_TLS_ST_SENTCLOSE, TOR_TLS_ST_CLOSED, TOR_TLS_ST_RENEGOTIATE,
TOR_TLS_ST_BUFFEREVENT
} tor_tls_state_t;
#define tor_tls_state_bitfield_t ENUM_BF(tor_tls_state_t)
struct tor_tls_context_t {
int refcnt;
tor_tls_context_impl_t *ctx;
struct tor_x509_cert_t *my_link_cert;
struct tor_x509_cert_t *my_id_cert;
struct tor_x509_cert_t *my_auth_cert;
crypto_pk_t *link_key;
crypto_pk_t *auth_key;
};
struct tor_tls_t {
uint32_t magic;
tor_tls_context_t *context;
tor_tls_impl_t *ssl;
tor_socket_t socket;
char *address;
tor_tls_state_bitfield_t state : 3;
unsigned int isServer:1;
unsigned int wasV2Handshake:1;
unsigned int got_renegotiate:1;
#ifdef ENABLE_OPENSSL
int8_t client_cipher_list_type;
size_t wantwrite_n;
unsigned long last_write_count;
unsigned long last_read_count;
void (*negotiated_callback)(tor_tls_t *tls, void *arg);
void *callback_arg;
#endif
#ifdef ENABLE_NSS
uint64_t last_write_count;
uint64_t last_read_count;
#endif
};
#endif