2018-06-23 00:19:16 +01:00
|
|
|
/* Copyright (c) 2018, Google Inc.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
|
|
|
|
|
|
|
#ifndef HEADER_TEST_HANDSHAKE
|
|
|
|
#define HEADER_TEST_HANDSHAKE
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
#include <openssl/base.h>
|
|
|
|
|
2018-06-23 01:06:54 +01:00
|
|
|
#include "settings_writer.h"
|
|
|
|
|
2018-06-23 00:19:16 +01:00
|
|
|
// RetryAsync is called after a failed operation on |ssl| with return code
|
|
|
|
// |ret|. If the operation should be retried, it simulates one asynchronous
|
|
|
|
// event and returns true. Otherwise it returns false.
|
|
|
|
bool RetryAsync(SSL *ssl, int ret);
|
|
|
|
|
|
|
|
// CheckIdempotentError runs |func|, an operation on |ssl|, ensuring that
|
|
|
|
// errors are idempotent.
|
|
|
|
int CheckIdempotentError(const char *name, SSL *ssl, std::function<int()> func);
|
|
|
|
|
2018-06-23 01:06:54 +01:00
|
|
|
// DoSplitHandshake performs a handoff and handback of an in-progress handshake,
|
|
|
|
// updating |ssl_uniqueptr| in place.
|
|
|
|
bool DoSplitHandshake(bssl::UniquePtr<SSL> *ssl_uniqueptr,
|
|
|
|
SettingsWriter *writer, bool is_resume);
|
|
|
|
|
2018-06-23 00:19:16 +01:00
|
|
|
#endif // HEADER_TEST_HANDSHAKE
|