summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/buffer/prependable.go
diff options
context:
space:
mode:
authorGoogler <noreply@google.com>2019-05-03 13:29:20 -0700
committerShentubot <shentubot@google.com>2019-05-03 13:30:35 -0700
commitf2699b76c89a5be1ef6411f29a57b4cccc59fa17 (patch)
tree6e5ec5a4520b98fee3551d0baa16f59db69bc42e /pkg/tcpip/buffer/prependable.go
parent264d012d81d210c6d949554667c6fbf8e330587a (diff)
Support IPv4 fragmentation in netstack
Testing: Unit tests and also large ping in Fuchsia OS PiperOrigin-RevId: 246563592 Change-Id: Ia12ab619f64f4be2c8d346ce81341a91724aef95
Diffstat (limited to 'pkg/tcpip/buffer/prependable.go')
-rw-r--r--pkg/tcpip/buffer/prependable.go10
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 {