+++ /dev/null
-
-
-set(ERROR_MESSAGE
- "Unable to find libcheck!! Install libcheck before running
- 'make check' command"
-)
-
-
-find_path (CHECK_INCLUDE_DIR
- NAMES check.h
-)
-
-find_library(CHECK_LIBRARIES
- NAMES check
-)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(CHECK
- REQUIRED_VARS CHECK_INCLUDE_DIR CHECK_LIBRARIES
- FAIL_MESSAGE "${ERROR_MESSAGE}"
-)
-
-
-
-mark_as_advanced(
- CHECK_INCLUDE_DIR
- CHECK_LIBRARIES
-)
-
-
/*
- * Catch v1.4.0
- * Generated: 2016-03-15 07:23:12.623111
+ * Catch v1.5.6
+ * Generated: 2016-06-09 19:20:41.460328
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
#define TWOBLUECUBES_CATCH_HPP_INCLUDED
-#ifdef __clang__
+#ifdef __ICC
+# pragma system_header
+#elif __clang__
# pragma clang system_header
#elif defined __GNUC__
# pragma GCC system_header
// #included from: internal/catch_suppress_warnings.h
-#ifdef __clang__
-# ifdef __ICC // icpc defines the __clang__ macro
-# pragma warning(push)
-# pragma warning(disable: 161 1682)
-# else // __ICC
-# pragma clang diagnostic ignored "-Wglobal-constructors"
-# pragma clang diagnostic ignored "-Wvariadic-macros"
-# pragma clang diagnostic ignored "-Wc99-extensions"
-# pragma clang diagnostic ignored "-Wunused-variable"
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wpadded"
-# pragma clang diagnostic ignored "-Wc++98-compat"
-# pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
-# pragma clang diagnostic ignored "-Wswitch-enum"
-# pragma clang diagnostic ignored "-Wcovered-switch-default"
-# endif
+#ifdef __ICC
+# pragma warning(push)
+# pragma warning(disable: 161 1682)
+#elif __clang__
+# pragma clang diagnostic ignored "-Wglobal-constructors"
+# pragma clang diagnostic ignored "-Wvariadic-macros"
+# pragma clang diagnostic ignored "-Wc99-extensions"
+# pragma clang diagnostic ignored "-Wunused-variable"
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wpadded"
+# pragma clang diagnostic ignored "-Wc++98-compat"
+# pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
+# pragma clang diagnostic ignored "-Wswitch-enum"
+# pragma clang diagnostic ignored "-Wcovered-switch-default"
#elif defined __GNUC__
# pragma GCC diagnostic ignored "-Wvariadic-macros"
# pragma GCC diagnostic ignored "-Wunused-variable"
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
-#if defined(__cplusplus) && __cplusplus >= 201103L
-# define CATCH_CPP11_OR_GREATER
+#ifdef __cplusplus
+
+# if __cplusplus >= 201103L
+# define CATCH_CPP11_OR_GREATER
+# endif
+
+# if __cplusplus >= 201402L
+# define CATCH_CPP14_OR_GREATER
+# endif
+
#endif
#ifdef __clang__
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
} \
INTERNAL_CATCH_REACT( __catchResult ) \
- } while( Catch::isTrue( false && static_cast<bool>(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
+ } while( Catch::isTrue( false && !!(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
};
class DebugOutStream : public IStream {
- std::auto_ptr<StreamBufBase> m_streamBuf;
+ CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf;
mutable std::ostream m_os;
public:
DebugOutStream();
}
ConfigData m_data;
- std::auto_ptr<IStream const> m_stream;
+ CATCH_AUTO_PTR( IStream const ) m_stream;
TestSpec m_testSpec;
};
#define STITCH_CLARA_OPEN_NAMESPACE namespace Catch {
// #included from: ../external/clara.h
-// Version 0.0.1.1
+// Version 0.0.2.4
// Only use header guard if we are not using an outer namespace
#if !defined(TWOBLUECUBES_CLARA_H_INCLUDED) || defined(STITCH_CLARA_OPEN_NAMESPACE)
#include <stdexcept>
#include <memory>
+#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
+#define CLARA_PLATFORM_WINDOWS
+#endif
+
// Use optional outer namespace
#ifdef STITCH_CLARA_OPEN_NAMESPACE
STITCH_CLARA_OPEN_NAMESPACE
const unsigned int consoleWidth = 80;
#endif
- // Use this to try and stop compiler from warning about unreachable code
- inline bool isTrue( bool value ) { return value; }
-
using namespace Tbc;
inline bool startsWith( std::string const& str, std::string const& prefix ) {
else
throw std::runtime_error( "Expected a boolean value but did not recognise:\n '" + _source + "'" );
}
- inline void convertInto( bool _source, bool& _dest ) {
- _dest = _source;
- }
- template<typename T>
- inline void convertInto( bool, T& ) {
- if( isTrue( true ) )
- throw std::runtime_error( "Invalid conversion" );
- }
template<typename ConfigT>
struct IArgFunction {
IArgFunction( IArgFunction const& ) = default;
#endif
virtual void set( ConfigT& config, std::string const& value ) const = 0;
- virtual void setFlag( ConfigT& config ) const = 0;
virtual bool takesArg() const = 0;
virtual IArgFunction* clone() const = 0;
};
void set( ConfigT& config, std::string const& value ) const {
functionObj->set( config, value );
}
- void setFlag( ConfigT& config ) const {
- functionObj->setFlag( config );
- }
bool takesArg() const { return functionObj->takesArg(); }
bool isSet() const {
template<typename C>
struct NullBinder : IArgFunction<C>{
virtual void set( C&, std::string const& ) const {}
- virtual void setFlag( C& ) const {}
virtual bool takesArg() const { return true; }
virtual IArgFunction<C>* clone() const { return new NullBinder( *this ); }
};
virtual void set( C& p, std::string const& stringValue ) const {
convertInto( stringValue, p.*member );
}
- virtual void setFlag( C& p ) const {
- convertInto( true, p.*member );
- }
virtual bool takesArg() const { return !IsBool<M>::value; }
virtual IArgFunction<C>* clone() const { return new BoundDataMember( *this ); }
M C::* member;
convertInto( stringValue, value );
(p.*member)( value );
}
- virtual void setFlag( C& p ) const {
- typename RemoveConstRef<M>::type value;
- convertInto( true, value );
- (p.*member)( value );
- }
virtual bool takesArg() const { return !IsBool<M>::value; }
virtual IArgFunction<C>* clone() const { return new BoundUnaryMethod( *this ); }
void (C::*member)( M );
if( value )
(p.*member)();
}
- virtual void setFlag( C& p ) const {
- (p.*member)();
- }
virtual bool takesArg() const { return false; }
virtual IArgFunction<C>* clone() const { return new BoundNullaryMethod( *this ); }
void (C::*member)();
if( value )
function( obj );
}
- virtual void setFlag( C& p ) const {
- function( p );
- }
virtual bool takesArg() const { return false; }
virtual IArgFunction<C>* clone() const { return new BoundUnaryFunction( *this ); }
void (*function)( C& );
convertInto( stringValue, value );
function( obj, value );
}
- virtual void setFlag( C& obj ) const {
- typename RemoveConstRef<T>::type value;
- convertInto( true, value );
- function( obj, value );
- }
virtual bool takesArg() const { return !IsBool<T>::value; }
virtual IArgFunction<C>* clone() const { return new BoundBinaryFunction( *this ); }
void (*function)( C&, T );
} // namespace Detail
- struct Parser {
- Parser() : separators( " \t=:" ) {}
+ inline std::vector<std::string> argsToVector( int argc, char const* const* const argv ) {
+ std::vector<std::string> args( static_cast<std::size_t>( argc ) );
+ for( std::size_t i = 0; i < static_cast<std::size_t>( argc ); ++i )
+ args[i] = argv[i];
+
+ return args;
+ }
+
+ class Parser {
+ enum Mode { None, MaybeShortOpt, SlashOpt, ShortOpt, LongOpt, Positional };
+ Mode mode;
+ std::size_t from;
+ bool inQuotes;
+ public:
struct Token {
enum Type { Positional, ShortOpt, LongOpt };
std::string data;
};
- void parseIntoTokens( int argc, char const* const argv[], std::vector<Parser::Token>& tokens ) const {
+ Parser() : mode( None ), from( 0 ), inQuotes( false ){}
+
+ void parseIntoTokens( std::vector<std::string> const& args, std::vector<Token>& tokens ) {
const std::string doubleDash = "--";
- for( int i = 1; i < argc && argv[i] != doubleDash; ++i )
- parseIntoTokens( argv[i] , tokens);
- }
- void parseIntoTokens( std::string arg, std::vector<Parser::Token>& tokens ) const {
- while( !arg.empty() ) {
- Parser::Token token( Parser::Token::Positional, arg );
- arg = "";
- if( token.data[0] == '-' ) {
- if( token.data.size() > 1 && token.data[1] == '-' ) {
- token = Parser::Token( Parser::Token::LongOpt, token.data.substr( 2 ) );
- }
- else {
- token = Parser::Token( Parser::Token::ShortOpt, token.data.substr( 1 ) );
- if( token.data.size() > 1 && separators.find( token.data[1] ) == std::string::npos ) {
- arg = "-" + token.data.substr( 1 );
- token.data = token.data.substr( 0, 1 );
- }
- }
- }
- if( token.type != Parser::Token::Positional ) {
- std::size_t pos = token.data.find_first_of( separators );
- if( pos != std::string::npos ) {
- arg = token.data.substr( pos+1 );
- token.data = token.data.substr( 0, pos );
- }
- }
- tokens.push_back( token );
+ for( std::size_t i = 1; i < args.size() && args[i] != doubleDash; ++i )
+ parseIntoTokens( args[i], tokens);
+ }
+
+ void parseIntoTokens( std::string const& arg, std::vector<Token>& tokens ) {
+ for( std::size_t i = 0; i <= arg.size(); ++i ) {
+ char c = arg[i];
+ if( c == '"' )
+ inQuotes = !inQuotes;
+ mode = handleMode( i, c, arg, tokens );
}
}
- std::string separators;
+ Mode handleMode( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
+ switch( mode ) {
+ case None: return handleNone( i, c );
+ case MaybeShortOpt: return handleMaybeShortOpt( i, c );
+ case ShortOpt:
+ case LongOpt:
+ case SlashOpt: return handleOpt( i, c, arg, tokens );
+ case Positional: return handlePositional( i, c, arg, tokens );
+ default: throw std::logic_error( "Unknown mode" );
+ }
+ }
+
+ Mode handleNone( std::size_t i, char c ) {
+ if( inQuotes ) {
+ from = i;
+ return Positional;
+ }
+ switch( c ) {
+ case '-': return MaybeShortOpt;
+#ifdef CLARA_PLATFORM_WINDOWS
+ case '/': from = i+1; return SlashOpt;
+#endif
+ default: from = i; return Positional;
+ }
+ }
+ Mode handleMaybeShortOpt( std::size_t i, char c ) {
+ switch( c ) {
+ case '-': from = i+1; return LongOpt;
+ default: from = i; return ShortOpt;
+ }
+ }
+ Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
+ if( std::string( ":=\0", 3 ).find( c ) == std::string::npos )
+ return mode;
+
+ std::string optName = arg.substr( from, i-from );
+ if( mode == ShortOpt )
+ for( std::size_t j = 0; j < optName.size(); ++j )
+ tokens.push_back( Token( Token::ShortOpt, optName.substr( j, 1 ) ) );
+ else if( mode == SlashOpt && optName.size() == 1 )
+ tokens.push_back( Token( Token::ShortOpt, optName ) );
+ else
+ tokens.push_back( Token( Token::LongOpt, optName ) );
+ return None;
+ }
+ Mode handlePositional( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
+ if( inQuotes || std::string( "\0", 1 ).find( c ) == std::string::npos )
+ return mode;
+
+ std::string data = arg.substr( from, i-from );
+ tokens.push_back( Token( Token::Positional, data ) );
+ return None;
+ }
};
template<typename ConfigT>
return oss.str();
}
- ConfigT parse( int argc, char const* const argv[] ) const {
+ ConfigT parse( std::vector<std::string> const& args ) const {
ConfigT config;
- parseInto( argc, argv, config );
+ parseInto( args, config );
return config;
}
- std::vector<Parser::Token> parseInto( int argc, char const* argv[], ConfigT& config ) const {
- std::string processName = argv[0];
+ std::vector<Parser::Token> parseInto( std::vector<std::string> const& args, ConfigT& config ) const {
+ std::string processName = args[0];
std::size_t lastSlash = processName.find_last_of( "/\\" );
if( lastSlash != std::string::npos )
processName = processName.substr( lastSlash+1 );
m_boundProcessName.set( config, processName );
std::vector<Parser::Token> tokens;
Parser parser;
- parser.parseIntoTokens( argc, argv, tokens );
+ parser.parseIntoTokens( args, tokens );
return populate( tokens, config );
}
arg.boundField.set( config, tokens[++i].data );
}
else {
- arg.boundField.setFlag( config );
+ arg.boundField.set( config, "true" );
}
break;
}
bool aborting;
};
+ class MultipleReporters;
+
struct IStreamingReporter : IShared {
virtual ~IStreamingReporter();
virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;
virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
+
+ virtual MultipleReporters* tryAsMulti() { return CATCH_NULL; }
};
struct IReporterFactory : IShared {
virtual void addChild( Ptr<ITracker> const& child ) = 0;
virtual ITracker* findChild( std::string const& name ) = 0;
virtual void openChild() = 0;
+
+ // Debug/ checking
+ virtual bool isSectionTracker() const = 0;
+ virtual bool isIndexTracker() const = 0;
};
class TrackerContext {
m_parent->openChild();
}
}
+
+ virtual bool isSectionTracker() const CATCH_OVERRIDE { return false; }
+ virtual bool isIndexTracker() const CATCH_OVERRIDE { return false; }
+
void open() {
m_runState = Executing;
moveToThis();
{}
virtual ~SectionTracker();
+ virtual bool isSectionTracker() const CATCH_OVERRIDE { return true; }
+
static SectionTracker& acquire( TrackerContext& ctx, std::string const& name ) {
SectionTracker* section = CATCH_NULL;
ITracker& currentTracker = ctx.currentTracker();
if( ITracker* childTracker = currentTracker.findChild( name ) ) {
- section = dynamic_cast<SectionTracker*>( childTracker );
- assert( section );
+ assert( childTracker );
+ assert( childTracker->isSectionTracker() );
+ section = static_cast<SectionTracker*>( childTracker );
}
else {
section = new SectionTracker( name, ctx, ¤tTracker );
{}
virtual ~IndexTracker();
+ virtual bool isIndexTracker() const CATCH_OVERRIDE { return true; }
+
static IndexTracker& acquire( TrackerContext& ctx, std::string const& name, int size ) {
IndexTracker* tracker = CATCH_NULL;
ITracker& currentTracker = ctx.currentTracker();
if( ITracker* childTracker = currentTracker.findChild( name ) ) {
- tracker = dynamic_cast<IndexTracker*>( childTracker );
- assert( tracker );
+ assert( childTracker );
+ assert( childTracker->isIndexTracker() );
+ tracker = static_cast<IndexTracker*>( childTracker );
}
else {
tracker = new IndexTracker( name, ctx, ¤tTracker, size );
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
}
- int applyCommandLine( int argc, char const* argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
+ int applyCommandLine( int argc, char const* const* const argv, OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
try {
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
- m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
+ m_unusedTokens = m_cli.parseInto( Clara::argsToVector( argc, argv ), m_configData );
if( m_configData.showHelp )
showHelp( m_configData.processName );
m_config.reset();
m_config.reset();
}
- int run( int argc, char const* argv[] ) {
+ int run( int argc, char const* const* const argv ) {
int returnCode = applyCommandLine( argc, argv );
if( returnCode == 0 )
returnCode = run();
return returnCode;
}
- int run( int argc, char* argv[] ) {
- return run( argc, const_cast<char const**>( argv ) );
- }
int run() {
if( m_configData.showHelp )
#include <iostream>
#include <algorithm>
+#ifdef CATCH_CPP14_OR_GREATER
+#include <random>
+#endif
+
namespace Catch {
- struct LexSort {
- bool operator() (TestCase i,TestCase j) const { return (i<j);}
- };
struct RandomNumberGenerator {
- int operator()( int n ) const { return std::rand() % n; }
+ typedef int result_type;
+
+ result_type operator()( result_type n ) const { return std::rand() % n; }
+
+#ifdef CATCH_CPP14_OR_GREATER
+ static constexpr result_type min() { return 0; }
+ static constexpr result_type max() { return 1000000; }
+ result_type operator()() const { return std::rand() % max(); }
+#endif
+ template<typename V>
+ static void shuffle( V& vector ) {
+ RandomNumberGenerator rng;
+#ifdef CATCH_CPP14_OR_GREATER
+ std::shuffle( vector.begin(), vector.end(), rng );
+#else
+ std::random_shuffle( vector.begin(), vector.end(), rng );
+#endif
+ }
};
inline std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
switch( config.runOrder() ) {
case RunTests::InLexicographicalOrder:
- std::sort( sorted.begin(), sorted.end(), LexSort() );
+ std::sort( sorted.begin(), sorted.end() );
break;
case RunTests::InRandomOrder:
{
seedRng( config );
-
- RandomNumberGenerator rng;
- std::random_shuffle( sorted.begin(), sorted.end(), rng );
+ RandomNumberGenerator::shuffle( sorted );
}
break;
case RunTests::InDeclarationOrder:
it != itEnd;
++it ) {
std::pair<std::set<TestCase>::const_iterator, bool> prev = seenFunctions.insert( *it );
- if( !prev.second ){
- Catch::cerr()
- << Colour( Colour::Red )
- << "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n"
- << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
- << "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl;
- exit(1);
+ if( !prev.second ) {
+ std::ostringstream ss;
+
+ ss << Colour( Colour::Red )
+ << "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n"
+ << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
+ << "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl;
+
+ throw std::runtime_error(ss.str());
}
}
}
return os;
}
- Version libraryVersion( 1, 4, 0, "", 0 );
+ Version libraryVersion( 1, 5, 6, "", 0 );
}
++it )
(*it)->skipTest( testInfo );
}
+
+ virtual MultipleReporters* tryAsMulti() CATCH_OVERRIDE {
+ return this;
+ }
+
};
Ptr<IStreamingReporter> addReporter( Ptr<IStreamingReporter> const& existingReporter, Ptr<IStreamingReporter> const& additionalReporter ) {
Ptr<IStreamingReporter> resultingReporter;
if( existingReporter ) {
- MultipleReporters* multi = dynamic_cast<MultipleReporters*>( existingReporter.get() );
+ MultipleReporters* multi = existingReporter->tryAsMulti();
if( !multi ) {
multi = new MultipleReporters;
resultingReporter = Ptr<IStreamingReporter>( multi );
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {}
- virtual bool assertionEnded( AssertionStats const& assertionStats ) {
+ virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
assert( !m_sectionStack.empty() );
SectionNode& sectionNode = *m_sectionStack.back();
sectionNode.assertions.push_back( assertionStats );
#define TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED
-#ifdef __clang__
-# ifdef __ICC // icpc defines the __clang__ macro
-# pragma warning(pop)
-# else
-# pragma clang diagnostic pop
-# endif
+#ifdef __ICC
+# pragma warning(pop)
+#elif __clang__
+# pragma clang diagnostic pop
#elif defined __GNUC__
# pragma GCC diagnostic pop
#endif
if (ip_len > raw.len)
{
DebugFormat(DEBUG_DECODE,
- "IP Len field is %d bytes bigger than captured length.\n"
+ "IP Len field is %u bytes bigger than captured length.\n"
" (ip.len: %u, cap.len: %u)\n",
ip_len - raw.len, ip_len, raw.len);
if (ip_len < hlen)
{
DebugFormat(DEBUG_DECODE,
- "IP dgm len (%d bytes) < IP hdr "
- "len (%d bytes), packet discarded\n", ip_len, hlen);
+ "IP dgm len (%u bytes) < IP hdr "
+ "len (%hu bytes), packet discarded\n", ip_len, hlen);
codec_event(codec, DECODE_IPV4_DGRAM_LT_IPHDR);
return false;
if (raw.len != ((unsigned int)ntohs(hdr->length) + len))
{
- DebugFormat(DEBUG_DECODE, "Calculated length %d != %d in header.\n",
+ DebugFormat(DEBUG_DECODE, "Calculated length %u != %hu in header.\n",
raw.len - len, ntohs(hdr->length));
codec_event(codec, DECODE_GTP_BAD_LEN);
return false;
if (raw.len != ((unsigned int)ntohs(hdr->length) + GTP_MIN_LEN))
{
- DebugFormat(DEBUG_DECODE, "Calculated length %d != %d in header.\n",
+ DebugFormat(DEBUG_DECODE, "Calculated length %u != %hu in header.\n",
raw.len - GTP_MIN_LEN, ntohs(hdr->length));
codec_event(codec, DECODE_GTP_BAD_LEN);
return false;
{
// none of the services match
DebugFormat(DEBUG_DETECT,
- "[**] SID %d not matched because of service mismatch (%d!=%d [**]\n",
+ "[**] SID %u not matched because of service mismatch (%d!=%d [**]\n",
sig_info.id, app_proto, sig_info.services[0].service_ordinal);
break; // out of case
return 0;
}
- DebugFormat(DEBUG_FLOW,"Host Tags Active: %d Session Tags Active: %d\n",
+ DebugFormat(DEBUG_FLOW,"Host Tags Active: %u Session Tags Active: %u\n",
sfxhash_count(host_tag_cache_ptr), sfxhash_count(ssn_tag_cache_ptr));
DebugMessage(DEBUG_FLOW, "[*] Checking session tag list (forward)...\n");
FileLog(FileLogConfig& conf) { config = conf; }
void show(SnortConfig*) override;
- void eval(Packet*) override { };
+ void eval(Packet*) override { }
bool configure(SnortConfig*) override
{
if ( p->expect == status )
return 1;
- printf("event[%d](%d,%d): exp %d, got %d\n",
+ printf("event[%u](%u,%u): exp %d, got %d\n",
p->seq, p->gid, p->sid, p->expect, status);
return 0;
}
if ( RULE_ORIG == status )
return 1;
- printf("cap[%d](%d,%d): exp %d, got %d\n",
+ printf("cap[%u](%u,%u): exp %d, got %d\n",
p->seq, p->gid, p->sid, RULE_ORIG, status);
return 0;
}
if ( p->expect == status )
return 1;
- printf("event[%d](%d,%d): exp %d, got %d\n",
+ printf("event[%u](%u,%u): exp %d, got %d\n",
p->seq, p->gid, p->sid, p->expect, status);
return 0;
}
if ( expect == status )
return 1;
- printf("cap[%d](%d,%d): exp %d, got %d\n",
+ printf("cap[%u](%u,%u): exp %d, got %d\n",
p->seq, p->gid, p->sid, expect, status);
return 0;
}
if ( p->expect == status )
return 1;
- printf("packet[%d](%d,%d): exp %d, got %d\n",
+ printf("packet[%u](%u,%u): exp %d, got %d\n",
p->seq, p->gid, p->sid, p->expect, status);
return 0;
}
{
assert(sc_msg);
- DebugFormat(DEBUG_HA,"HighAvailability::receive_handler: port: %d, length: %d\n",
+ DebugFormat(DEBUG_HA,"HighAvailability::receive_handler: port: %hu, length: %u\n",
sc_msg->hdr->port, sc_msg->content_length);
// SC received messages must have reference back to SideChannel object
TEST_CASE( "chunk initialization", "[chunk]" )
{
Lua::State lua(true);
- bool result;
string test_chunk = "function init() return true end";
string test_args_table = "args = { a = 1, b = 2 }";
DebugFormat(DEBUG_FLOWBITS, "%s: name = %s\n", s_name, flowbits->name);
DebugFormat(DEBUG_FLOWBITS, "%s: eval = %d\n", s_name, flowbits->eval);
DebugFormat(DEBUG_FLOWBITS, "%s: num_ids = %d\n", s_name, flowbits->num_ids);
- DebugFormat(DEBUG_FLOWBITS, "%s: grp_id = %d\n", s_name, flowbits->group_id);
+ DebugFormat(DEBUG_FLOWBITS, "%s: grp_id = %u\n", s_name, flowbits->group_id);
DebugFormat(DEBUG_FLOWBITS, "%s: group_name = %s\n", s_name, flowbits->group);
for (int i = 0; i < flowbits->num_ids; i++)
namespace t_packet_latency
{
-struct MockConfigWrapper : packet_latency::ConfigWrapper
+struct MockConfigWrapper : public packet_latency::ConfigWrapper
{
PacketLatencyConfig config;
{ return &config; }
};
-struct EventHandlerSpy : packet_latency::EventHandler
+struct EventHandlerSpy : public packet_latency::EventHandler
{
unsigned count = 0;
void handle(const packet_latency::Event&) override
{ ++count; }
};
-struct MockClock : ClockTraits<hr_clock>
+struct MockClock : public ClockTraits<hr_clock>
{
static hr_time t;
namespace t_rule_latency
{
-struct MockConfigWrapper : rule_latency::ConfigWrapper
+struct MockConfigWrapper : public rule_latency::ConfigWrapper
{
RuleLatencyConfig config;
{ return &config; }
};
-struct EventHandlerSpy : rule_latency::EventHandler
+struct EventHandlerSpy : public rule_latency::EventHandler
{
unsigned count = 0;
void handle(const rule_latency::Event&) override
{ ++count; }
};
-struct MockClock : ClockTraits<hr_clock>
+struct MockClock : public ClockTraits<hr_clock>
{
static hr_time t;
if ( opt->api->max_per_rule && (++opt->count > opt->api->max_per_rule) )
{
- ParseError("%s allowed only %d time(s) per rule",
+ ParseError("%s allowed only %u time(s) per rule",
opt->api->base.name, opt->api->max_per_rule);
return false;
}
#endif
#ifdef UNIT_TEST
-Packet* init_null_packet()
+static Packet* init_null_packet()
{
static Packet p(false);
static DAQ_PktHdr_t h;
auto null_packet = init_null_packet();
const uint8_t cooked[] = "AbCdEfGhIjKlMnOpQrStUvWxYz";
- struct pcap_pkthdr hdr;
Packet p(false);
DAQ_PktHdr_t daq_hdr;
return -1;
SnortSnprintf((char*)buffer, PROTO_BUFFER_SIZE,
- "Open Port: %u\n", *((unsigned short*)user));
+ "Open Port: %hu\n", *((unsigned short*)user));
dsize = SnortStrnlen((const char*)buffer, PROTO_BUFFER_SIZE);
*total_size += dsize;
{
#ifdef DEBUG_MSGS
IPrepInfo* result;
- DebugFormat(DEBUG_REPUTATION, "Number of entries input: %d, in table: %d \n",
+ DebugFormat(DEBUG_REPUTATION, "Number of entries input: %d, in table: %u \n",
totalNumEntries,sfrt_flat_num_entries(config->iplist) );
- DebugFormat(DEBUG_REPUTATION, "Memory allocated: %d \n",sfrt_flat_usage(config->iplist) );
+ DebugFormat(DEBUG_REPUTATION, "Memory allocated: %u \n",sfrt_flat_usage(config->iplist) );
result = (IPrepInfo*)sfrt_flat_lookup((void*)ipAddr, config->iplist);
if (nullptr != result)
{
if ( *fname )
{
- Shell* sh = sc->policy_map->get_shell();
+ sh = sc->policy_map->get_shell();
sh->set_file(fname);
}
for ( unsigned i = 0; true; i++ )
{
- Shell* sh = sc->policy_map->get_shell(i);
+ sh = sc->policy_map->get_shell(i);
if ( !sh )
break;
[](const Summary& sum) -> void
{
printf(
- "%f: Checks: %d, Failures: %d, Errors: %d\n",
+ "%f: Checks: %u, Failures: %u, Errors: %u\n",
calc_percent(sum.passed, sum.total()),
sum.total(), sum.failed, sum.errors
);
[](const Test& t, unsigned i) -> void
{
printf(
- "%s:%c:piglet:(%s::%s):%d: %s\n",
+ "%s:%c:piglet:(%s::%s):%u: %s\n",
t.chunk->filename.c_str(), get_result_short(t.result),
t.type.c_str(), t.name.c_str(), i, get_result_long(t.result)
);
if ( sum.failed || sum.errors )
{
printf(
- " - Passed: \x1b[32m%d\x1b[0m, "
- "Failed: \x1b[31m%d\x1b[0m, "
- "Errors: \x1b[33m%d\x1b[0m",
+ " - Passed: \x1b[32m%u\x1b[0m, "
+ "Failed: \x1b[31m%u\x1b[0m, "
+ "Errors: \x1b[33m%u\x1b[0m",
sum.passed, sum.failed, sum.errors
);
}
[](const Test& t, unsigned i) -> void
{
printf(
- "%d) \x1b[34m%s::%s\x1b[0m: %s\n",
+ "%u) \x1b[34m%s::%s\x1b[0m: %s\n",
i, t.type.c_str(), t.name.c_str(), t.chunk->filename.c_str()
);
},
{
printf("=========================================\n");
printf(
- "%0.f%% - passed: %d/%d, failed: %d, errors: %d\n",
+ "%0.f%% - passed: %u/%u, failed: %u, errors: %u\n",
calc_percent(sum.passed, sum.total()),
sum.passed, sum.total(), sum.failed, sum.errors
);
{
for (i=1; i<pol_cnt; i++)
{
- DebugFormat(DEBUG_PORTLISTS,"*** %d rules in object %d\n",
+ DebugFormat(DEBUG_PORTLISTS,"*** %u rules in object %d\n",
((PortObject*)pol[i])->rule_list->count,i);
PortObjectAppendEx2(ponew, (PortObject*)pol[i]);
DebugFormat(DEBUG_PORTLISTS,
- "*** merged port-object[%d], %d rules\n",
+ "*** merged port-object[%d], %u rules\n",
i,ponew->rule_hash->count);
}
PortObjectNormalize( (PortObject*)ponew);
}
DebugFormat(DEBUG_PORTLISTS,
- "*** merged %d port objects, %d rules\n",
+ "*** merged %d port objects, %u rules\n",
pol_cnt,ponew->rule_hash->count);
DebugMessage(DEBUG_PORTLISTS,"*** merged ponew - follows: \n");
// PortObjectPrint2(ponew);
TEST_CASE( "rule entry", "[profiler][rule_profiler]" )
{
- SigInfo sig_info;
auto entry = make_rule_entry(3_ticks, 2_ticks, 3, 2);
entry.state.alerts = 77;
entry.state.latency_timeouts = 5;
IpOptionIterator::IpOptionIterator(const IP4Hdr* const ip4_header, const Packet* const p)
{
- const uint8_t* const hdr = (const uint8_t* const)ip4_header;
+ const uint8_t* const hdr = (const uint8_t*)ip4_header;
start_ptr = hdr + IP4_HEADER_LEN;
end_ptr = start_ptr;
IpOptionIterator::IpOptionIterator(const IP4Hdr* const ip4_header, const uint8_t valid_hdr_len)
{
- const uint8_t* const hdr = (const uint8_t* const)ip4_header;
+ const uint8_t* const hdr = (const uint8_t*)ip4_header;
start_ptr = hdr + IP4_HEADER_LEN;
if (valid_hdr_len < IP4_HEADER_LEN)
*/
// Convert enum to a value cast to the enum's underlying type.
-template<typename En>
-constexpr auto to_utype(En t)->typename std::underlying_type<En>::type
+template<typename E>
+inline constexpr typename std::underlying_type<E>::type to_utype(E enumerator)
{
- return static_cast<typename std::underlying_type<En>::type>(t);
+ return static_cast<typename std::underlying_type<E>::type>(enumerator);
}
using ProtocolIndex = uint8_t;
int HyperscanMpse::prep_patterns(SnortConfig* sc)
{
- hs_compile_error_t* err = nullptr;
+ hs_compile_error_t* errptr = nullptr;
std::vector<const char*> pats;
std::vector<unsigned> flags;
std::vector<unsigned> ids;
}
if ( hs_compile_multi(&pats[0], &flags[0], &ids[0], pvector.size(), HS_MODE_BLOCK,
- nullptr, &hs_db, &err) or !hs_db )
+ nullptr, &hs_db, &errptr) or !hs_db )
{
- // FIXIT-L emit data from err
+ // FIXIT-L emit data from errptr
ParseError("can't compile pattern database '%s'", "hs_compile_multi");
- hs_free_compile_error(err);
+ hs_free_compile_error(errptr);
return -1;
}
}
DebugFormat(DEBUG_DCE_COMMON, "Added Context item to queue.\n"
- " Context id: %u\n"
+ " Context id: %hu\n"
" Interface: %s\n"
- " Interface major version: %u\n"
- " Interface minor version: %u\n",
+ " Interface major version: %hu\n"
+ " Interface minor version: %hu\n",
ctx_node->ctx_id,
DCE2_UuidToStr(&ctx_node->iface, DCERPC_BO_FLAG__NONE),
ctx_node->iface_vers_maj, ctx_node->iface_vers_min);
}
DebugFormat(DEBUG_DCE_COMMON, "Adding Context item to context item list.\n"
- " Context id: %u\n"
+ " Context id: %hu\n"
" Interface: %s\n"
- " Interface major version: %u\n"
- " Interface minor version: %u\n",
+ " Interface major version: %hu\n"
+ " Interface minor version: %hu\n",
ctx_node->ctx_id,
DCE2_UuidToStr(&ctx_node->iface, DCERPC_BO_FLAG__NONE),
ctx_node->iface_vers_maj, ctx_node->iface_vers_min);
if (data_len < frag_len)
{
DebugFormat(DEBUG_DCE_COMMON,
- "Not enough data in packet for fragment length: %u\n", frag_len);
+ "Not enough data in packet for fragment length: %hu\n", frag_len);
/* Set frag length so we don't have to check it again in seg code */
seg->frag_len = frag_len;
{
DebugFormat(DEBUG_DCE_COMMON, " Iface: %s\n", DCE2_UuidToStr(&ropts->iface,
DCERPC_BO_FLAG__NONE));
- DebugFormat(DEBUG_DCE_COMMON, " Iface version: %u\n", ropts->iface_vers_maj);
+ DebugFormat(DEBUG_DCE_COMMON, " Iface version: %hu\n", ropts->iface_vers_maj);
}
if (ropts->opnum == DCE2_SENTINEL)
DebugMessage(DEBUG_DCE_COMMON, " Opnum: unset\n");
else
{
- DebugFormat(DEBUG_DCE_COMMON, " Opnum: %u\n", ropts->opnum);
+ DebugFormat(DEBUG_DCE_COMMON, " Opnum: %d\n", ropts->opnum);
}
if (ropts->stub_data != nullptr)
DebugFormat(DEBUG_DCE_COMMON, " Stub data: %p\n", ropts->stub_data);
Profile profile(dce2_smb_pstat_smb_req);
DebugFormat(DEBUG_DCE_SMB, "Find request tracker => "
- "Uid: %u, Tid: %u, Pid: %u, Mid: %u ... ", uid, tid, pid, mid);
+ "Uid: %hu, Tid: %hu, Pid: %hu, Mid: %hu ... ", uid, tid, pid, mid);
DCE2_SmbRequestTracker* tmp_rtracker = &ssd->rtracker;
int smb_com = SmbCom(smb_hdr);
if (DCE2_SmbFindTid(ssd, SmbTid(smb_hdr)) != DCE2_RET__SUCCESS)
{
DebugFormat(DEBUG_DCE_SMB,
- "Couldn't find Tid (%u)\n", SmbTid(smb_hdr));
+ "Couldn't find Tid (%hu)\n", SmbTid(smb_hdr));
return nullptr;
}
// See if there is enough data to process the NetBIOS header
if (data_len < data_need)
{
- DebugFormat(DEBUG_DCE_SMB, "Data len(%u) < NetBIOS SS header(%u). "
+ DebugFormat(DEBUG_DCE_SMB, "Data len(%hu) < NetBIOS SS header(%u). "
"Queueing data.\n", data_len, data_need);
// FIXIT-M port segmentation code
// See if there is enough data to process the SMB header
if (data_len < data_need)
{
- DebugFormat(DEBUG_DCE_SMB, "Data len (%u) < "
+ DebugFormat(DEBUG_DCE_SMB, "Data len (%hu) < "
"NetBIOS SS header + SMB header (%u). Queueing data.\n",
data_len, data_need);
{
case SERVICE_IPC:
DebugFormat(DEBUG_DCE_SMB,
- "Tid (%u) is an IPC tree.\n", tid);
+ "Tid (%hu) is an IPC tree.\n", tid);
break;
case SERVICE_DISK:
is_ipc = false;
DebugFormat(DEBUG_DCE_SMB,
- "Tid (%u) is a DISK tree.\n", tid);
+ "Tid (%hu) is a DISK tree.\n", tid);
break;
default:
return DCE2_RET__IGNORE;
uint16_t tid = SmbTid(smb_hdr);
DCE2_SmbInsertTid(ssd, tid, ssd->cur_rtracker->is_ipc);
- DebugFormat(DEBUG_DCE_SMB, "Tid (%u) %s an IPC tree\n", tid,
+ DebugFormat(DEBUG_DCE_SMB, "Tid (%hu) %s an IPC tree\n", tid,
(ssd->cur_rtracker->is_ipc) ? "is" : "is not");
}
{
Profile profile(dce2_smb_pstat_smb_uid);
- DebugFormat(DEBUG_DCE_SMB, "Inserting Uid: %u\n", uid);
+ DebugFormat(DEBUG_DCE_SMB, "Inserting Uid: %hu\n", uid);
if (ssd->uid == DCE2_SENTINEL)
{
Profile profile(dce2_smb_pstat_smb_uid);
- DebugFormat(DEBUG_DCE_SMB,"Removing Uid: %u\n", uid);
+ DebugFormat(DEBUG_DCE_SMB,"Removing Uid: %hu\n", uid);
if ((ssd->uid != DCE2_SENTINEL) && (ssd->uid == (int)uid))
ssd->uid = DCE2_SENTINEL;
dce2_smb_stats.smb_max_outstanding_requests = ssd->outstanding_requests;
DebugFormat(DEBUG_DCE_SMB, "Added new request tracker => "
- "Uid: %u, Tid: %u, Pid: %u, Mid: %u\n",
+ "Uid: %hu, Tid: %hu, Pid: %hu, Mid: %d\n",
rtracker->uid, rtracker->tid, rtracker->pid, rtracker->mid);
DebugFormat(DEBUG_DCE_SMB,
- "Current outstanding requests: %u\n", ssd->outstanding_requests);
+ "Current outstanding requests: %hu\n", ssd->outstanding_requests);
return rtracker;
}
return nullptr;
DebugFormat(DEBUG_DCE_SMB, "Creating new file tracker "
- "with Uid: %u, Tid: %u, Fid: 0x%04X\n", uid, tid, fid);
+ "with Uid: %hu, Tid: %hu, Fid: 0x%04X\n", uid, tid, fid);
DCE2_SmbFileTracker* ftracker = nullptr;
if (ssd->ftracker.fid == DCE2_SENTINEL)
Profile profile(dce2_smb_pstat_smb_fid);
DebugFormat(DEBUG_DCE_SMB, "Finding file tracker with "
- "Uid: %u, Tid: %u, Fid: 0x%04X ... ", uid, tid, fid);
+ "Uid: %hu, Tid: %hu, Fid: 0x%04X ... ", uid, tid, fid);
DCE2_SmbFileTracker* ftracker;
if ((ssd->ftracker.fid != DCE2_SENTINEL) && (ssd->ftracker.fid == (int)fid))
}
DebugFormat(DEBUG_DCE_SMB, "Found with "
- "Uid: %u, Tid: %u, Fid: 0x%04X\n",
+ "Uid: %hu, Tid: %hu, Fid: 0x%04X\n",
ftracker->uid, ftracker->tid, ftracker->fid);
return ftracker;
}
return;
DebugFormat(DEBUG_DCE_SMB, "Freeing file tracker: "
- "Uid: %u, Tid: %u, Fid: 0x%04X\n",
+ "Uid: %hu, Tid: %hu, Fid: 0x%04X\n",
ftracker->uid, ftracker->tid, ftracker->fid);
DCE2_SmbCleanFileTracker(ftracker);
}
DebugFormat(DEBUG_DCE_SMB, "Removing request tracker => "
- "Uid: %u, Tid: %u, Pid: %u, Mid: %u ... ",
+ "Uid: %hu, Tid: %hu, Pid: %hu, Mid: %d ... ",
rtracker->uid, rtracker->tid, rtracker->pid, rtracker->mid);
if (rtracker == &ssd->rtracker)
return;
DebugFormat(DEBUG_DCE_SMB, "Freeing request tracker: "
- "Uid: %u, Tid: %u, Pid: %u, Mid: %u\n",
+ "Uid: %hu, Tid: %hu, Pid: %hu, Mid: %d\n",
rtracker->uid, rtracker->tid, rtracker->pid, rtracker->mid);
DCE2_SmbCleanRequestTracker(rtracker);
{
Profile profile(dce2_smb_pstat_smb_tid);
- DebugFormat(DEBUG_DCE_SMB, "Removing Tid: %u\n", tid);
+ DebugFormat(DEBUG_DCE_SMB, "Removing Tid: %hu\n", tid);
if ((ssd->tid != DCE2_SENTINEL) && ((ssd->tid & 0x0000ffff) == (int)tid))
ssd->tid = DCE2_SENTINEL;
|| ((ssd->max_file_depth == -1) && DCE2_ScSmbFileDepth(
(dce2SmbProtoConf*)ssd->sd.config) == -1)))
{
- DebugFormat(DEBUG_DCE_SMB, "Not inserting TID (%u) "
+ DebugFormat(DEBUG_DCE_SMB, "Not inserting TID (%hu) "
"because it's not IPC and not inspecting normal file "
"data.", tid);
return;
if (is_ipc && DCE2_ScSmbFileInspectionOnly((dce2SmbProtoConf*)ssd->sd.config))
{
- DebugFormat(DEBUG_DCE_SMB, "Not inserting TID (%u) "
+ DebugFormat(DEBUG_DCE_SMB, "Not inserting TID (%hu) "
"because it's IPC and only inspecting normal file "
"data.", tid);
return;
}
- DebugFormat(DEBUG_DCE_SMB, "Inserting Tid: %u\n", tid);
+ DebugFormat(DEBUG_DCE_SMB, "Inserting Tid: %hu\n", tid);
int insert_tid = (int)tid;
// Set a bit so as to distinguish between IPC and non-IPC TIDs
if (!is_ipc)
Profile profile(dce2_smb_pstat_smb_fid);
DebugFormat(DEBUG_DCE_SMB, "Queueing file tracker "
- "with Uid: %u, Tid: %u\n", uid, tid);
+ "with Uid: %hu, Tid: %hu\n", uid, tid);
DCE2_SmbFileTracker* ftracker = (DCE2_SmbFileTracker*)
snort_calloc(sizeof(DCE2_SmbFileTracker));
}
}
- DebugFormat(DEBUG_DCE_TCP, "Start state: %u\n", ds->paf_state);
+ DebugFormat(DEBUG_DCE_TCP, "Start state: %d\n", ds->paf_state);
start_state = (uint8_t)ds->paf_state;
while (n < len)
return StreamSplitter::ABORT;
}
- DebugFormatNoFileLine(DEBUG_DCE_TCP, "Fragment length: %u\n", ds->frag_len);
+ DebugFormatNoFileLine(DEBUG_DCE_TCP, "Fragment length: %hu\n", ds->frag_len);
/* Increment n here so we can continue */
n += ds->frag_len - (uint8_t)ds->paf_state;
* flush just before it */
if ((num_requests == 1) || (n <= len))
tmp_fp += ds->frag_len;
- DebugFormatNoFileLine(DEBUG_DCE_TCP, "Requests: %u\n", num_requests);
+ DebugFormatNoFileLine(DEBUG_DCE_TCP, "Requests: %d\n", num_requests);
ds->paf_state = DCE2_PAF_TCP_STATES__0;
continue; // we incremented n already
default:
{
case DNS_RESP_STATE_RR_RDATA_START:
DebugFormat(DEBUG_DNS,
- "DNS ANSWER RR %d: type %d, class %d, "
- "ttl %d rdlength %d\n", i,
+ "DNS ANSWER RR %d: type %hu, class %hu, "
+ "ttl %u rdlength %hu\n", i,
dnsSessionData->curr_rr.type,
dnsSessionData->curr_rr.dns_class,
dnsSessionData->curr_rr.ttl,
{
case DNS_RESP_STATE_RR_RDATA_START:
DebugFormat(DEBUG_DNS,
- "DNS AUTH RR %d: type %d, class %d, "
- "ttl %d rdlength %d\n", i,
+ "DNS AUTH RR %d: type %hu, class %hu, "
+ "ttl %u rdlength %hu\n", i,
dnsSessionData->curr_rr.type,
dnsSessionData->curr_rr.dns_class,
dnsSessionData->curr_rr.ttl,
{
case DNS_RESP_STATE_RR_RDATA_START:
DebugFormat(DEBUG_DNS,
- "DNS ADDITONAL RR %d: type %d, class %d, "
- "ttl %d rdlength %d\n", i,
+ "DNS ADDITONAL RR %d: type %hu, class %hu, "
+ "ttl %u rdlength %hu\n", i,
dnsSessionData->curr_rr.type,
dnsSessionData->curr_rr.dns_class,
dnsSessionData->curr_rr.ttl,
static bool hi_fsm_compile()
{
- unsigned i = 0, j;
+ unsigned i = 0;
unsigned max = sizeof(hi_rule) / sizeof(hi_rule[0]);
unsigned next, extra = 0;
next = max;
for ( i = 0; i < hi_fsm_size; i++ )
- for ( j = 0; j < 256; j++ )
+ for ( int j = 0; j < 256; j++ )
hi_fsm[i].cell[j].next = TBD;
for ( i = 0; i < max; i++ )
{
- int prev = i, j, n = strlen(hi_rule[i].event);
+ int prev = i, n = strlen(hi_rule[i].event);
const char* event = hi_rule[i].event;
hi_link(hi_fsm+i, event, hi_rule+i);
printf("Expanding %s at %u\n", hi_rule[i].event, next);
#endif
- for ( j = 1; j < n; j++ )
+ for ( int j = 1; j < n; j++ )
{
event = hi_rule[i].event + j;
hi_link(hi_fsm+next, event, hi_rule+i);
uint32_t nreq = s_req->pipe & 0xFF;
uint32_t pipe = s_req->pipe >> 8;
- DebugFormat(DEBUG_STREAM_PAF, "%s: nreq=%d, pipe=0x%X\n", __func__, nreq, pipe);
+ DebugFormat(DEBUG_STREAM_PAF, "%s: nreq=%u, pipe=0x%X\n", __func__, nreq, pipe);
if ( nreq == MAX_PIPELINE )
{
uint32_t nreq = s_req->pipe & 0xFF;
uint32_t pipe = s_req->pipe >> 8;
- DebugFormat(DEBUG_STREAM_PAF, "%s: nreq=%d, pipe=0x%X\n", __func__, nreq, pipe);
+ DebugFormat(DEBUG_STREAM_PAF, "%s: nreq=%u, pipe=0x%X\n", __func__, nreq, pipe);
// FIXIT-L valgrind: Conditional jump or move depends on uninitialised value(s)
if ( nreq == 0 || nreq == PIPELINE_RUPTURED )
get_state(prev, before, sizeof(before));
get_state(s->fsm, after, sizeof(after));
DebugFormat(DEBUG_STREAM_PAF,
- "%s: %s(%u)[0x%2X, '%c'] -> %d,%s(%u)\n",
+ "%s: %s(%hhu)[0x%2X, '%c'] -> %d,%s(%hhu)\n",
__func__, before, prev, c, isgraph(c) ? c : '.',
cell->action, after, s->fsm);
#endif
}
s->flags = 0;
- DebugFormat(DEBUG_STREAM_PAF, "%s: fsm=%u, flags=0x%X\n", __func__, s->fsm, s->flags);
+ DebugFormat(DEBUG_STREAM_PAF, "%s: fsm=%hhu, flags=0x%X\n", __func__, s->fsm, s->flags);
}
//--------------------------------------------------------------------
if (dsize < rsdata->ignore)
{
DebugFormat(DEBUG_RPC,
- "STATEFUL: Ignoring %u bytes\n", dsize);
+ "STATEFUL: Ignoring %hu bytes\n", dsize);
rsdata->ignore -= dsize;
if (dsize < RPC_FRAG_HDR_SIZE)
{
DebugFormat(DEBUG_RPC,
- "STATEFUL: Not enough data for frag header: %u\n",
+ "STATEFUL: Not enough data for frag header: %hu\n",
dsize);
RpcPreprocEvent(rconfig, rsdata, RPC_INCOMPLETE_SEGMENT);
if (dsize < (RPC_FRAG_HDR_SIZE + rsdata->frag_len))
{
DebugFormat(DEBUG_RPC,
- "STATEFUL: Not enough data for fragment: %u\n",
+ "STATEFUL: Not enough data for fragment: %hu\n",
dsize);
RpcPreprocEvent(rconfig, rsdata, RPC_INCOMPLETE_SEGMENT);
{
DebugFormat(DEBUG_RPC,
"STATEFUL: Not enough data for frag header "
- "(%u): %u\n", need, dsize);
+ "(%d): %hu\n", need, dsize);
RpcPreprocEvent(rconfig, rsdata, RPC_INCOMPLETE_SEGMENT);
if (dsize < need)
{
DebugFormat(DEBUG_RPC,
- "STATEFUL: Not enough data for fragment (%u): %u\n",
+ "STATEFUL: Not enough data for fragment (%d): %hu\n",
need, dsize);
RpcPreprocEvent(rconfig, rsdata, RPC_INCOMPLETE_SEGMENT);
if ((length + 4 != psize) && !(p->packet_flags & PKT_REBUILT_STREAM))
{
DebugFormat(DEBUG_RPC, "It's not the only thing in this buffer!"
- " length: %d psize: %d!\n", length, psize);
+ " length: %u psize: %u!\n", length, psize);
return RPC_MULTIPLE_RECORD;
}
else if ( length == 0 )
{
DebugFormat(DEBUG_RPC, "Zero-length RPC fragment detected."
- " length: %d psize: %d.\n", length, psize);
+ " length: %u psize: %u.\n", length, psize);
return RPC_ZERO_LENGTH_FRAGMENT;
}
return 0;
* psize's might be allowed */
DebugFormat(DEBUG_RPC, "Integer Overflow"
- " field(%d) exceeds packet size(%d)\n",
+ " field(%u) exceeds packet size(%u)\n",
length, psize);
return RPC_LARGE_FRAGSIZE;
}
if (length > psize)
{
DebugFormat(DEBUG_RPC, "Length of"
- " field(%d) exceeds packet size(%d)\n",
+ " field(%u) exceeds packet size(%u)\n",
length, psize);
return RPC_INCOMPLETE_SEGMENT;
}
/* The entire request is larger than our current packet
* size
*/
- DebugFormat(DEBUG_RPC, " Decoded Length (%d)"
- "exceeds packet size(%d)\n",
+ DebugFormat(DEBUG_RPC, " Decoded Length (%u)"
+ "exceeds packet size(%u)\n",
decoded_len, psize);
return RPC_LARGE_FRAGSIZE;
}
fragcount++;
DebugFormat(DEBUG_RPC,
- "length: %d size: %d decoded_len: %d\n",
+ "length: %u size: %u decoded_len: %u\n",
length, psize, decoded_len);
ret = SafeMemcpy(norm_index, data_index, length, decode_buf_start, decode_buf_end);
*/
if (decoded_len + ((fragcount - 1) * 4) != psize)
{
- DebugFormat(DEBUG_RPC, "decoded len does not compute: %d\n",
+ DebugFormat(DEBUG_RPC, "decoded len does not compute: %u\n",
decoded_len);
return RPC_MULTIPLE_RECORD;
}
- DebugFormat(DEBUG_RPC, "New size: %d\n", decoded_len);
+ DebugFormat(DEBUG_RPC, "New size: %u\n", decoded_len);
DebugMessage(DEBUG_RPC, "converted data:\n");
//LogNetData(data, decoded_len, p);
static int SIP_deleteDialog(SIP_DialogData*, SIP_DialogList*);
#ifdef DEBUG_MSGS
-void SIP_displayMedias(SIP_MediaList* dList);
+static void SIP_displayMedias(SIP_MediaList* dList);
#endif
/********************************************************************
// check whether this invite has authorization information
if ((SIP_DLG_AUTHENCATING != dialog->state) && (NULL != sipMsg->authorization))
{
- DebugFormat(DEBUG_SIP, "Dialog state code: %u\n",
+ DebugFormat(DEBUG_SIP, "Dialog state code: %hu\n",
dialog->status_code);
SnortEventqAdd(GID_SIP, SIP_EVENT_AUTH_INVITE_REPLAY_ATTACK);
while ((NULL != mdataA)&&(NULL != mdataB))
{
//void *ssn;
- DebugFormat(DEBUG_SIP, "Ignoring channels Source IP: %s Port: %u\n",
+ DebugFormat(DEBUG_SIP, "Ignoring channels Source IP: %s Port: %hu\n",
sfip_to_str(&mdataA->maddress), mdataA->mport);
- DebugFormat(DEBUG_SIP, "Ignoring channels Destine IP: %s Port: %u\n",
+ DebugFormat(DEBUG_SIP, "Ignoring channels Destine IP: %s Port: %hu\n",
sfip_to_str(&mdataB->maddress), mdataB->mport);
/* Call into Streams to mark data channel as something to ignore. */
mdata = currSession->medias;
while (NULL != mdata)
{
- DebugFormat(DEBUG_SIP, "Media IP: %s, port: %u, number of ports %u\n",
+ DebugFormat(DEBUG_SIP, "Media IP: %s, port: %hu, number of ports %hhu\n",
sfip_to_str(&mdata->maddress), mdata->mport, mdata->numPort);
mdata = mdata->nextM;
}
{
SIP_DialogData* dialog;
- DebugFormat(DEBUG_SIP, "Add Dialog id: %u, From: %u, To: %u, status code: %u\n",
+ DebugFormat(DEBUG_SIP, "Add Dialog id: %u, From: %u, To: %u, status code: %hu\n",
sipMsg->dlgID.callIdHash,sipMsg->dlgID.fromTagHash,sipMsg->dlgID.toTagHash,
sipMsg->status_code);
if (space == NULL)
return false;
msg->uriLen = space - msg->uri;
- DebugFormat(DEBUG_SIP, "uri: %.*s, length: %u\n", msg->uriLen, msg->uri,
+ DebugFormat(DEBUG_SIP, "uri: %.*s, length: %hu\n", msg->uriLen, msg->uri,
msg->uriLen);
if (0 == msg->uriLen)
SnortEventqAdd(GID_SIP, SIP_EVENT_EMPTY_REQUEST_URI);
mdata->nextM = msg->mediaSession->medias;
mdata->maddress = msg->mediaSession->maddress_default;
msg->mediaSession->medias = mdata;
- DebugFormat(DEBUG_SIP, "Media IP: %s, Media port %u, number of media: %d\n",
+ DebugFormat(DEBUG_SIP, "Media IP: %s, Media port %hu, number of media: %d\n",
sfip_to_str(&mdata->maddress), mdata->mport, mdata->numPort);
return SIP_PARSE_SUCCESS;
}
/* Continue finding the data length ...*/
if (get_length(val, &pfdata->length) != SMTP_PAF_LENGTH_CONTINUE)
{
- DebugFormat(DEBUG_SMTP, "Find data length: %d\n",
+ DebugFormat(DEBUG_SMTP, "Find data length: %u\n",
pfdata->length);
pfdata->cmd_info.cmd_state = SMTP_PAF_CMD_DATA_END_STATE;
}
num_entries = sizeof(ip_lists)/sizeof(ip_lists[0]);
if ( s_debug )
- printf("Number of entries: %d \n",num_entries);
+ printf("Number of entries: %u \n",num_entries);
dir = sfrt_new(DIR_16_4x4_16x5_4x4, IPv6, num_entries + 1, 200);
if ( s_debug )
{
- printf("Usage: %d bytes\n", sfrt_usage(dir));
- printf("Number of entries: %d \n", sfrt_num_entries(dir));
+ printf("Usage: %u bytes\n", sfrt_usage(dir));
+ printf("Number of entries: %u \n", sfrt_num_entries(dir));
}
sfrt_free(dir);
num_entries = sizeof(ip_lists)/sizeof(ip_lists[0]);
if ( s_debug )
- printf("Number of entries: %d \n",num_entries);
+ printf("Number of entries: %u \n",num_entries);
dir = sfrt_new(DIR_16_4x4_16x5_4x4, IPv6, num_entries + 1, 200);
if ( s_debug )
{
- printf("Usage: %d bytes\n", sfrt_usage(dir));
- printf("Number of entries: %d \n", sfrt_num_entries(dir));
+ printf("Usage: %u bytes\n", sfrt_usage(dir));
+ printf("Number of entries: %u \n", sfrt_num_entries(dir));
}
/*remove all entries*/
/*check the next entry still exist*/
if (index + 1 < num_entries)
{
- IP_entry* ip_entry = &(ip_lists[index + 1]);
+ ip_entry = &(ip_lists[index + 1]);
/*Parse IP*/
if (ip_entry->ip_str)
sfip_pton(ip_entry->ip_str, &ip);
if ( s_debug )
{
- printf("Usage: %d bytes\n", sfrt_usage(dir));
- printf("Number of entries: %d \n", sfrt_num_entries(dir));
+ printf("Usage: %u bytes\n", sfrt_usage(dir));
+ printf("Number of entries: %u \n", sfrt_num_entries(dir));
}
sfrt_free(dir);
{
ft->calculated_size = endOfThisFrag;
- DebugFormat(DEBUG_FRAG, "Got last frag, Bytes: %d, "
- "Calculated size: %d\n",
+ DebugFormat(DEBUG_FRAG, "Got last frag, Bytes: %u, "
+ "Calculated size: %u\n",
ft->frag_bytes,
ft->calculated_size);
}
if (p->dsize <= engine->min_fragment_length)
{
DebugFormat(DEBUG_FRAG,
- "Frag: Received fragment size(%d) is not more than configured min_fragment_length (%d)\n",
+ "Frag: Received fragment size(%d) is not more than configured min_fragment_length (%u)\n",
p->dsize, engine->min_fragment_length);
EventTinyFragments(engine);
return 1;
if (trimmedLength <= engine->min_fragment_length)
{
DebugFormat(DEBUG_FRAG,
- "Frag: # of New octets in Received fragment(%d) is not more than configured min_fragment_length (%d)\n",
+ "Frag: # of New octets in Received fragment(%u) is not more than configured min_fragment_length (%u)\n",
trimmedLength, engine->min_fragment_length);
EventTinyFragments(engine);
return 1;
}
DebugFormat(DEBUG_FRAG,
- " Calc size (%d) != frag bytes (%d)\n",
+ " Calc size (%u) != frag bytes (%u)\n",
ft->calculated_size, ft->frag_bytes);
/*
{
DebugFormat(DEBUG_FRAG,
"[FRAG] Fragment discarded due to low TTL "
- "[0x%X->0x%X], TTL: %d " "Offset: %d Length: %d\n",
+ "[0x%X->0x%X], TTL: %d " "Offset: %d Length: %hu\n",
ntohl(p->ptrs.ip_api.get_ip4h()->get_src()),
ntohl(p->ptrs.ip_api.get_ip4h()->get_dst()),
p->ptrs.ip_api.ttl(), frag_offset,
{
case FRAG_INSERT_FAILED:
DebugFormat(DEBUG_FRAG, "WARNING: Insert into Fraglist failed, "
- "(offset: %u).\n", frag_offset);
+ "(offset: %hu).\n", frag_offset);
return;
case FRAG_INSERT_TTL:
DebugFormat(DEBUG_FRAG,
"[FRAG] Fragment discarded due to large TTL Delta "
"[0x%X->0x%X], TTL: %d orig TTL: %d "
- "Offset: %d Length: %d\n",
+ "Offset: %hu Length: %hu\n",
ntohl(p->ptrs.ip_api.get_ip4h()->get_src()),
ntohl(p->ptrs.ip_api.get_ip4h()->get_dst()),
p->ptrs.ip_api.ttl(), ft->ttl, frag_offset,
case FRAG_INSERT_TIMEOUT:
DebugFormat(DEBUG_FRAG, "WARNING: Insert into Fraglist failed due to timeout, "
- "(offset: %u).\n", frag_offset);
+ "(offset: %hu).\n", frag_offset);
return;
case FRAG_INSERT_OVERLAP_LIMIT:
DebugFormat(DEBUG_FRAG,
"WARNING: Excessive IP fragment overlap, "
- "(More: %u, offset: %u, offsetSize: %u).\n",
+ "(More: %d, offset: %d, offsetSize: %hu).\n",
(p->ptrs.decode_flags & DECODE_MF),
(frag_offset << 3), p->dsize);
ip_stats.discards++;
ft->frag_bytes += newfrag->size;
DebugFormat(DEBUG_FRAG,
- "[#] accumulated bytes on FragTracker %d, count"
+ "[#] accumulated bytes on FragTracker %u, count"
" %d\n", ft->frag_bytes, ft->fraglist_count);
*retFrag = newfrag;
ft->frag_bytes += newfrag->size;
DebugFormat(DEBUG_FRAG,
- "[#] accumulated bytes on FragTracker %d, count"
+ "[#] accumulated bytes on FragTracker %u, count"
" %d\n", ft->frag_bytes, ft->fraglist_count);
*retFrag = newfrag;
if ( opt.code == TcpOptCode::MAXSEG )
{
*value = extract_16bits(opt.data);
- DebugFormat(DEBUG_STREAM_STATE, "Found MSS %u\n", *value);
+ DebugFormat(DEBUG_STREAM_STATE, "Found MSS %hu\n", *value);
return TF_MSS;
}
}
{
Packet* pkt = get_syn_packet(flow);
pkt->flow->session = new TcpSession(flow);
- int dir;
Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_SERVER, 0, 0);
bool ignored = Stream::ignored_session(flow, pkt);
{
Packet* pkt = get_syn_ack_packet(flow);
pkt->flow->session = new TcpSession(flow);
- int dir;
Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_SERVER, 0, 0);
bool ignored = Stream::ignored_session(flow, pkt);
{
Packet* pkt = get_syn_packet(flow);
pkt->flow->session = new TcpSession(flow);
- int dir;
Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_CLIENT, 0, 0);
bool ignored = Stream::ignored_session(flow, pkt);
{
Packet* pkt = get_syn_ack_packet(flow);
pkt->flow->session = new TcpSession(flow);
- int dir;
Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_CLIENT, 0, 0);
bool ignored = Stream::ignored_session(flow, pkt);
{
Packet* pkt = get_syn_packet(flow);
pkt->flow->session = new TcpSession(flow);
- int dir;
Stream::stop_inspection(flow, pkt, SSN_DIR_BOTH, 0, 0);
bool ignored = Stream::ignored_session(flow, pkt);
{
Packet* pkt = get_syn_ack_packet(flow);
pkt->flow->session = new TcpSession(flow);
- int dir;
Stream::stop_inspection(flow, pkt, SSN_DIR_BOTH, 0, 0);
bool ignored = Stream::ignored_session(flow, pkt);
void SegmentOverlapEditor::drop_old_segment()
{
DebugFormat(DEBUG_STREAM_STATE,
- "full right overlap, dropping old segment at seq %d, size %d\n",
+ "full right overlap, dropping old segment at seq %u, size %hu\n",
right->seq, right->payload_size);
TcpSegmentNode* drop_seg = right;
int SegmentOverlapEditor::left_overlap_keep_last()
{
- int rc = STREAM_INSERT_OK;
-
DebugFormat(DEBUG_STREAM_STATE, "left overlap %d\n", overlap);
len = tsd->get_seg_len();
}
}
- return rc;
+ return STREAM_INSERT_OK;
}
void SegmentOverlapEditor::right_overlap_truncate_existing()
uint32_t rseq = ( txd ) ? h->seq() - txd : h->seq();
uint32_t rack = ( rxd ) ? h->ack() - rxd : h->ack();
- fprintf(stdout, "\n" FMTu64("-3") " %s=0x%02x Seq=%-4u Ack=%-4u Win=%-4u Len=%-4u%s\n",
+ fprintf(stdout, "\n" FMTu64("-3") " %s=0x%02x Seq=%-4u Ack=%-4u Win=%-4hu Len=%-4hu%s\n",
//"\n" FMTu64("-3") " %s=0x%02x Seq=%-4u Ack=%-4u Win=%-4u Len=%-4u End=%-4u%s\n",
pc.total_from_daq, flags, h->th_flags, rseq, rack, h->win(), p->dsize, order);
}
inline void TraceSession(const Flow* lws)
{
- fprintf(stdout, " LWS: ST=0x%x SF=0x%x CP=%u SP=%u\n", (unsigned)lws->session_state,
+ fprintf(stdout, " LWS: ST=0x%x SF=0x%x CP=%hu SP=%hu\n", (unsigned)lws->session_state,
lws->ssn_state.session_flags, lws->client_port, lws->server_port);
}
{
/* this packet is from way too far into the future */
DebugFormat(DEBUG_STREAM_STATE,
- "packet PAWS timestamp way too far ahead of last packet %ld %d...\n",
+ "packet PAWS timestamp way too far ahead of last packet %ld %u...\n",
tsd.get_pkt()->pkth->ts.tv_sec, peer_tracker->get_ts_last_packet() );
//inc_tcp_discards();
( ( TcpSession* )tsd.get_flow()->session )->tel.set_tcp_event(EVENT_BAD_TIMESTAMP);
{
// zero size data because of trimming. Don't insert it
DebugFormat(DEBUG_STREAM_STATE, "zero size TCP data after left & right trimming "
- "(len: %d slide: %d trunc: %d)\n", len, slide, trunc_len);
+ "(len: %hd slide: %u trunc: %u)\n", len, slide, trunc_len);
inc_tcp_discards();
tracker->normalizer->trim_win_payload(tsd);
tsd.get_pkt()->packet_flags |= PKT_STREAM_INSERT;
DebugFormat(DEBUG_STREAM_STATE,
- "added %d bytes on segment list @ seq: 0x%X, total %u, %d segments queued\n",
+ "added %hu bytes on segment list @ seq: 0x%X, total %u, %u segments queued\n",
tsn->payload_size, tsn->seq, seg_bytes_logical, get_pending_segment_count(0));
#ifdef SEG_TEST
queue_reassembly_segment(left, tsn);
DebugFormat(DEBUG_STREAM_STATE,
- "added %d bytes on segment list @ seq: 0x%X, total %u, %d segments queued\n",
+ "added %hu bytes on segment list @ seq: 0x%X, total %u, %u segments queued\n",
tsn->payload_size, tsn->seq, seg_bytes_logical, get_pending_segment_count(0));
*retSeg = tsn;
tsn = seglist.head;
- DebugFormat(DEBUG_STREAM_STATE, "In purge_to_seq, start seq = 0x%X end seq = 0x%X delta %d\n",
+ DebugFormat(DEBUG_STREAM_STATE, "In purge_to_seq, start seq = 0x%X end seq = 0x%X delta %u\n",
tsn->seq, flush_seq, flush_seq-tsn->seq);
while ( tsn )
DEBUG_WRAP(bytes_queued -= bytes_flushed; );
DebugFormat(DEBUG_STREAM_STATE,
- "flushed %d bytes / %d segs on stream, %d bytes still queued\n",
+ "flushed %hu bytes / %u segs on stream, %u bytes still queued\n",
bytes_flushed, segs, bytes_queued);
return bytes_flushed;
if (footprint == 0)
{
- DebugFormat(DEBUG_STREAM_STATE, "Negative footprint, bailing %d (0x%X - 0x%X)\n",
+ DebugFormat(DEBUG_STREAM_STATE, "Negative footprint, bailing %u (0x%X - 0x%X)\n",
footprint, stop_seq, seglist_base_seq);
return bytes_processed;
}
add_reassembly_segment(tsd, tsd.get_seg_len(), overlap, 0, tsd.get_seg_seq() + overlap, NULL);
DebugFormat(DEBUG_STREAM_STATE,
- "Attached new queue to seglist, %d bytes queued, base_seq 0x%X\n",
+ "Attached new queue to seglist, %u bytes queued, base_seq 0x%X\n",
tsd.get_seg_len() - overlap, seglist_base_seq);
}
for ( tsn = seglist.head; tsn; tsn = tsn->next )
{
DEBUG_WRAP(
- DebugFormat(DEBUG_STREAM_STATE, "tsn: %p seq: 0x%X size: %hu delta: %d\n",
+ DebugFormat(DEBUG_STREAM_STATE, "tsn: %p seq: 0x%X size: %hu delta: %u\n",
(void*) tsn, tsn->seq, tsn->payload_size, ( tsn->seq - base_seq ) - last);
last = tsn->seq - base_seq;
lastptr = tsn;
for ( tsn = seglist.tail; tsn; tsn = tsn->prev )
{
DEBUG_WRAP(
- DebugFormat(DEBUG_STREAM_STATE, "tsn: %p seq: 0x%X size: %hu delta: %d\n",
+ DebugFormat(DEBUG_STREAM_STATE, "tsn: %p seq: 0x%X size: %hu delta: %u\n",
(void*) tsn, tsn->seq, tsn->payload_size, ( tsn->seq - base_seq ) - last);
last = tsn->seq - base_seq;
lastptr = tsn;
int rc = STREAM_INSERT_OK;
DebugFormat(DEBUG_STREAM_STATE,
- "Queuing %d bytes on stream!\nbase_seq: %X seq: %X seq_end: %X\n",
+ "Queuing %u bytes on stream!\nbase_seq: %X seq: %X seq_end: %X\n",
tsd.get_end_seq() - tsd.get_seg_seq(), seglist_base_seq, tsd.get_seg_seq(),
tsd.get_end_seq());
- DebugFormat(DEBUG_STREAM_STATE, "%d segments on seglist\n", get_pending_segment_count(0));
+ DebugFormat(DEBUG_STREAM_STATE, "%u segments on seglist\n", get_pending_segment_count(0));
DebugMessage(DEBUG_STREAM_STATE, "!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+\n");
DebugMessage(DEBUG_STREAM_STATE, "!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+\n");
sfip_ntop(p->ptrs.ip_api.get_dst(), dst_addr, sizeof(dst_addr));
DebugFormat((DEBUG_STREAM|DEBUG_STREAM_STATE),
- "Got TCP Packet %s:%d -> %s:%d %s\nseq: 0x%X ack:0x%X dsize: %u\n",
+ "Got TCP Packet %s:%hu -> %s:%hu %s\nseq: 0x%X ack:0x%X dsize: %hu\n",
src_addr, p->ptrs.sp, dst_addr, p->ptrs.dp, flagbuf,
p->ptrs.tcph->seq(), p->ptrs.tcph->ack(), p->dsize);
);
host->ipAddr.bits);
DebugFormat(DEBUG_ATTRIBUTE,
- "\tPolicy Information: frag:%s (%u) stream: %s (%u)\n",
+ "\tPolicy Information: frag:%s (%hhu) stream: %s (%hhu)\n",
"look-me-up", host->hostInfo.fragPolicy,
"look-me-up", host->hostInfo.streamPolicy);
namespace t_stopwatch
{
-struct Clock : ClockTraits<hr_clock>
+struct Clock : public ClockTraits<hr_clock>
{
static time_point now()
{ return time; }
std::string format;
int length;
- inline bool operator==(Command c)
- { return (!name.compare(c.name)); }
-
Command() : name(std::string()),
format(std::string()),
length(command_default_len) { }
private:
bool output_set = false;
-
- bool parse_file_option(std::istringstream& data_stream,
- std::string orig_name,
- std::string option_name,
- std::string new_file_name);
};
} // namespace
-bool PerfMonitor::parse_file_option(std::istringstream& data_stream,
- std::string orig_name,
- std::string option_name,
- std::string new_file_name)
-{
- bool tmpval;
-
- table_api.add_comment(orig_name + " deprecated. If '" + option_name +
- " = true', Snort++ automatically prints to '" + new_file_name + "'");
- tmpval = table_api.add_option(option_name, true);
-
- if (eat_option(data_stream)) // we no longer care about the file name.
- return tmpval;
- return false;
-}
-
bool PerfMonitor::convert(std::istringstream& data_stream)
{
std::string keyword;
virtual bool convert(std::istringstream& data_stream);
private:
- bool parse_list(std::string table_name, std::istringstream& data_stream);
bool parse_option(std::string table_name, std::istringstream& data_stream);
bool add_portscan_global_option(std::string name, std::istringstream& data_stream);
- // a wrapper for parse_list. adds an addition '[..]' around the string
bool parse_ip_list(std::string table_name, std::istringstream& data_stream);
};
} // namespace
return table_api.add_option(list_name, prev);
}
-bool PortScan::parse_list(std::string list_name, std::istringstream& data_stream)
-{
- std::string elem;
- bool retval = true;
-
- if (!(data_stream >> elem) || (elem != "{"))
- return false;
-
- while (data_stream >> elem && elem != "}")
- retval && table_api.add_list(list_name, elem) && retval;
-
- return retval;
-}
-
bool PortScan::parse_option(std::string list_name, std::istringstream& data_stream)
{
std::string elem;
std::string format;
int length;
- inline bool operator==(Command c)
- { return (!name.compare(c.name)); }
-
Command() : name(std::string()),
format(std::string()),
length(command_default_len) { }