diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-05-19 16:38:12 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-05-19 16:38:12 +0700 |
commit | 75ef73619db51c97a242b0e9c165838854534694 (patch) | |
tree | 3ce026ed1960af4ff7aedad8b4c4f52bb38faa76 /crypto/src/tls/ByteQueue.cs | |
parent | ByteQueue improvements (diff) | |
download | BouncyCastle.NET-ed25519-75ef73619db51c97a242b0e9c165838854534694.tar.xz |
Add previewing of pending output records
Diffstat (limited to 'crypto/src/tls/ByteQueue.cs')
-rw-r--r-- | crypto/src/tls/ByteQueue.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/src/tls/ByteQueue.cs b/crypto/src/tls/ByteQueue.cs index e39e797dd..45bec8be4 100644 --- a/crypto/src/tls/ByteQueue.cs +++ b/crypto/src/tls/ByteQueue.cs @@ -149,6 +149,14 @@ namespace Org.BouncyCastle.Tls return TlsUtilities.ReadInt32(m_databuf, m_skipped); } + public int ReadUint16(int skip) + { + if (m_available < skip + 2) + throw new InvalidOperationException("Not enough data to read"); + + return TlsUtilities.ReadUint16(m_databuf, m_skipped + skip); + } + /// <summary>Remove some bytes from our data from the beginning.</summary> /// <param name="i">How many bytes to remove.</param> public void RemoveData(int i) |