hs_client.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Copyright (c) 2016-2017, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file hs_service.c
  5. * \brief Implement next generation hidden service client functionality
  6. **/
  7. #include "or.h"
  8. #include "hs_circuit.h"
  9. #include "connection_edge.h"
  10. #include "rendclient.h"
  11. #include "hs_client.h"
  12. /** A prop224 v3 HS circuit successfully connected to the hidden
  13. * service. Update the stream state at <b>hs_conn_ident</b> appropriately. */
  14. static void
  15. hs_client_attempt_succeeded(const hs_ident_edge_conn_t *hs_conn_ident)
  16. {
  17. (void) hs_conn_ident;
  18. /* TODO: When implementing client side */
  19. return;
  20. }
  21. /** A circuit just finished connecting to a hidden service that the stream
  22. * <b>conn</b> has been waiting for. Let the HS subsystem know about this. */
  23. void
  24. hs_client_note_connection_attempt_succeeded(const edge_connection_t *conn)
  25. {
  26. tor_assert(connection_edge_is_rendezvous_stream(conn));
  27. if (BUG(conn->rend_data && conn->hs_ident)) {
  28. log_warn(LD_BUG, "Stream had both rend_data and hs_ident..."
  29. "Prioritizing hs_ident");
  30. }
  31. if (conn->hs_ident) { /* It's v3: pass it to the prop224 handler */
  32. hs_client_attempt_succeeded(conn->hs_ident);
  33. return;
  34. } else if (conn->rend_data) { /* It's v2: pass it to the legacy handler */
  35. rend_client_note_connection_attempt_ended(conn->rend_data);
  36. return;
  37. }
  38. }