2016-02-27 18:48:19 +01:00
|
|
|
/* * Copyright (c) 2012-2016, The Tor Project, Inc. */
|
2012-08-01 13:18:42 +02:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file channeltls.h
|
|
|
|
* \brief Header file for channeltls.c
|
|
|
|
**/
|
|
|
|
|
2012-10-12 18:13:10 +02:00
|
|
|
#ifndef TOR_CHANNELTLS_H
|
|
|
|
#define TOR_CHANNELTLS_H
|
2012-08-01 13:18:42 +02:00
|
|
|
|
|
|
|
#include "or.h"
|
|
|
|
#include "channel.h"
|
|
|
|
|
2012-10-09 23:16:51 +02:00
|
|
|
#define BASE_CHAN_TO_TLS(c) (channel_tls_from_base((c)))
|
|
|
|
#define TLS_CHAN_TO_BASE(c) (channel_tls_to_base((c)))
|
|
|
|
|
|
|
|
#define TLS_CHAN_MAGIC 0x8a192427U
|
2012-08-01 13:18:42 +02:00
|
|
|
|
2012-10-12 18:22:13 +02:00
|
|
|
#ifdef TOR_CHANNEL_INTERNAL_
|
2012-08-01 13:18:42 +02:00
|
|
|
|
|
|
|
struct channel_tls_s {
|
|
|
|
/* Base channel_t struct */
|
2012-10-12 18:22:13 +02:00
|
|
|
channel_t base_;
|
2012-08-01 13:18:42 +02:00
|
|
|
/* or_connection_t pointer */
|
|
|
|
or_connection_t *conn;
|
|
|
|
};
|
|
|
|
|
2012-10-12 18:22:13 +02:00
|
|
|
#endif /* TOR_CHANNEL_INTERNAL_ */
|
2012-08-01 13:18:42 +02:00
|
|
|
|
|
|
|
channel_t * channel_tls_connect(const tor_addr_t *addr, uint16_t port,
|
2016-08-30 15:44:42 +02:00
|
|
|
const char *id_digest,
|
|
|
|
const ed25519_public_key_t *ed_id);
|
2012-10-09 09:51:33 +02:00
|
|
|
channel_listener_t * channel_tls_get_listener(void);
|
|
|
|
channel_listener_t * channel_tls_start_listener(void);
|
2012-08-01 13:18:42 +02:00
|
|
|
channel_t * channel_tls_handle_incoming(or_connection_t *orconn);
|
|
|
|
|
2012-10-09 23:16:51 +02:00
|
|
|
/* Casts */
|
|
|
|
|
|
|
|
channel_t * channel_tls_to_base(channel_tls_t *tlschan);
|
|
|
|
channel_tls_t * channel_tls_from_base(channel_t *chan);
|
|
|
|
|
2012-08-01 13:18:42 +02:00
|
|
|
/* Things for connection_or.c to call back into */
|
|
|
|
void channel_tls_handle_cell(cell_t *cell, or_connection_t *conn);
|
|
|
|
void channel_tls_handle_state_change_on_orconn(channel_tls_t *chan,
|
|
|
|
or_connection_t *conn,
|
|
|
|
uint8_t old_state,
|
|
|
|
uint8_t state);
|
|
|
|
void channel_tls_handle_var_cell(var_cell_t *var_cell,
|
|
|
|
or_connection_t *conn);
|
2014-09-05 20:08:46 +02:00
|
|
|
void channel_tls_update_marks(or_connection_t *conn);
|
2012-08-01 13:18:42 +02:00
|
|
|
|
|
|
|
/* Cleanup at shutdown */
|
|
|
|
void channel_tls_free_all(void);
|
|
|
|
|
2016-06-02 15:46:12 +02:00
|
|
|
extern uint64_t stats_n_authorize_cells_processed;
|
|
|
|
extern uint64_t stats_n_authenticate_cells_processed;
|
|
|
|
extern uint64_t stats_n_versions_cells_processed;
|
|
|
|
extern uint64_t stats_n_netinfo_cells_processed;
|
|
|
|
extern uint64_t stats_n_vpadding_cells_processed;
|
|
|
|
extern uint64_t stats_n_certs_cells_processed;
|
|
|
|
extern uint64_t stats_n_auth_challenge_cells_processed;
|
|
|
|
|
2014-10-08 21:39:34 +02:00
|
|
|
#ifdef CHANNELTLS_PRIVATE
|
|
|
|
STATIC void channel_tls_process_certs_cell(var_cell_t *cell,
|
|
|
|
channel_tls_t *tlschan);
|
|
|
|
STATIC void channel_tls_process_auth_challenge_cell(var_cell_t *cell,
|
|
|
|
channel_tls_t *tlschan);
|
|
|
|
STATIC void channel_tls_common_init(channel_tls_t *tlschan);
|
2014-10-16 15:07:50 +02:00
|
|
|
STATIC void channel_tls_process_authenticate_cell(var_cell_t *cell,
|
|
|
|
channel_tls_t *tlschan);
|
2014-10-08 21:39:34 +02:00
|
|
|
#endif
|
|
|
|
|
2012-08-01 13:18:42 +02:00
|
|
|
#endif
|
|
|
|
|