1 /* Copyright (c) 2014, Google Inc.
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
15 #ifndef HEADER_ASYNC_BIO
16 #define HEADER_ASYNC_BIO
18 #include <openssl/bio.h>
21 // async_bio_create creates a filter BIO for testing asynchronous
22 // state machines. Reads and writes will fail and return EAGAIN unless
23 // explicitly allowed. Each async BIO has a read quota and a write
24 // quota. Initially both are zero. As each is incremented, bytes are
25 // allowed to flow through the BIO.
26 BIO *async_bio_create();
28 // async_bio_allow_read increments |bio|'s read quota by |bytes|.
29 void async_bio_allow_read(BIO *bio, size_t bytes);
31 // async_bio_allow_write increments |bio|'s write quota by |bytes|.
32 void async_bio_allow_write(BIO *bio, size_t bytes);
35 #endif // HEADER_ASYNC_BIO