Adding missing file.

This commit is contained in:
Robin Sommer 2015-10-26 16:57:39 -07:00
parent 9d7ec6b6d2
commit cae66721e6
3 changed files with 60 additions and 1 deletions

View file

@ -1,4 +1,8 @@
2.4-200 | 2015-10-26 16:57:39 -0700
* Adding missing file. (Robin Sommer)
2.4-199 | 2015-10-26 16:51:47 -0700 2.4-199 | 2015-10-26 16:51:47 -0700
* Fix problem with the JSON Serialization code. (Aaron Eppert) * Fix problem with the JSON Serialization code. (Aaron Eppert)

View file

@ -1 +1 @@
2.4-199 2.4-200

View file

@ -0,0 +1,55 @@
#ifndef ANALYZER_PROTOCOL_TCP_TCP_FLAGS_H
#define ANALYZER_PROTOCOL_TCP_TCP_FLAGS_H
namespace analyzer { namespace tcp {
class TCP_Flags {
public:
TCP_Flags(const struct tcphdr* tp) { flags = tp->th_flags; }
TCP_Flags() { flags = 0; }
bool SYN() const { return flags & TH_SYN; }
bool FIN() const { return flags & TH_FIN; }
bool RST() const { return flags & TH_RST; }
bool ACK() const { return flags & TH_ACK; }
bool URG() const { return flags & TH_URG; }
bool PUSH() const { return flags & TH_PUSH; }
string AsString() const;
protected:
u_char flags;
};
inline string TCP_Flags::AsString() const
{
char tcp_flags[10];
char* p = tcp_flags;
if ( SYN() )
*p++ = 'S';
if ( FIN() )
*p++ = 'F';
if ( RST() )
*p++ = 'R';
if ( ACK() )
*p++ = 'A';
if ( PUSH() )
*p++ = 'P';
if ( URG() )
*p++ = 'U';
*p++ = '\0';
return tcp_flags;
}
}
}
#endif