summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/header
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-05-26 19:28:13 +0000
committergVisor bot <gvisor-bot@google.com>2021-05-26 19:28:13 +0000
commit66e5e6cfec12612f3d6fd9baa72ab93752211883 (patch)
treeae47482de0bc6c5ec7ecc95170ff364d37d2d289 /pkg/tcpip/header
parent425f4b5d29de7dae77ba32ca63896f69c31915d3 (diff)
parent9fcc44f991203343438b489389c2b861040086ac (diff)
Merge release-20210518.0-49-g9fcc44f99 (automated)
Diffstat (limited to 'pkg/tcpip/header')
-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")