sendme.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Copyright (c) 2019, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file sendme.h
  5. * \brief Header file for sendme.c.
  6. **/
  7. #ifndef TOR_SENDME_H
  8. #define TOR_SENDME_H
  9. #include "core/or/edge_connection_st.h"
  10. #include "core/or/crypt_path_st.h"
  11. #include "core/or/circuit_st.h"
  12. /* Sending SENDME cell. */
  13. void sendme_connection_edge_consider_sending(edge_connection_t *edge_conn);
  14. void sendme_circuit_consider_sending(circuit_t *circ,
  15. crypt_path_t *layer_hint);
  16. /* Processing SENDME cell. */
  17. int sendme_process_circuit_level(crypt_path_t *layer_hint,
  18. circuit_t *circ, const uint8_t *cell_payload,
  19. uint16_t cell_payload_len);
  20. int sendme_process_stream_level(edge_connection_t *conn, circuit_t *circ,
  21. uint16_t cell_body_len);
  22. /* Update deliver window functions. */
  23. int sendme_stream_data_received(edge_connection_t *conn);
  24. int sendme_circuit_data_received(circuit_t *circ, crypt_path_t *layer_hint);
  25. /* Update package window functions. */
  26. int sendme_note_circuit_data_packaged(circuit_t *circ,
  27. crypt_path_t *layer_hint);
  28. int sendme_note_stream_data_packaged(edge_connection_t *conn);
  29. /* Track cell digest. */
  30. void sendme_record_cell_digest(circuit_t *circ);
  31. void sendme_circuit_record_inbound_cell(crypt_path_t *cpath);
  32. void sendme_circuit_record_outbound_cell(or_circuit_t *or_circ);
  33. /* Circuit level information. */
  34. bool sendme_circuit_cell_is_next(int window);
  35. /* Private section starts. */
  36. #ifdef SENDME_PRIVATE
  37. /*
  38. * Unit tests declaractions.
  39. */
  40. #ifdef TOR_UNIT_TESTS
  41. STATIC int get_emit_min_version(void);
  42. STATIC int get_accept_min_version(void);
  43. STATIC bool cell_version_is_valid(uint8_t cell_version);
  44. STATIC ssize_t build_cell_payload_v1(const uint8_t *cell_digest,
  45. uint8_t *payload);
  46. STATIC bool sendme_is_valid(const circuit_t *circ,
  47. const uint8_t *cell_payload,
  48. size_t cell_payload_len);
  49. #endif /* TOR_UNIT_TESTS */
  50. #endif /* SENDME_PRIVATE */
  51. #endif /* !defined(TOR_SENDME_H) */