Go to the documentation of this file.
24 #include "../../crypto/internal.h"
31 const uint8_t kOpcodePacket =
'P';
32 const uint8_t kOpcodeTimeout =
'T';
33 const uint8_t kOpcodeTimeoutAck =
't';
36 explicit PacketedBio(
timeval *clock_arg)
41 bool HasTimeout()
const {
50 if (bio->
method != &g_packeted_bio_method) {
53 return (PacketedBio *)bio->
ptr;
60 int chunk_len = INT_MAX;
74 static int PacketedWrite(
BIO *bio,
const char *
in,
int inl) {
84 header[1] = (inl >> 24) & 0xff;
85 header[2] = (inl >> 16) & 0xff;
86 header[3] = (inl >> 8) & 0xff;
96 if (
ret < 0 || (inl > 0 &&
ret == 0)) {
104 static int PacketedRead(
BIO *bio,
char *
out,
int outl) {
120 if (
opcode == kOpcodeTimeout) {
122 if (
data->HasTimeout()) {
123 fprintf(
stderr,
"Unprocessed timeout!\n");
159 if (
opcode != kOpcodePacket) {
172 uint32_t len = (len_bytes[0] << 24) | (len_bytes[1] << 16) |
173 (len_bytes[2] << 8) | len_bytes[3];
180 fprintf(
stderr,
"Packeted BIO was truncated\n");
184 if (outl > (
int)
len) {
192 static long PacketedCtrl(
BIO *bio,
int cmd,
long num,
void *
ptr) {
203 static int PacketedNew(
BIO *bio) {
208 static int PacketedFree(
BIO *bio) {
235 PacketedCallbackCtrl,
241 bssl::UniquePtr<BIO> bio(
BIO_new(&g_packeted_bio_method));
245 bio->ptr =
new PacketedBio(clock);
251 if (
data ==
nullptr) {
255 if (!
data->HasTimeout()) {
259 data->clock->tv_usec +=
data->timeout.tv_usec;
260 data->clock->tv_sec +=
data->clock->tv_usec / 1000000;
261 data->clock->tv_usec %= 1000000;
262 data->clock->tv_sec +=
data->timeout.tv_sec;
long(* bio_info_cb)(BIO *bio, int event, const char *parg, int cmd, long larg, long return_value)
bool PacketedBioAdvanceClock(BIO *bio)
static void * OPENSSL_memset(void *dst, int c, size_t n)
#define BIO_copy_next_retry
const BIO_METHOD * method
unsigned __int64 uint64_t
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
struct absl::base_internal::@2940::AllocList::Header header
#define BIO_callback_ctrl
UniquePtr< SSL_SESSION > ret
constexpr auto GetData(C &c) noexcept -> decltype(GetDataImpl(c, 0))
bssl::UniquePtr< BIO > PacketedBioCreate(timeval *clock)
#define BIO_set_retry_read
#define BIO_clear_retry_flags
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:38