pubsub_connect.h (1963B)
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 **/ 28 typedef struct pubsub_connector_t pubsub_connector_t; 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 48 int pubsub_connector_register_type_(struct pubsub_connector_t *, 49 msg_type_id_t, 50 dispatch_typefns_t *, 51 const char *file, 52 unsigned line); 53 54 #endif /* !defined(TOR_PUBSUB_CONNECT_H) */