tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

test_helpers.h (1761B)


      1 /* Copyright (c) 2017-2021, The Tor Project, Inc. */
      2 /* See LICENSE for licensing information */
      3 
      4 #ifndef TOR_TEST_HELPERS_H
      5 #define TOR_TEST_HELPERS_H
      6 
      7 #define BUFFERS_PRIVATE
      8 
      9 #include "core/or/or.h"
     10 #include "tinytest.h"
     11 
     12 const char *get_yesterday_date_str(void);
     13 
     14 circuit_t * dummy_origin_circuit_new(int num_cells);
     15 
     16 /* Number of descriptors contained in test_descriptors.txt. */
     17 #define HELPER_NUMBER_OF_DESCRIPTORS 8
     18 
     19 void helper_setup_fake_routerlist(void);
     20 
     21 #define GET(path) "GET " path " HTTP/1.0\r\n\r\n"
     22 void connection_write_to_buf_mock(const char *string, size_t len,
     23                                  connection_t *conn, int compressed);
     24 char *buf_get_contents(buf_t *buf, size_t *sz_out);
     25 
     26 int mock_tor_addr_lookup__fail_on_bad_addrs(const char *name,
     27                                            uint16_t family, tor_addr_t *out);
     28 
     29 void mock_connection_or_change_state(or_connection_t *conn, uint8_t state);
     30 
     31 or_connection_t *test_conn_get_proxy_or_connection(unsigned int proxy_type);
     32 connection_t *test_conn_get_connection(uint8_t state,
     33                                       uint8_t type, uint8_t purpose);
     34 or_options_t *helper_parse_options(const char *conf);
     35 
     36 int create_test_directory_structure(const char *parent_dir);
     37 
     38 extern const char TEST_DESCRIPTORS[];
     39 
     40 void *helper_setup_pubsub(const struct testcase_t *);
     41 int helper_cleanup_pubsub(const struct testcase_t *, void *);
     42 
     43 extern const struct testcase_setup_t helper_pubsub_setup;
     44 
     45 origin_circuit_t *new_test_origin_circuit(bool has_opened,
     46                                          struct timeval circ_start_time,
     47                                          int path_len,
     48                                          extend_info_t **ei_list);
     49 
     50 #endif /* !defined(TOR_TEST_HELPERS_H) */