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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Async IO bridge for wolfcrypt-tls-tokio.
//
// NetBuffers implements wolfssl::IOCallbacks so it can be passed directly to
// TlsClientConfig::new_ssl_with_io_callbacks / TlsServerConfig::new_ssl_with_io_callbacks.
// wolfcrypt-tls generates the extern "C" shims and registers them with wolfSSL;
// this crate only needs to implement the safe Rust IOCallbacks trait.
//
// recv() — called by wolfSSL to read encrypted bytes:
// drain from net_in (filled asynchronously by fill_net_in in stream.rs)
// return WouldBlock when net_in is empty
//
// send() — called by wolfSSL to write encrypted bytes:
// append to net_out (drained asynchronously by flush_net_out in stream.rs)
// always succeeds immediately (unbounded buffer)
//
// SISTER FILE: wolfcrypt-tls-futures-io/src/bridge.rs holds a byte-for-byte
// identical NetBuffers struct + IOCallbacks impl. This duplication is
// intentional: consolidating into wolfcrypt-tls would force the base crate
// to take a `bytes` dependency that blocking-only users do not need. Any
// change to the recv/send semantics here MUST be mirrored in the futures-io
// copy.
use ;
use ;
/// The pair of network-side byte buffers shared between the async driver
/// and the wolfSSL IO callbacks.
///
/// Heap-allocated via `Box::new`; passed to `new_session_with_io` which
/// stores the pointer inside wolfSSL via `wolfSSL_SetIOReadCtx` /
/// `wolfSSL_SetIOWriteCtx`.
pub