Tor  0.4.7.0-alpha-dev
pubsub_connect.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 pubsub_connect.h
9  * @brief Header for functions that add relationships to a pubsub builder.
10  *
11  * These functions are used by modules that need to add publication and
12  * subscription requests. Most users will want to call these functions
13  * indirectly, via the macros in pubsub_macros.h.
14  **/
15 
16 #ifndef TOR_PUBSUB_CONNECT_H
17 #define TOR_PUBSUB_CONNECT_H
18 
19 #include "lib/dispatch/msgtypes.h"
20 
21 struct pub_binding_t;
22 /**
23  * A "dispatch connector" is a view of the dispatcher that a subsystem
24  * uses while initializing itself. It is specific to the subsystem, and
25  * ensures that each subsystem doesn't need to identify itself
26  * repeatedly while registering its messages.
27  **/
29 
30 int pubsub_add_pub_(struct pubsub_connector_t *con,
31  struct pub_binding_t *out,
32  channel_id_t channel,
33  message_id_t msg,
34  msg_type_id_t type,
35  unsigned flags,
36  const char *file,
37  unsigned line);
38 
39 int pubsub_add_sub_(struct pubsub_connector_t *con,
40  recv_fn_t recv_fn,
41  channel_id_t channel,
42  message_id_t msg,
43  msg_type_id_t type,
44  unsigned flags,
45  const char *file,
46  unsigned line);
47 
51  const char *file,
52  unsigned line);
53 
54 #endif /* !defined(TOR_PUBSUB_CONNECT_H) */
Types used for messages in the dispatcher code.
uint16_t msg_type_id_t
Definition: msgtypes.h:29
void(* recv_fn_t)(const msg_t *m)
Definition: msgtypes.h:66
struct pubsub_connector_t pubsub_connector_t
int pubsub_add_sub_(struct pubsub_connector_t *con, recv_fn_t recv_fn, channel_id_t channel, message_id_t msg, msg_type_id_t type, unsigned flags, const char *file, unsigned line)
Definition: pubsub_build.c:171
int pubsub_connector_register_type_(struct pubsub_connector_t *, msg_type_id_t, dispatch_typefns_t *, const char *file, unsigned line)
Definition: pubsub_build.c:216
int pubsub_add_pub_(struct pubsub_connector_t *con, struct pub_binding_t *out, channel_id_t channel, message_id_t msg, msg_type_id_t type, unsigned flags, const char *file, unsigned line)
Definition: pubsub_build.c:124