blob: 7d792994a80829e455456383640094dde04fb9a1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "lazy.h"
#include "async_io.h"
#include <vespa/vespalib/net/socket_spec.h>
#include <vespa/vespalib/net/socket_handle.h>
#include <vespa/vespalib/net/crypto_engine.h>
#include <memory>
namespace vespalib::coro {
// A socket endpoint supporting async read/write with encryption
struct AsyncCryptoSocket {
using UP = std::unique_ptr<AsyncCryptoSocket>;
virtual Lazy<ssize_t> read(char *buf, size_t len) = 0;
virtual Lazy<ssize_t> write(const char *buf, size_t len) = 0;
virtual ~AsyncCryptoSocket();
static Lazy<AsyncCryptoSocket::UP> accept(AsyncIo &async, CryptoEngine &crypto,
SocketHandle handle);
static Lazy<AsyncCryptoSocket::UP> connect(AsyncIo &async, CryptoEngine &crypto,
SocketHandle handle, SocketSpec spec);
};
}
|