webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
packeted_bio.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, Google Inc.
2  *
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.
6  *
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. */
14 
15 #ifndef HEADER_PACKETED_BIO
16 #define HEADER_PACKETED_BIO
17 
18 #include <openssl/base.h>
19 #include <openssl/bio.h>
20 
21 #if defined(OPENSSL_WINDOWS)
23 #include <winsock2.h>
25 #else
26 #include <sys/time.h>
27 #endif
28 
29 
30 // PacketedBioCreate creates a filter BIO which implements a reliable in-order
31 // blocking datagram socket. It internally maintains a clock and honors
32 // |BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT| based on it.
33 //
34 // During a |BIO_read|, the peer may signal the filter BIO to simulate a
35 // timeout. If |advance_clock| is true, it automatically advances the clock and
36 // continues reading, subject to the read deadline. Otherwise, it fails
37 // immediately. The caller must then call |PacketedBioAdvanceClock| before
38 // retrying |BIO_read|.
39 bssl::UniquePtr<BIO> PacketedBioCreate(bool advance_clock);
40 
41 // PacketedBioGetClock returns the current time for |bio|.
42 timeval PacketedBioGetClock(const BIO *bio);
43 
44 // PacketedBioAdvanceClock advances |bio|'s internal clock and returns true if
45 // there is a pending timeout. Otherwise, it returns false.
46 bool PacketedBioAdvanceClock(BIO *bio);
47 
48 
49 #endif // HEADER_PACKETED_BIO
bssl::UniquePtr< BIO > PacketedBioCreate(bool advance_clock)
Definition: packeted_bio.cc:275
OPENSSL_MSVC_PRAGMA(warning(disable:4702))
Definition: e_aes.c:70
Definition: bio.h:810
bool PacketedBioAdvanceClock(BIO *bio)
Definition: packeted_bio.cc:288
timeval PacketedBioGetClock(const BIO *bio)
Definition: packeted_bio.cc:284
midl_pragma warning(disable:2111) midl_pragma warning(disable
Definition: Accessible2.idl:352