]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/ossl_shim/packeted_bio.h
struct timeval include guards
[thirdparty/openssl.git] / test / ossl_shim / packeted_bio.h
CommitLineData
92ab7db6 1/*
4cff10dc 2 * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
eef977aa 3 *
92ab7db6
MC
4 * Licensed under the OpenSSL license (the "License"). You may not use
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
MC
9
10#ifndef HEADER_PACKETED_BIO
11#define HEADER_PACKETED_BIO
12
4cff10dc 13#include "e_os.h"
7b73b7be 14#include <openssl/base.h>
eef977aa
MC
15#include <openssl/bio.h>
16
eef977aa 17// PacketedBioCreate creates a filter BIO which implements a reliable in-order
7b73b7be
MC
18// blocking datagram socket. It internally maintains a clock and honors
19// |BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT| based on it.
eef977aa 20//
7b73b7be
MC
21// During a |BIO_read|, the peer may signal the filter BIO to simulate a
22// timeout. If |advance_clock| is true, it automatically advances the clock and
23// continues reading, subject to the read deadline. Otherwise, it fails
24// immediately. The caller must then call |PacketedBioAdvanceClock| before
25// retrying |BIO_read|.
26bssl::UniquePtr<BIO> PacketedBioCreate(bool advance_clock);
27
28// PacketedBioGetClock returns the current time for |bio|.
29timeval PacketedBioGetClock(const BIO *bio);
30
31// PacketedBioAdvanceClock advances |bio|'s internal clock and returns true if
32// there is a pending timeout. Otherwise, it returns false.
33bool PacketedBioAdvanceClock(BIO *bio);
eef977aa
MC
34
35
36#endif // HEADER_PACKETED_BIO