2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
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
10 #ifndef HEADER_ASYNC_BIO
11 #define HEADER_ASYNC_BIO
13 #include <openssl/base.h>
14 #include <openssl/bio.h>
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.
22 bssl::UniquePtr<BIO> AsyncBioCreate();
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.
27 bssl::UniquePtr<BIO> AsyncBioCreateDatagram();
29 // AsyncBioAllowRead increments |bio|'s read quota by |count|.
30 void AsyncBioAllowRead(BIO *bio, size_t count);
32 // AsyncBioAllowWrite increments |bio|'s write quota by |count|.
33 void AsyncBioAllowWrite(BIO *bio, size_t count);
35 // AsyncBioEnforceWriteQuota configures where |bio| enforces its write quota.
36 void AsyncBioEnforceWriteQuota(BIO *bio, bool enforce);
39 #endif // HEADER_ASYNC_BIO