1 /* Copyright (c) 2017-2020, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
4 #ifndef TOR_TEST_HELPERS_H
5 #define TOR_TEST_HELPERS_H
7 #define BUFFERS_PRIVATE
9 #include "core/or/or.h"
12 const char *get_yesterday_date_str(void);
14 circuit_t
* dummy_origin_circuit_new(int num_cells
);
16 /* Number of descriptors contained in test_descriptors.txt. */
17 #define HELPER_NUMBER_OF_DESCRIPTORS 8
19 void helper_setup_fake_routerlist(void);
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
);
26 int mock_tor_addr_lookup__fail_on_bad_addrs(const char *name
,
27 uint16_t family
, tor_addr_t
*out
);
29 void mock_connection_or_change_state(or_connection_t
*conn
, uint8_t state
);
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
);
36 int create_test_directory_structure(const char *parent_dir
);
38 extern const char TEST_DESCRIPTORS
[];
40 void *helper_setup_pubsub(const struct testcase_t
*);
41 int helper_cleanup_pubsub(const struct testcase_t
*, void *);
43 extern const struct testcase_setup_t helper_pubsub_setup
;
45 origin_circuit_t
*new_test_origin_circuit(bool has_opened
,
46 struct timeval circ_start_time
,
48 extend_info_t
**ei_list
);
50 #endif /* !defined(TOR_TEST_HELPERS_H) */