1 1.1 christos /* 2 1.1 christos * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 3 1.1 christos * 4 1.1 christos * Licensed under the OpenSSL license (the "License"). You may not use 5 1.1 christos * this file except in compliance with the License. You can obtain a copy 6 1.1 christos * in the file LICENSE in the source distribution or at 7 1.1 christos * https://www.openssl.org/source/license.html 8 1.1 christos */ 9 1.1 christos 10 1.1 christos #ifndef OSSL_TEST_SHIM_PACKETED_BIO_H 11 1.1 christos #define OSSL_TEST_SHIM_PACKETED_BIO_H 12 1.1 christos 13 1.1 christos #include <openssl/base.h> 14 1.1 christos #include <openssl/bio.h> 15 1.1 christos 16 1.1 christos // PacketedBioCreate creates a filter BIO which implements a reliable in-order 17 1.1 christos // blocking datagram socket. It internally maintains a clock and honors 18 1.1 christos // |BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT| based on it. 19 1.1 christos // 20 1.1 christos // During a |BIO_read|, the peer may signal the filter BIO to simulate a 21 1.1 christos // timeout. If |advance_clock| is true, it automatically advances the clock and 22 1.1 christos // continues reading, subject to the read deadline. Otherwise, it fails 23 1.1 christos // immediately. The caller must then call |PacketedBioAdvanceClock| before 24 1.1 christos // retrying |BIO_read|. 25 1.1 christos bssl::UniquePtr<BIO> PacketedBioCreate(bool advance_clock); 26 1.1 christos 27 1.1 christos // PacketedBioGetClock returns the current time for |bio|. 28 1.1 christos timeval PacketedBioGetClock(const BIO *bio); 29 1.1 christos 30 1.1 christos // PacketedBioAdvanceClock advances |bio|'s internal clock and returns true if 31 1.1 christos // there is a pending timeout. Otherwise, it returns false. 32 1.1 christos bool PacketedBioAdvanceClock(BIO *bio); 33 1.1 christos 34 1.1 christos 35 1.1 christos #endif // OSSL_TEST_SHIM_PACKETED_BIO_H 36