diff --git a/CHANGES b/CHANGES index 908a36659c..f6588959ca 100644 --- a/CHANGES +++ b/CHANGES @@ -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 * Fix problem with the JSON Serialization code. (Aaron Eppert) diff --git a/VERSION b/VERSION index d704d5aca4..7411de569f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.4-199 +2.4-200 diff --git a/src/analyzer/protocol/tcp/TCP_Flags.h b/src/analyzer/protocol/tcp/TCP_Flags.h new file mode 100644 index 0000000000..cc3c1f5915 --- /dev/null +++ b/src/analyzer/protocol/tcp/TCP_Flags.h @@ -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