channeltls.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* * Copyright (c) 2012-2014, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file channeltls.h
  5. * \brief Header file for channeltls.c
  6. **/
  7. #ifndef TOR_CHANNELTLS_H
  8. #define TOR_CHANNELTLS_H
  9. #include "or.h"
  10. #include "channel.h"
  11. #define BASE_CHAN_TO_TLS(c) (channel_tls_from_base((c)))
  12. #define TLS_CHAN_TO_BASE(c) (channel_tls_to_base((c)))
  13. #define TLS_CHAN_MAGIC 0x8a192427U
  14. #ifdef TOR_CHANNEL_INTERNAL_
  15. struct channel_tls_s {
  16. /* Base channel_t struct */
  17. channel_t base_;
  18. /* or_connection_t pointer */
  19. or_connection_t *conn;
  20. };
  21. #endif /* TOR_CHANNEL_INTERNAL_ */
  22. channel_t * channel_tls_connect(const tor_addr_t *addr, uint16_t port,
  23. const char *id_digest);
  24. channel_listener_t * channel_tls_get_listener(void);
  25. channel_listener_t * channel_tls_start_listener(void);
  26. channel_t * channel_tls_handle_incoming(or_connection_t *orconn);
  27. /* Casts */
  28. channel_t * channel_tls_to_base(channel_tls_t *tlschan);
  29. channel_tls_t * channel_tls_from_base(channel_t *chan);
  30. /* Things for connection_or.c to call back into */
  31. void channel_tls_handle_cell(cell_t *cell, or_connection_t *conn);
  32. void channel_tls_handle_state_change_on_orconn(channel_tls_t *chan,
  33. or_connection_t *conn,
  34. uint8_t old_state,
  35. uint8_t state);
  36. void channel_tls_handle_var_cell(var_cell_t *var_cell,
  37. or_connection_t *conn);
  38. void channel_tls_update_marks(or_connection_t *conn);
  39. /* Cleanup at shutdown */
  40. void channel_tls_free_all(void);
  41. #endif