]>
Commit | Line | Data |
---|---|---|
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 | 9 | |
ae4186b0 DMSP |
10 | #ifndef OSSL_TEST_SHIM_ASYNC_BIO_H |
11 | #define OSSL_TEST_SHIM_ASYNC_BIO_H | |
eef977aa | 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 | 22 | bssl::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 | 27 | bssl::UniquePtr<BIO> AsyncBioCreateDatagram(); |
eef977aa MC |
28 | |
29 | // AsyncBioAllowRead increments |bio|'s read quota by |count|. | |
30 | void AsyncBioAllowRead(BIO *bio, size_t count); | |
31 | ||
32 | // AsyncBioAllowWrite increments |bio|'s write quota by |count|. | |
33 | void AsyncBioAllowWrite(BIO *bio, size_t count); | |
34 | ||
35 | // AsyncBioEnforceWriteQuota configures where |bio| enforces its write quota. | |
36 | void AsyncBioEnforceWriteQuota(BIO *bio, bool enforce); | |
37 | ||
38 | ||
ae4186b0 | 39 | #endif // OSSL_TEST_SHIM_ASYNC_BIO_H |