[tor-commits] [obfsproxy/master] Merge branch 'bug3204' into bug3204_actual_merge

nickm at torproject.org nickm at torproject.org
Thu Jun 9 21:05:16 UTC 2011


commit 1e750f25009721ff183483fad831b79ee9de8ed1
Merge: f949fac afdc2d8
Author: George Kadianakis <desnacked at gmail.com>
Date:   Thu Jun 9 15:44:12 2011 +0200

    Merge branch 'bug3204' into bug3204_actual_merge
    
    Conflicts:
    	src/main.c
    	src/protocol.c
    	src/protocol.h
    	src/protocols/dummy.c
    	src/socks.h
    	src/test/unittest_obfs2.c

 src/main.c                |  300 +++++++++++++++++++++++++++++++++------------
 src/network.c             |   75 +++--------
 src/network.h             |   15 ++-
 src/protocol.c            |   88 +++++++++----
 src/protocol.h            |   45 ++++---
 src/protocols/dummy.c     |   70 ++++++++++-
 src/protocols/dummy.h     |    5 +-
 src/protocols/obfs2.c     |  175 ++++++++++++++++++++++++--
 src/protocols/obfs2.h     |    5 +-
 src/test/unittest_obfs2.c |  158 ++++++++++++------------
 src/test/unittest_socks.c |    2 +-
 11 files changed, 654 insertions(+), 284 deletions(-)

diff --cc src/protocol.c
index bcd5330,57c0c23..32d8d0d
--- a/src/protocol.c
+++ b/src/protocol.c
@@@ -72,7 -80,10 +80,10 @@@ proto_send(struct protocol_t *proto, vo
      return -1;
  }
  
+ /**
+    This function is responsible for receiving protocol data.
+ */
 -int
 +enum recv_ret
  proto_recv(struct protocol_t *proto, void *source, void *dest) {
    assert(proto);
    if (proto->vtable->recv)
diff --cc src/protocol.h
index 4a17c73,0a7c452..69ea4aa
--- a/src/protocol.h
+++ b/src/protocol.h
@@@ -39,6 -44,15 +44,15 @@@ struct protocol_t 
    */
    void *state;
  };
+ int set_up_protocol(int n_options, char **options, 
+                     struct protocol_params_t *params);
+ struct protocol_t *proto_new(struct protocol_params_t *params);
+ void proto_destroy(struct protocol_t *proto);
+ int proto_handshake(struct protocol_t *proto, void *buf);
+ int proto_send(struct protocol_t *proto, void *source, void *dest);
 -int proto_recv(struct protocol_t *proto, void *source, void *dest);
++enum recv_ret proto_recv(struct protocol_t *proto, void *source, void *dest);
+ 
+ void proto_params_free(protocol_params_t *params);
  
  
  typedef struct protocol_vtable {
diff --cc src/protocols/dummy.c
index 68bd7a1,2a24b56..5f6b8eb
--- a/src/protocols/dummy.c
+++ b/src/protocols/dummy.c
@@@ -9,14 -9,16 +9,16 @@@
  #include <event2/buffer.h>
  
  #include "dummy.h"
+ #include "../network.h"
  #include "../util.h"
  #include "../protocol.h"
 -
 +#include "../network.h"
  
  static int dummy_send(void *nothing,
 -               struct evbuffer *source, struct evbuffer *dest);
 -static int dummy_recv(void *nothing, struct evbuffer *source,
 -               struct evbuffer *dest);
 +                                struct evbuffer *source, struct evbuffer *dest);
 +static enum recv_ret dummy_recv(void *nothing, struct evbuffer *source,
 +                                struct evbuffer *dest);
+ static void usage(void);
  
  static protocol_vtable *vtable=NULL;
  
diff --cc src/protocols/obfs2.c
index c93db0e,5e91b5c..d886594
--- a/src/protocols/obfs2.c
+++ b/src/protocols/obfs2.c
@@@ -17,9 -17,9 +17,10 @@@
  
  #include "obfs2_crypt.h"
  #include "obfs2.h"
+ #include "../network.h"
  #include "../util.h"
  #include "../protocol.h"
 +#include "../network.h"
  
  static void obfs2_state_free(void *state);
  static int obfs2_send_initial_message(void *state, struct evbuffer *buf);
@@@ -441,14 -575,12 +585,17 @@@ obfs2_recv(void *s, struct evbuffer *so
  
    dbg(("Processing %d bytes data onto destination buffer\n",
         (int) evbuffer_get_length(source)));
 -  return crypt_and_transmit(state->recv_crypto, source, dest);
 +  crypt_and_transmit(state->recv_crypto, source, dest);
 +
 +  if (r != RECV_SEND_PENDING)
 +    r = RECV_GOOD;
 +
 +  return r;
  }
  
+ /** 
+     Frees obfs2 state 's' 
+ */
  static void
  obfs2_state_free(void *s)
  {





More information about the tor-commits mailing list