hs_client.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 "hs_ident.h"
  10. #include "connection_edge.h"
  11. #include "rendclient.h"
  12. #include "hs_client.h"
  13. /** A prop224 v3 HS circuit successfully connected to the hidden
  14. * service. Update the stream state at <b>hs_conn_ident</b> appropriately. */
  15. static void
  16. hs_client_attempt_succeeded(const hs_ident_edge_conn_t *hs_conn_ident)
  17. {
  18. (void) hs_conn_ident;
  19. /* TODO: When implementing client side */
  20. return;
  21. }
  22. /** A circuit just finished connecting to a hidden service that the stream
  23. * <b>conn</b> has been waiting for. Let the HS subsystem know about this. */
  24. void
  25. hs_client_note_connection_attempt_succeeded(const edge_connection_t *conn)
  26. {
  27. tor_assert(connection_edge_is_rendezvous_stream(conn));
  28. if (BUG(conn->rend_data && conn->hs_ident)) {
  29. log_warn(LD_BUG, "Stream had both rend_data and hs_ident..."
  30. "Prioritizing hs_ident");
  31. }
  32. if (conn->hs_ident) { /* It's v3: pass it to the prop224 handler */
  33. hs_client_attempt_succeeded(conn->hs_ident);
  34. return;
  35. } else if (conn->rend_data) { /* It's v2: pass it to the legacy handler */
  36. rend_client_note_connection_attempt_ended(conn->rend_data);
  37. return;
  38. }
  39. }