|
Tor
0.4.7.0-alpha-dev
|
Construct a dispatch_t in safer, more OO way. More...
#include "lib/dispatch/dispatch.h"#include "lib/dispatch/dispatch_cfg.h"#include "lib/dispatch/dispatch_naming.h"#include "lib/dispatch/msgtypes.h"#include "lib/pubsub/pubsub_flags.h"#include "lib/pubsub/pub_binding_st.h"#include "lib/pubsub/pubsub_build.h"#include "lib/pubsub/pubsub_builder_st.h"#include "lib/pubsub/pubsub_connect.h"#include "lib/container/smartlist.h"#include "lib/log/util_bug.h"#include "lib/malloc/malloc.h"#include <string.h>Go to the source code of this file.
Construct a dispatch_t in safer, more OO way.
Definition in file pubsub_build.c.
| int pubsub_add_pub_ | ( | pubsub_connector_t * | con, |
| pub_binding_t * | out, | ||
| channel_id_t | channel, | ||
| message_id_t | msg, | ||
| msg_type_id_t | type, | ||
| unsigned | flags, | ||
| const char * | file, | ||
| unsigned | line | ||
| ) |
Use con to add a request for being able to publish messages of type msg with auxiliary data of type on channel.
Definition at line 124 of file pubsub_build.c.
| int pubsub_add_sub_ | ( | 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 | ||
| ) |
Use con to add a request for being able to publish messages of type msg with auxiliary data of type on channel, passing them to the callback in recv_fn.
Definition at line 171 of file pubsub_build.c.
| dispatch_t* pubsub_builder_finalize | ( | pubsub_builder_t * | builder, |
| pubsub_items_t ** | items_out | ||
| ) |
Create a new dispatcher as configured in a pubsub_builder_t.
Consumes and frees its input.
Definition at line 278 of file pubsub_build.c.
Referenced by tor_mainloop_connect_pubsub().
| void pubsub_builder_free_ | ( | pubsub_builder_t * | pb | ) |
Release all storage held by a pubsub_builder_t.
You'll (mostly) only want to call this function on an error case: if you're constructing a dispatch_t instead, you should call pubsub_builder_finalize() to consume the pubsub_builder_t.
Definition at line 74 of file pubsub_build.c.
| pubsub_builder_t* pubsub_builder_new | ( | void | ) |
Construct and return a new pubsub_builder_t.
Definition at line 56 of file pubsub_build.c.
Referenced by pubsub_install().
| pubsub_connector_t* pubsub_connector_for_subsystem | ( | pubsub_builder_t * | builder, |
| subsys_id_t | subsys | ||
| ) |
Create and return a pubsub_connector_t for the subsystem with ID subsys to use in adding publications, subscriptions, and types to builder.
Definition at line 89 of file pubsub_build.c.
| void pubsub_connector_free_ | ( | pubsub_connector_t * | con | ) |
Release all storage held by a pubsub_connector_t.
Definition at line 107 of file pubsub_build.c.
| int pubsub_connector_register_type_ | ( | pubsub_connector_t * | con, |
| msg_type_id_t | type, | ||
| dispatch_typefns_t * | fns, | ||
| const char * | file, | ||
| unsigned | line | ||
| ) |
Use con to define the functions to use for manipulating the type type. Any function pointers left as NULL will be implemented as no-ops.
Definition at line 216 of file pubsub_build.c.
| void pubsub_items_clear_bindings | ( | pubsub_items_t * | items | ) |
Remove the dispatch_ptr fields for all the relevant publish bindings in items. The prevents subsequent dispatch_pub_() calls from sending messages to a dispatcher that has been freed.
Definition at line 263 of file pubsub_build.c.
| void pubsub_items_free_ | ( | pubsub_items_t * | cfg | ) |
Release all storage held in a pubsub_items_t.
Definition at line 42 of file pubsub_build.c.
|
static |
Initialize the dispatch_ptr field in every relevant publish binding for d.
Definition at line 245 of file pubsub_build.c.
|
static |
Construct and return a new empty pubsub_items_t.
Definition at line 32 of file pubsub_build.c.