2020-01-08 18:39:17 -05:00
|
|
|
/* Copyright (c) 2017-2020, The Tor Project, Inc. */
|
2015-01-29 15:09:53 +00:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
#ifndef TOR_TEST_HELPERS_H
|
|
|
|
#define TOR_TEST_HELPERS_H
|
|
|
|
|
2018-09-15 16:33:05 +03:00
|
|
|
#define BUFFERS_PRIVATE
|
|
|
|
|
2018-07-05 16:34:59 -04:00
|
|
|
#include "core/or/or.h"
|
2019-03-08 09:41:43 -06:00
|
|
|
#include "tinytest.h"
|
2017-05-02 16:36:59 +03:00
|
|
|
|
2015-01-29 15:09:53 +00:00
|
|
|
const char *get_yesterday_date_str(void);
|
|
|
|
|
2016-10-16 06:40:37 -05:00
|
|
|
circuit_t * dummy_origin_circuit_new(int num_cells);
|
|
|
|
|
2015-02-18 09:19:38 -05:00
|
|
|
/* Number of descriptors contained in test_descriptors.txt. */
|
|
|
|
#define HELPER_NUMBER_OF_DESCRIPTORS 8
|
|
|
|
|
|
|
|
void helper_setup_fake_routerlist(void);
|
|
|
|
|
2016-08-25 11:11:23 -04:00
|
|
|
#define GET(path) "GET " path " HTTP/1.0\r\n\r\n"
|
|
|
|
void connection_write_to_buf_mock(const char *string, size_t len,
|
2017-04-27 03:36:02 +02:00
|
|
|
connection_t *conn, int compressed);
|
2018-09-15 16:33:05 +03:00
|
|
|
char *buf_get_contents(buf_t *buf, size_t *sz_out);
|
2016-08-25 11:11:23 -04:00
|
|
|
|
2017-01-03 10:11:23 -05:00
|
|
|
int mock_tor_addr_lookup__fail_on_bad_addrs(const char *name,
|
|
|
|
uint16_t family, tor_addr_t *out);
|
|
|
|
|
2019-10-21 18:00:02 +08:00
|
|
|
void mock_connection_or_change_state(or_connection_t *conn, uint8_t state);
|
|
|
|
|
|
|
|
or_connection_t *test_conn_get_proxy_or_connection(unsigned int proxy_type);
|
2017-05-02 16:35:22 +03:00
|
|
|
connection_t *test_conn_get_connection(uint8_t state,
|
|
|
|
uint8_t type, uint8_t purpose);
|
2017-01-13 11:20:31 -05:00
|
|
|
or_options_t *helper_parse_options(const char *conf);
|
2017-05-02 16:35:22 +03:00
|
|
|
|
2015-02-18 09:19:38 -05:00
|
|
|
extern const char TEST_DESCRIPTORS[];
|
|
|
|
|
2019-03-08 09:41:43 -06:00
|
|
|
void *helper_setup_pubsub(const struct testcase_t *);
|
|
|
|
int helper_cleanup_pubsub(const struct testcase_t *, void *);
|
|
|
|
|
|
|
|
extern const struct testcase_setup_t helper_pubsub_setup;
|
|
|
|
|
2020-05-14 10:44:56 +10:00
|
|
|
origin_circuit_t *new_test_origin_circuit(bool has_opened,
|
|
|
|
struct timeval circ_start_time,
|
|
|
|
int path_len,
|
|
|
|
extend_info_t **ei_list);
|
|
|
|
|
2017-09-15 16:24:44 -04:00
|
|
|
#endif /* !defined(TOR_TEST_HELPERS_H) */
|
2015-01-29 15:09:53 +00:00
|
|
|
|