2014-08-05 07:28:57 +01:00
|
|
|
/* Copyright (c) 2014, Google Inc.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
|
|
|
|
|
|
|
#ifndef HEADER_ASYNC_BIO
|
|
|
|
#define HEADER_ASYNC_BIO
|
|
|
|
|
|
|
|
#include <openssl/bio.h>
|
|
|
|
|
2015-03-22 20:31:27 +00:00
|
|
|
#include "../../crypto/test/scoped_types.h"
|
2015-02-09 07:37:18 +00:00
|
|
|
|
2014-08-05 07:28:57 +01:00
|
|
|
|
2015-02-09 17:59:46 +00:00
|
|
|
// AsyncBioCreate creates a filter BIO for testing asynchronous state
|
2014-08-11 23:43:38 +01:00
|
|
|
// machines which consume a stream socket. Reads and writes will fail
|
|
|
|
// and return EAGAIN unless explicitly allowed. Each async BIO has a
|
|
|
|
// read quota and a write quota. Initially both are zero. As each is
|
|
|
|
// incremented, bytes are allowed to flow through the BIO.
|
2015-02-09 17:59:46 +00:00
|
|
|
ScopedBIO AsyncBioCreate();
|
2014-08-05 07:28:57 +01:00
|
|
|
|
2015-02-09 17:59:46 +00:00
|
|
|
// AsyncBioCreateDatagram creates a filter BIO for testing for
|
2014-08-11 23:43:38 +01:00
|
|
|
// asynchronous state machines which consume datagram sockets. The read
|
|
|
|
// and write quota count in packets rather than bytes.
|
2015-02-09 17:59:46 +00:00
|
|
|
ScopedBIO AsyncBioCreateDatagram();
|
2014-08-05 07:28:57 +01:00
|
|
|
|
2015-02-09 17:59:46 +00:00
|
|
|
// AsyncBioAllowRead increments |bio|'s read quota by |count|.
|
|
|
|
void AsyncBioAllowRead(BIO *bio, size_t count);
|
2014-08-11 23:43:38 +01:00
|
|
|
|
2015-02-09 17:59:46 +00:00
|
|
|
// AsyncBioAllowWrite increments |bio|'s write quota by |count|.
|
|
|
|
void AsyncBioAllowWrite(BIO *bio, size_t count);
|
2014-08-05 07:28:57 +01:00
|
|
|
|
2015-11-02 22:16:13 +00:00
|
|
|
// AsyncBioEnforceWriteQuota configures where |bio| enforces its write quota.
|
|
|
|
void AsyncBioEnforceWriteQuota(BIO *bio, bool enforce);
|
|
|
|
|
2014-08-05 07:28:57 +01:00
|
|
|
|
|
|
|
#endif // HEADER_ASYNC_BIO
|