Tor  0.4.7.0-alpha-dev
dispatch_naming.h
Go to the documentation of this file.
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-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * @file dispatch_naming.h
9  * @brief Header for dispatch_naming.c
10  **/
11 
12 #ifndef TOR_DISPATCH_NAMING_H
13 #define TOR_DISPATCH_NAMING_H
14 
15 #include "lib/dispatch/msgtypes.h"
16 #include <stddef.h>
17 
18 /**
19  * Return an existing channel ID by name, allocating the channel ID if
20  * if necessary. Returns ERROR_ID if we have run out of
21  * channels
22  */
23 channel_id_t get_channel_id(const char *);
24 /**
25  * Return the name corresponding to a given channel ID.
26  **/
27 const char *get_channel_id_name(channel_id_t);
28 /**
29  * Return the total number of _named_ channel IDs.
30  **/
31 size_t get_num_channel_ids(void);
32 
33 /* As above, but for messages. */
34 message_id_t get_message_id(const char *);
35 const char *get_message_id_name(message_id_t);
36 size_t get_num_message_ids(void);
37 
38 /* As above, but for subsystems */
39 subsys_id_t get_subsys_id(const char *);
40 const char *get_subsys_id_name(subsys_id_t);
41 size_t get_num_subsys_ids(void);
42 
43 /* As above, but for types. Note that types additionally must be
44  * "defined", if any message is to use them. */
45 msg_type_id_t get_msg_type_id(const char *);
46 const char *get_msg_type_id_name(msg_type_id_t);
47 size_t get_num_msg_type_ids(void);
48 
49 void dispatch_naming_init(void);
50 
51 #endif /* !defined(TOR_DISPATCH_NAMING_H) */
size_t get_num_channel_ids(void)
const char * get_channel_id_name(channel_id_t)
channel_id_t get_channel_id(const char *)
Types used for messages in the dispatcher code.
uint16_t subsys_id_t
Definition: msgtypes.h:22
uint16_t msg_type_id_t
Definition: msgtypes.h:29