[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [obfsproxy/master] Define the supported protocols in protocol.[ch] instead of main.c.
commit 5bfb2da574fbc02c11c6bd09c00baef4fe3017b3
Author: George Kadianakis <desnacked@xxxxxxxxx>
Date: Sun May 29 04:49:56 2011 +0200
Define the supported protocols in protocol.[ch] instead of main.c.
---
src/main.c | 7 ++++---
src/protocol.c | 3 +++
src/protocol.h | 6 +++---
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/main.c b/src/main.c
index 8f03df1..68ea424 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,8 +24,9 @@ static void usage(void) __attribute__((noreturn));
#define SEPERATOR "+"
#define MAXPROTOCOLS 20
-const char *supported_protocols[] = { "obfs2", "dummy" };
-const int n_supported_protocols = 2;
+/* protocol.c */
+extern char *supported_protocols[];
+extern int n_supported_protocols;
static void
usage(void)
@@ -35,7 +36,7 @@ usage(void)
"Usage: obfsproxy protocol_name [protocol_args] protocol_options %s protocol_name ...\n"
"Available protocols:",
SEPERATOR);
- /* cheapie */
+ /* this is awful. */
for (i=0;i<n_supported_protocols;i++)
fprintf(stderr," [%s]", supported_protocols[i]);
fprintf(stderr,"\n");
diff --git a/src/protocol.c b/src/protocol.c
index ce96f86..b86bb5f 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -9,6 +9,9 @@
#include "protocols/obfs2.h"
#include "protocols/dummy.h"
+char *supported_protocols[] = { "obfs2", "dummy" };
+int n_supported_protocols = 2;
+
/**
This function initializes <protocol>.
It's called once in the runtime of the program for each proto.
diff --git a/src/protocol.h b/src/protocol.h
index 646bf7c..0f45f22 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -3,12 +3,12 @@
#ifndef PROTOCOL_H
#define PROTOCOL_H
-#define DUMMY_PROTOCOL 0
-#define OBFS2_PROTOCOL 1
-
struct evbuffer;
struct listener_t;
+#define DUMMY_PROTOCOL 1
+#define OBFS2_PROTOCOL 2
+
/**
This struct defines parameters of the protocol per-listener basis.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits