ddn.net.tls.record
TLS record layer implementation.
Handles reading and writing TLS records (5-byte header + fragment). Supports both plaintext and encrypted records for TLS 1.2 and TLS 1.3.
Provides both blocking and non-blocking I/O methods. Non-blocking methods return TlsProgress to indicate when I/O is needed. Blocking methods are wrappers that throw on would-block conditions.
Types 2
TLS record structure.
Represents a single TLS record with content type, protocol version, and fragment data.
Record layer reads/writes TLS records over a transport.
Uses internal pre-allocated buffers for both reads and writes, supporting non-blocking I/O with partial record accumulation and partial write tracking.
Read buffer: 32 KB (accommodates 2 maximum-size TLS records). Write buffer: ~17 KB (one max record + overhead).
Memory guarantee: Maximum ~49 KB per RecordLayer instance.
TlsTransport transport_ubyte[] readBuffer_size_t readStart_size_t readEnd_ubyte[] writeBuffer_size_t writePos_size_t writeEnd_TlsProgress tryReadRecord(ref TlsRecord record)Attempts to read the next complete TLS record.TlsProgress tryWriteRecord(ContentType contentType, ProtocolVersion ver,
const(ubyte)[] fragment)Attempts to write a TLS record to the transport.TlsProgress tryWriteRaw(const(ubyte)[] wireData)Attempts to write pre-serialized wire data to the transport.TlsProgress flushPendingWrite()Flushes pending write data to the transport.bool hasPendingWrite() const pure nothrow @safe @nogcReturns: Whether there is pending write data that hasn't been fully sent to the transport.TlsRecord readRecord()Reads the next complete TLS record from the transport.void writeRecord(ContentType contentType, ProtocolVersion ver,
const(ubyte)[] fragment)Writes a TLS record to the transport (blocking).void writeRaw(const(ubyte)[] wireData)Writes a pre-serialized TLS record to the transport (blocking).void pushRecord(TlsRecord rec)Pushes a record back so the next read returns it.size_t bufferedBytes() @property const pure nothrow @safe @nogcReturns: Number of bytes currently in the read buffer.void compactIfNeeded()void compactReadBuffer()this(TlsTransport transport)Constructs a RecordLayer over the given transport.