pubsub_connect.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Copyright (c) 2001, Matej Pfajfar.
  2. * Copyright (c) 2001-2004, Roger Dingledine.
  3. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  4. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * @file pubsub_connect.h
  8. * @brief Header for functions that add relationships to a pubsub builder.
  9. *
  10. * These functions are used by modules that need to add publication and
  11. * subscription requests. Most users will want to call these functions
  12. * indirectly, via the macros in pubsub_macros.h.
  13. **/
  14. #ifndef TOR_PUBSUB_CONNECT_H
  15. #define TOR_PUBSUB_CONNECT_H
  16. #include "lib/dispatch/msgtypes.h"
  17. struct pub_binding_t;
  18. /**
  19. * A "dispatch connector" is a view of the dispatcher that a subsystem
  20. * uses while initializing itself. It is specific to the subsystem, and
  21. * ensures that each subsystem doesn't need to identify itself
  22. * repeatedly while registering its messages.
  23. **/
  24. typedef struct pubsub_connector_t pubsub_connector_t;
  25. int pubsub_add_pub_(struct pubsub_connector_t *con,
  26. struct pub_binding_t *out,
  27. channel_id_t channel,
  28. message_id_t msg,
  29. msg_type_id_t type,
  30. unsigned flags,
  31. const char *file,
  32. unsigned line);
  33. int pubsub_add_sub_(struct pubsub_connector_t *con,
  34. recv_fn_t recv_fn,
  35. channel_id_t channel,
  36. message_id_t msg,
  37. msg_type_id_t type,
  38. unsigned flags,
  39. const char *file,
  40. unsigned line);
  41. int pubsub_connector_register_type_(struct pubsub_connector_t *,
  42. msg_type_id_t,
  43. dispatch_typefns_t *,
  44. const char *file,
  45. unsigned line);
  46. #endif