summaryrefslogtreecommitdiff
path: root/src/lib/pubsub/pubsub_connect.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-01-15 09:01:20 -0500
committerNick Mathewson <nickm@torproject.org>2019-03-25 16:35:33 -0400
commit9e60482b8073f2d43187c36c9159fd4367d7140a (patch)
treee73931e80e7f67442f2f865b630d98a338b1b3cb /src/lib/pubsub/pubsub_connect.h
parent24b945f713a713bba0ec4f0d8297b49cbc45c5a1 (diff)
downloadtor-9e60482b8073f2d43187c36c9159fd4367d7140a.tar.gz
tor-9e60482b8073f2d43187c36c9159fd4367d7140a.zip
Pubsub: an OO layer on top of lib/dispatch
This "publish/subscribe" layer sits on top of lib/dispatch, and tries to provide more type-safety and cross-checking for the lower-level layer. Even with this commit, we're still not done: more checking will come in the next commit, and a set of usability/typesafety macros will come after.
Diffstat (limited to 'src/lib/pubsub/pubsub_connect.h')
-rw-r--r--src/lib/pubsub/pubsub_connect.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/lib/pubsub/pubsub_connect.h b/src/lib/pubsub/pubsub_connect.h
new file mode 100644
index 0000000000..b63f9dc438
--- /dev/null
+++ b/src/lib/pubsub/pubsub_connect.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2001, Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * @file pubsub_connect.h
+ * @brief Header for functions that add relationships to a pubsub builder.
+ *
+ * These functions are used by modules that need to add publication and
+ * subscription requests.
+ **/
+
+#ifndef TOR_PUBSUB_CONNECT_H
+#define TOR_PUBSUB_CONNECT_H
+
+#include "lib/dispatch/msgtypes.h"
+
+struct pub_binding_t;
+struct pubsub_connector_t;
+
+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);
+
+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);
+
+int pubsub_connector_define_type_(struct pubsub_connector_t *,
+ msg_type_id_t,
+ dispatch_typefns_t *,
+ const char *file,
+ unsigned line);
+
+#endif