| 1 |
// Copyright (c) 2014, Google Inc. |
| 2 |
// SPDX-License-Identifier: ISC |
| 3 |
|
| 4 |
#ifndef HEADER_ASYNC_BIO |
| 5 |
#define HEADER_ASYNC_BIO |
| 6 |
|
| 7 |
#include <openssl/bio.h> |
| 8 |
|
| 9 |
|
| 10 |
// AsyncBioCreate creates a filter BIO for testing asynchronous state |
| 11 |
// machines which consume a stream socket. Reads and writes will fail |
| 12 |
// and return EAGAIN unless explicitly allowed. Each async BIO has a |
| 13 |
// read quota and a write quota. Initially both are zero. As each is |
| 14 |
// incremented, bytes are allowed to flow through the BIO. |
| 15 |
bssl::UniquePtr<BIO> AsyncBioCreate(); |
| 16 |
|
| 17 |
// AsyncBioCreateDatagram creates a filter BIO for testing for |
| 18 |
// asynchronous state machines which consume datagram sockets. The read |
| 19 |
// and write quota count in packets rather than bytes. |
| 20 |
bssl::UniquePtr<BIO> AsyncBioCreateDatagram(); |
| 21 |
|
| 22 |
// AsyncBioAllowRead increments |bio|'s read quota by |count|. |
| 23 |
void AsyncBioAllowRead(BIO *bio, size_t count); |
| 24 |
|
| 25 |
// AsyncBioAllowWrite increments |bio|'s write quota by |count|. |
| 26 |
void AsyncBioAllowWrite(BIO *bio, size_t count); |
| 27 |
|
| 28 |
// AsyncBioEnforceWriteQuota configures where |bio| enforces its write quota. |
| 29 |
void AsyncBioEnforceWriteQuota(BIO *bio, bool enforce); |
| 30 |
|
| 31 |
|
| 32 |
#endif // HEADER_ASYNC_BIO |