tor  0.4.2.0-alpha-dev
tortls_st.h
1 /* Copyright (c) 2003, Roger Dingledine
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2019, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
6 #ifndef TOR_TORTLS_ST_H
7 #define TOR_TORTLS_ST_H
8 
9 #include "lib/net/socket.h"
10 
11 #define TOR_TLS_MAGIC 0x71571571
12 
13 typedef enum {
14  TOR_TLS_ST_HANDSHAKE, TOR_TLS_ST_OPEN, TOR_TLS_ST_GOTCLOSE,
15  TOR_TLS_ST_SENTCLOSE, TOR_TLS_ST_CLOSED, TOR_TLS_ST_RENEGOTIATE,
16  TOR_TLS_ST_BUFFEREVENT
17 } tor_tls_state_t;
18 #define tor_tls_state_bitfield_t ENUM_BF(tor_tls_state_t)
19 
21  int refcnt;
22  tor_tls_context_impl_t *ctx;
23  struct tor_x509_cert_t *my_link_cert;
24  struct tor_x509_cert_t *my_id_cert;
25  struct tor_x509_cert_t *my_auth_cert;
26  crypto_pk_t *link_key;
27  crypto_pk_t *auth_key;
28 };
29 
33 struct tor_tls_t {
34  uint32_t magic;
35  tor_tls_context_t *context;
36  tor_tls_impl_t *ssl;
39  char *address;
40  tor_tls_state_bitfield_t state : 3;
43  unsigned int isServer:1;
44  unsigned int wasV2Handshake:1;
50  unsigned int got_renegotiate:1;
51 #ifdef ENABLE_OPENSSL
52 
54  int8_t client_cipher_list_type;
55  size_t wantwrite_n;
60  unsigned long last_write_count;
61  unsigned long last_read_count;
64  void (*negotiated_callback)(tor_tls_t *tls, void *arg);
66  void *callback_arg;
67 #endif /* defined(ENABLE_OPENSSL) */
68 #ifdef ENABLE_NSS
69 
70  uint64_t last_write_count;
71  uint64_t last_read_count;
72 #endif
73 };
74 
75 #endif /* !defined(TOR_TORTLS_ST_H) */
char * address
Definition: tortls_st.h:39
tor_socket_t socket
Definition: tortls_st.h:37
unsigned int got_renegotiate
Definition: tortls_st.h:50
unsigned int wasV2Handshake
Definition: tortls_st.h:44
unsigned int isServer
Definition: tortls_st.h:43
#define tor_socket_t
Definition: nettypes.h:36
tor_tls_impl_t * ssl
Definition: tortls_st.h:36
tor_tls_state_bitfield_t state
Definition: tortls_st.h:40
Header for socket.c.