diff options
Diffstat (limited to 'pkg/tcpip/buffer')
-rw-r--r-- | pkg/tcpip/buffer/prependable.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/tcpip/buffer/prependable.go b/pkg/tcpip/buffer/prependable.go index 43cbbc74c..4287464f3 100644 --- a/pkg/tcpip/buffer/prependable.go +++ b/pkg/tcpip/buffer/prependable.go @@ -52,6 +52,16 @@ func (p Prependable) UsedLength() int { return len(p.buf) - p.usedIdx } +// AvailableLength returns the number of bytes used so far. +func (p Prependable) AvailableLength() int { + return p.usedIdx +} + +// TrimBack removes size bytes from the end. +func (p *Prependable) TrimBack(size int) { + p.buf = p.buf[:len(p.buf)-size] +} + // Prepend reserves the requested space in front of the buffer, returning a // slice that represents the reserved space. func (p *Prependable) Prepend(size int) []byte { |