101
83
serf_context_t *context;
102
84
serf_connection_t *connection;
103
85
serf_bucket_alloc_t *bkt_alloc;
106
/* Array of actions which server will replay when client connected. */
107
test_server_action_t *action_list;
108
/* Size of action_list array. */
109
apr_size_t action_count;
110
/* Index of current action. */
111
apr_size_t cur_action;
113
/* Array of messages the server will receive from the client. */
114
test_server_message_t *message_list;
115
/* Size of message_list array. */
116
apr_size_t message_count;
117
/* Index of current message. */
118
apr_size_t cur_message;
120
/* Number of messages received that the server didn't respond to yet. */
121
apr_size_t outstanding_responses;
123
/* Position in message buffer (incoming messages being read). */
124
apr_size_t message_buf_pos;
126
/* Position in action buffer. (outgoing messages being sent). */
127
apr_size_t action_buf_pos;
129
/* Address for server binding. */
130
88
apr_sockaddr_t *serv_addr;
131
apr_socket_t *serv_sock;
133
/* Accepted client socket. NULL if there is no client socket. */
134
apr_socket_t *client_sock;
90
serv_ctx_t *proxy_ctx;
91
apr_sockaddr_t *proxy_addr;
136
93
/* An extra baton which can be freely used by tests. */
141
#define TEST_SERVER_DUMP 1
143
/* Default port for our test server. */
144
#define SERV_PORT 12345
145
#define SERV_PORT_STR "12345"
147
apr_status_t test_server_create(test_baton_t **tb,
148
test_server_message_t *message_list,
149
apr_size_t message_count,
150
test_server_action_t *action_list,
151
apr_size_t action_count,
153
const char *host_url,
154
apr_sockaddr_t *address,
155
serf_connection_setup_t conn_setup,
158
apr_status_t test_server_run(test_baton_t *tb,
159
apr_short_interval_time_t duration,
162
apr_status_t test_server_destroy(test_baton_t *tb, apr_pool_t *pool);
164
#ifndef APR_VERSION_AT_LEAST /* Introduced in APR 1.3.0 */
165
#define APR_VERSION_AT_LEAST(major,minor,patch) \
166
(((major) < APR_MAJOR_VERSION) \
167
|| ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
168
|| ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && \
169
(patch) <= APR_PATCH_VERSION))
170
#endif /* APR_VERSION_AT_LEAST */
98
apr_status_t test_server_setup(test_baton_t **tb_p,
99
test_server_message_t *message_list,
100
apr_size_t message_count,
101
test_server_action_t *action_list,
102
apr_size_t action_count,
104
serf_connection_setup_t conn_setup,
107
apr_status_t test_server_proxy_setup(
109
test_server_message_t *serv_message_list,
110
apr_size_t serv_message_count,
111
test_server_action_t *serv_action_list,
112
apr_size_t serv_action_count,
113
test_server_message_t *proxy_message_list,
114
apr_size_t proxy_message_count,
115
test_server_action_t *proxy_action_list,
116
apr_size_t proxy_action_count,
118
serf_connection_setup_t conn_setup,
121
apr_status_t test_server_teardown(test_baton_t *tb, apr_pool_t *pool);
123
apr_pool_t *test_setup();
124
void test_teardown(apr_pool_t *test_pool);
172
126
#endif /* TEST_SERF_H */