summaryrefslogtreecommitdiff
path: root/src/or/channel.h
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2012-10-08 20:49:19 -0700
committerAndrea Shepard <andrea@torproject.org>2012-10-08 20:49:19 -0700
commit89a00ee63ae61e707343432dd9f74702cf60ac3c (patch)
tree4d13e8e586878e33457e4bbaa7f6c431860795a0 /src/or/channel.h
parentee4e88e4d9891a24334870616067d21580f95704 (diff)
downloadtor-89a00ee63ae61e707343432dd9f74702cf60ac3c.tar.gz
tor-89a00ee63ae61e707343432dd9f74702cf60ac3c.zip
Use typedefs for function pointer return values and s/listener/listener_fn/ for distinctness
Diffstat (limited to 'src/or/channel.h')
-rw-r--r--src/or/channel.h32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/or/channel.h b/src/or/channel.h
index 696ae07c0f..70ea30fcf1 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -11,6 +11,11 @@
#include "or.h"
+/* Channel handler function pointer typedefs */
+typedef void (*channel_listener_fn_ptr)(channel_t *, channel_t *);
+typedef void (*channel_cell_handler_fn_ptr)(channel_t *, cell_t *);
+typedef void (*channel_var_cell_handler_fn_ptr)(channel_t *, var_cell_t *);
+
/*
* Channel struct; see the channel_t typedef in or.h. A channel is an
* abstract interface for the OR-to-OR connection, similar to connection_or_t,
@@ -65,7 +70,7 @@ struct channel_s {
union {
struct {
/* Registered listen handler to call on incoming connection */
- void (*listener)(channel_t *, channel_t *);
+ channel_listener_fn_ptr listener;
/* List of pending incoming connections */
smartlist_t *incoming_list;
@@ -78,8 +83,8 @@ struct channel_s {
} listener;
struct {
/* Registered handlers for incoming cells */
- void (*cell_handler)(channel_t *, cell_t *);
- void (*var_cell_handler)(channel_t *, var_cell_t *);
+ channel_cell_handler_fn_ptr cell_handler;
+ channel_var_cell_handler_fn_ptr var_cell_handler;
/* Methods implemented by the lower layer */
@@ -238,19 +243,20 @@ void channel_write_var_cell(channel_t *chan, var_cell_t *cell);
/* Channel callback registrations */
/* Listener callback */
-void (* channel_get_listener(channel_t *chan))(channel_t *, channel_t *);
-void channel_set_listener(channel_t *chan,
- void (*listener)(channel_t *, channel_t *) );
+channel_listener_fn_ptr channel_get_listener_fn(channel_t *chan);
+void channel_set_listener_fn(channel_t *chan,
+ channel_listener_fn_ptr listener);
/* Incoming cell callbacks */
-void (* channel_get_cell_handler(channel_t *chan))
- (channel_t *, cell_t *);
-void (* channel_get_var_cell_handler(channel_t *chan))
- (channel_t *, var_cell_t *);
+channel_cell_handler_fn_ptr channel_get_cell_handler(channel_t *chan);
+
+channel_var_cell_handler_fn_ptr
+channel_get_var_cell_handler(channel_t *chan);
+
void channel_set_cell_handlers(channel_t *chan,
- void (*cell_handler)(channel_t *, cell_t *),
- void (*var_cell_handler)(channel_t *,
- var_cell_t *));
+ channel_cell_handler_fn_ptr cell_handler,
+ channel_var_cell_handler_fn_ptr
+ var_cell_handler);
/* Clean up closed channels periodically; called from run_scheduled_events()
* in main.c