[tor-commits] [torsocks/master] Add comments in torsocks.h

dgoulet at torproject.org dgoulet at torproject.org
Fri Apr 4 22:40:25 UTC 2014


commit d2eec3629d0d9bd9749934b687ea2070b73809de
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Sat Jun 15 19:50:36 2013 -0400

    Add comments in torsocks.h
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/lib/torsocks.h |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/lib/torsocks.h b/src/lib/torsocks.h
index 14d0694..9ba2955 100644
--- a/src/lib/torsocks.h
+++ b/src/lib/torsocks.h
@@ -23,6 +23,11 @@
 #include <common/compat.h>
 #include <common/config-file.h>
 
+/*
+ * This defines a function pointer to the original libc call of "name" so the
+ * libc call outside of torsocks can be used. These are declared for each
+ * symbol torsocks hijacked.
+ */
 #define TSOCKS_LIBC_DECL(name, type, sig) \
 	type (*tsocks_libc_##name)(sig);
 
@@ -53,11 +58,16 @@ TSOCKS_LIBC_DECL(connect, LIBC_CONNECT_RET_TYPE, LIBC_CONNECT_SIG)
 #define LIBC_CONNECT_DECL \
 	LIBC_CONNECT_RET_TYPE LIBC_CONNECT_NAME(LIBC_CONNECT_SIG)
 
+/*
+ * Those are actions to do during the lookup process of libc symbols. For
+ * instance the connect(2) syscall is essential to Torsocks so the function
+ * call exits if not found.
+ */
 enum tsocks_sym_action {
 	TSOCKS_SYM_EXIT_NOT_FOUND	= 1,
 };
 
-/* Global configuration of torsocks. */
+/* Global configuration. Initialized once in the library constructor. */
 extern struct configuration tsocks_config;
 
 #endif /* TORSOCKS_H */





More information about the tor-commits mailing list