]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/ossl_shim/async_bio.h
Following the license change, modify the boilerplates in test/
[thirdparty/openssl.git] / test / ossl_shim / async_bio.h
CommitLineData
92ab7db6
MC
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
eef977aa 3 *
909f1a2e 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
92ab7db6
MC
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
eef977aa
MC
9
10#ifndef HEADER_ASYNC_BIO
11#define HEADER_ASYNC_BIO
12
7b73b7be 13#include <openssl/base.h>
eef977aa
MC
14#include <openssl/bio.h>
15
eef977aa
MC
16
17// AsyncBioCreate creates a filter BIO for testing asynchronous state
18// machines which consume a stream socket. Reads and writes will fail
19// and return EAGAIN unless explicitly allowed. Each async BIO has a
20// read quota and a write quota. Initially both are zero. As each is
21// incremented, bytes are allowed to flow through the BIO.
7b73b7be 22bssl::UniquePtr<BIO> AsyncBioCreate();
eef977aa
MC
23
24// AsyncBioCreateDatagram creates a filter BIO for testing for
25// asynchronous state machines which consume datagram sockets. The read
26// and write quota count in packets rather than bytes.
7b73b7be 27bssl::UniquePtr<BIO> AsyncBioCreateDatagram();
eef977aa
MC
28
29// AsyncBioAllowRead increments |bio|'s read quota by |count|.
30void AsyncBioAllowRead(BIO *bio, size_t count);
31
32// AsyncBioAllowWrite increments |bio|'s write quota by |count|.
33void AsyncBioAllowWrite(BIO *bio, size_t count);
34
35// AsyncBioEnforceWriteQuota configures where |bio| enforces its write quota.
36void AsyncBioEnforceWriteQuota(BIO *bio, bool enforce);
37
38
39#endif // HEADER_ASYNC_BIO