| 1 |
// Copyright (c) 2014, Google Inc. |
| 2 |
// SPDX-License-Identifier: ISC |
| 3 |
|
| 4 |
#ifndef HEADER_PACKETED_BIO |
| 5 |
#define HEADER_PACKETED_BIO |
| 6 |
|
| 7 |
#include <openssl/base.h> |
| 8 |
#include <openssl/bio.h> |
| 9 |
|
| 10 |
#if defined(OPENSSL_WINDOWS) |
| 11 |
OPENSSL_MSVC_PRAGMA(warning(push, 3)) |
| 12 |
#include <winsock2.h> |
| 13 |
OPENSSL_MSVC_PRAGMA(warning(pop)) |
| 14 |
#else |
| 15 |
#include <sys/time.h> |
| 16 |
#endif |
| 17 |
|
| 18 |
|
| 19 |
// PacketedBioCreate creates a filter BIO which implements a reliable in-order |
| 20 |
// blocking datagram socket. It uses the value of |*clock| as the clock. |
| 21 |
// |
| 22 |
// During a |BIO_read|, the peer may signal the filter BIO to simulate a |
| 23 |
// timeout. The operation will fail immediately. The caller must then call |
| 24 |
// |PacketedBioAdvanceClock| before retrying |BIO_read|. |
| 25 |
bssl::UniquePtr<BIO> PacketedBioCreate(timeval *clock); |
| 26 |
|
| 27 |
// PacketedBioAdvanceClock advances |bio|'s clock and returns true if there is a |
| 28 |
// pending timeout. Otherwise, it returns false. |
| 29 |
bool PacketedBioAdvanceClock(BIO *bio); |
| 30 |
|
| 31 |
|
| 32 |
#endif // HEADER_PACKETED_BIO |