diff options
author | Chelsea H. Komlo <chelsea.komlo@gmail.com> | 2016-10-16 06:40:37 -0500 |
---|---|---|
committer | Chelsea H. Komlo <chelsea.komlo@gmail.com> | 2016-11-24 08:12:27 -0500 |
commit | b95998ef0c31c78a9952621eb1f7365ceb1d2c84 (patch) | |
tree | 2c2662db12ad1b45a7ec6416e66b2954977346f5 /src/test/test_helpers.c | |
parent | 4614f8e6816d559f8fbe9ae0f42d751d3fb95c77 (diff) | |
download | tor-b95998ef0c31c78a9952621eb1f7365ceb1d2c84.tar.gz tor-b95998ef0c31c78a9952621eb1f7365ceb1d2c84.zip |
moving useful test helper to test_helpers.h
Diffstat (limited to 'src/test/test_helpers.c')
-rw-r--r-- | src/test/test_helpers.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c index 130ec43a3a..fbc09faa0e 100644 --- a/src/test/test_helpers.c +++ b/src/test/test_helpers.c @@ -10,6 +10,7 @@ #include "orconfig.h" #include "or.h" +#include "relay.h" #include "routerlist.h" #include "nodelist.h" #include "buffers.h" @@ -23,6 +24,8 @@ DISABLE_GCC_WARNING(overlength-strings) * at large. */ #endif #include "test_descriptors.inc" +#include "or.h" +#include "circuitlist.h" #ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS ENABLE_GCC_WARNING(overlength-strings) #endif @@ -105,3 +108,21 @@ connection_write_to_buf_mock(const char *string, size_t len, write_to_buf(string, len, conn->outbuf); } +circuit_t * +dummy_origin_circuit_new(int n_cells) +{ + origin_circuit_t *circ = origin_circuit_new(); + int i; + cell_t cell; + + for (i=0; i < n_cells; ++i) { + crypto_rand((void*)&cell, sizeof(cell)); + cell_queue_append_packed_copy(TO_CIRCUIT(circ), + &TO_CIRCUIT(circ)->n_chan_cells, + 1, &cell, 1, 0); + } + + TO_CIRCUIT(circ)->purpose = CIRCUIT_PURPOSE_C_GENERAL; + return TO_CIRCUIT(circ); +} + |