File: stream_test_helper.h

package info (click to toggle)
aws-crt-python 0.20.4%2Bdfsg-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 72,656 kB
  • sloc: ansic: 381,805; python: 23,008; makefile: 6,251; sh: 4,536; cpp: 699; ruby: 208; java: 77; perl: 73; javascript: 46; xml: 11
file content (63 lines) | stat: -rw-r--r-- 1,743 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef AWS_HTTP_STREAM_TEST_HELPER_H
#define AWS_HTTP_STREAM_TEST_HELPER_H
/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#include <aws/http/request_response.h>

struct aws_http_connection;
struct aws_http_headers;
struct aws_http_message;
struct aws_http_stream;

struct client_stream_tester {
    struct aws_allocator *alloc;
    struct aws_http_stream *stream;

    int response_status;

    enum aws_http_header_block current_header_block;

    /* Array of completed Informational (1xx) responses */
    struct aws_http_message *info_responses[4];
    size_t num_info_responses;

    /* As Informational (1xx) headers arrive, they're buffered here.
     * They copied into a new `info_responses` entry when the block is done */
    struct aws_http_headers *current_info_headers;

    /* Main header-block */
    struct aws_http_headers *response_headers;
    bool response_headers_done;

    /* Trailing header-block */
    struct aws_http_headers *response_trailer;
    bool response_trailer_done;

    struct aws_byte_buf response_body;

    bool complete;
    int on_complete_error_code;

    /* Whether connection is open when on_complete fires */
    bool on_complete_connection_is_open;
    struct aws_http_stream_metrics metrics;

    bool destroyed;
};

struct client_stream_tester_options {
    struct aws_http_message *request;
    struct aws_http_connection *connection;
};

int client_stream_tester_init(
    struct client_stream_tester *tester,
    struct aws_allocator *alloc,
    const struct client_stream_tester_options *options);

void client_stream_tester_clean_up(struct client_stream_tester *tester);

#endif /* AWS_HTTP_STREAM_TEST_HELPER_H */