http://www.perlmonks.org?node_id=117242


in reply to Re: Re: NetPacket::TCP output
in thread NetPacket::TCP output

There are six flags. Perhaps 2, for instance, is SYN, and 4 is ACK?

Benedict

Replies are listed 'Best First'.
Re: Re: Re: Re: NetPacket::TCP output
by Anonymous Monk on Oct 10, 2001 at 18:06 UTC

    Nope, that explanation doesn't work. Help?

    Benedict

      I can't take credit for this, I copied from someone elses code.
      sub parse_tcp_flags { my $flagword = shift(@_); my %flags = ("FIN"=>0,"SYN"=>0,"RST"=>0,"PSH"=>0,"ACK"=>0,"URG"=>0) +; $flags{FIN} = ($flagword & 0x01)? 1: 0; $flags{SYN} = ($flagword & 0x02)? 1: 0; $flags{RST} = ($flagword & 0x04)? 1: 0; $flags{PSH} = ($flagword & 0x08)? 1: 0; $flags{ACK} = ($flagword & 0x10)? 1: 0; $flags{URG} = ($flagword & 0x20)? 1: 0; return \%flags; }
      Pass this function the flags from parse_tcp_flags