summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/header/tcp.go
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@google.com>2021-05-26 12:16:36 -0700
committergVisor bot <gvisor-bot@google.com>2021-05-26 12:18:59 -0700
commitc006b9b1c813089f22ae979fb3198227be25c20a (patch)
treec67fecccd1e65bb015a55f21890fae9f9dc358ea /pkg/tcpip/header/tcp.go
parent14a70624ce95dcf9e4505698b1174df583b13179 (diff)
Move presence methods from segment to TCPFlags
PiperOrigin-RevId: 376001032
Diffstat (limited to 'pkg/tcpip/header/tcp.go')
-rw-r--r--pkg/tcpip/header/tcp.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/tcpip/header/tcp.go b/pkg/tcpip/header/tcp.go
index 0df517000..8dabe3354 100644
--- a/pkg/tcpip/header/tcp.go
+++ b/pkg/tcpip/header/tcp.go
@@ -48,6 +48,16 @@ const (
// TCPFlags is the dedicated type for TCP flags.
type TCPFlags uint8
+// Intersects returns true iff there are flags common to both f and o.
+func (f TCPFlags) Intersects(o TCPFlags) bool {
+ return f&o != 0
+}
+
+// Contains returns true iff all the flags in o are contained within f.
+func (f TCPFlags) Contains(o TCPFlags) bool {
+ return f&o == o
+}
+
// String implements Stringer.String.
func (f TCPFlags) String() string {
flagsStr := []byte("FSRPAU")