<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>It looks like &-ing with TH_FLAGS gives a
quick check if any flag is set. The same & isolates all flags from the word
they are contained in.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Something like:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>if(flags = hdrword & TH_FLAGS) {</FONT></DIV>
<DIV><FONT face=Arial size=2> we_have_flags(flags);</FONT></DIV>
<DIV><FONT face=Arial size=2>} else {</FONT></DIV>
<DIV><FONT face=Arial size=2> all_flags_are_off();</FONT></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=ahsanaskari@gmail.com href="mailto:ahsanaskari@gmail.com">ahsan
askari</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org
href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, July 06, 2006 7:07
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Winpcap-users] TCP Header and
Flags</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><BR></DIV>Hi<BR><BR>I had a look at sniffex.c at <A
href="http://www.tcpdump.org/pcap.htm">http://www.tcpdump.org/pcap.htm</A> and
I found the TCP Header structure. That structure has the following
<BR><BR><BR> u_char th_flags;
<BR> #define TH_FIN
0x01<BR> #define TH_SYN
0x02<BR> #define TH_RST
0x04<BR> #define TH_PUSH
0x08<BR> #define TH_ACK
0x10<BR> #define TH_URG
0x20<BR> #define TH_ECE 0x40
<BR> #define TH_CWR
0x80<BR> #define
TH_FLAGS
(TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR)<BR><BR>I know that if I
want to check any flag value in th_flags field I just have to "&" that
with flag value but could anyone tell me how I could use TH_FLAGS and why is
it there ? <BR><BR>Thank you<BR><BR>
<P>
<HR>
<P></P>_______________________________________________<BR>Winpcap-users
mailing
list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE></BODY></HTML>