btrack.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Copyright (c) 2007-2018, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file btrack.c
  5. * \brief Bootstrap trackers
  6. *
  7. * Initializes and shuts down the specific bootstrap trackers. These
  8. * trackers help the reporting of bootstrap progress by maintaining
  9. * state information about various subsystems within tor. When the
  10. * correct state changes happen, these trackers emit controller
  11. * events.
  12. *
  13. * These trackers avoid referring directly to the internals of state
  14. * objects of other subsystems.
  15. *
  16. * btrack_circuit.c contains the tracker for origin circuits.
  17. *
  18. * btrack_orconn.c contains the tracker for OR connections.
  19. *
  20. * Eventually there will be a tracker for directory downloads as well.
  21. **/
  22. #include "feature/control/btrack_circuit.h"
  23. #include "feature/control/btrack_orconn.h"
  24. #include "feature/control/btrack_sys.h"
  25. #include "lib/subsys/subsys.h"
  26. static int
  27. btrack_init(void)
  28. {
  29. if (btrack_orconn_init())
  30. return -1;
  31. if (btrack_circ_init())
  32. return -1;
  33. return 0;
  34. }
  35. static void
  36. btrack_fini(void)
  37. {
  38. btrack_orconn_fini();
  39. btrack_circ_fini();
  40. }
  41. const subsys_fns_t sys_btrack = {
  42. .name = "btrack",
  43. .supported = true,
  44. .level = -30,
  45. .initialize = btrack_init,
  46. .shutdown = btrack_fini,
  47. };