[tip:tools/kvm] kvm tools: Add helpers to test whether SYN or FIN bit is set.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  2772839ecb128f05b5a0c55f1d5a96c77bf0dfdb
Gitweb:     http://git.kernel.org/tip/2772839ecb128f05b5a0c55f1d5a96c77bf0dfdb
Author:     Asias He <asias.hejun@xxxxxxxxx>
AuthorDate: Wed, 29 Jun 2011 16:47:22 +0800
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Thu, 30 Jun 2011 10:42:43 +0300

kvm tools: Add helpers to test whether SYN or FIN bit is set.

This patch adds too helpers uip_tcp_is_syn(), uip_tcp_is_fin() to check if SYN and
FIN bit is set.

Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/include/kvm/uip.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/include/kvm/uip.h b/tools/kvm/include/kvm/uip.h
index a3fd1b0..5585680 100644
--- a/tools/kvm/include/kvm/uip.h
+++ b/tools/kvm/include/kvm/uip.h
@@ -18,6 +18,13 @@
 #define UIP_IP_TTL		0X40
 #define UIP_IP_P_UDP		0X11
 
+#define UIP_TCP_FLAG_FIN	1
+#define UIP_TCP_FLAG_SYN	2
+#define UIP_TCP_FLAG_RST	4
+#define UIP_TCP_FLAG_PSH	8
+#define UIP_TCP_FLAG_ACK	16
+#define UIP_TCP_FLAG_URG	32
+
 /*
  * IP package maxium len == 64 KBytes
  * IP header == 20 Bytes
@@ -227,6 +234,16 @@ static inline u8 *uip_tcp_payload(struct uip_tcp *tcp)
 	return (u8 *)&tcp->sport + uip_tcp_hdrlen(tcp);
 }
 
+static inline bool uip_tcp_is_syn(struct uip_tcp *tcp)
+{
+	return (tcp->flg & UIP_TCP_FLAG_SYN) != 0;
+}
+
+static inline bool uip_tcp_is_fin(struct uip_tcp *tcp)
+{
+	return (tcp->flg & UIP_TCP_FLAG_FIN) != 0;
+}
+
 static inline u16 uip_eth_hdrlen(struct uip_eth *eth)
 {
 	return sizeof(*eth);
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux