dispatch_naming.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #ifndef TOR_DISPATCH_NAMING_H
  7. #define TOR_DISPATCH_NAMING_H
  8. #include "lib/dispatch/msgtypes.h"
  9. #include <stddef.h>
  10. /**
  11. * Return an existing channel ID by name, allocating the channel ID if
  12. * if necessary. Returns ERROR_ID if we have run out of
  13. * channels
  14. */
  15. channel_id_t get_channel_id(const char *);
  16. /**
  17. * Return the name corresponding to a given channel ID.
  18. **/
  19. const char *get_channel_id_name(channel_id_t);
  20. /**
  21. * Return the total number of _named_ channel IDs.
  22. **/
  23. size_t get_num_channel_ids(void);
  24. /* As above, but for messages. */
  25. message_id_t get_message_id(const char *);
  26. const char *get_message_id_name(message_id_t);
  27. size_t get_num_message_ids(void);
  28. /* As above, but for subsystems */
  29. subsys_id_t get_subsys_id(const char *);
  30. const char *get_subsys_id_name(subsys_id_t);
  31. size_t get_num_subsys_ids(void);
  32. /* As above, but for types. Note that types additionally must be
  33. * "defined", if any message is to use them. */
  34. msg_type_id_t get_msg_type_id(const char *);
  35. const char *get_msg_type_id_name(msg_type_id_t);
  36. size_t get_num_msg_type_ids(void);
  37. void dispatch_naming_init(void);
  38. #endif /* !defined(TOR_DISPATCH_NAMING_H) */