本文整理汇总了C++中TCP::options方法的典型用法代码示例。如果您正苦于以下问题:C++ TCP::options方法的具体用法?C++ TCP::options怎么用?C++ TCP::options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCP
的用法示例。
在下文中一共展示了TCP::options方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: quirkPast
bool Signature::quirkPast( const Packet &p ) const
{
//Checks for options after EOL
bool eol = false;
if( p.inetIs< IPv4 >( 0 ) && p.transIs< TCP >( 0 ) )
{
IPv4 ip = p.getInet<IPv4>( 0 );
TCP tcp = p.getTrans<TCP>( 0 );
std::vector< SmartPtr< TCPOption > > options = tcp.options();
for( int i = 0; i < options.size(); ++i )
{
TCPOption * opt = options[i];
if( !eol && opt->kind() == TCPOption::END_OF_LIST )
{
eol = true;
}
else if( eol && opt->kind() != TCPOption::END_OF_LIST )
{
return true;
}
}
}
return false;
}
示例2: setFromPacket
void Signature::setFromPacket( const Packet &p )
{
if( p.inetIs< IPv4 >( 0 ) && p.transIs< TCP >( 0 ) )
{
IPv4 ip = p.getInet<IPv4>( 0 );
TCP tcp = p.getTrans<TCP>( 0 );
std::vector< SmartPtr< TCPOption > > options = tcp.options();
uint32_t quirks = 0;
//set IP stuff
setDontFragment( ip.dontFragment() );
setTtl( ip.ttl() );
//set TCP stuff
setWindowSize( tcp.windowSize() );
//set TCP options
std::vector< uint8_t > tcpOptions;
std::vector< SmartPtr< TCPOption > >::iterator itr;
for( itr = options.begin(); itr != options.end(); ++itr )
{
uint8_t kind = (*itr)->kind();
if( kind == TCPOption::MAXIMUM_SEGMENT_SIZE )
{
MSSOption* mss = static_cast<MSSOption*>((*itr).data());
mss_ = mss->mss();
}
checkForQuirks( p );
tcpOptions.push_back( kind );
}
setTcpOptions( tcpOptions );
}
}
示例3: sizeof
TEST_F(TCPTest, SpoofedOptions) {
TCP pdu;
uint8_t a[] = { 1,2,3,4,5,6 };
pdu.add_option(
TCP::option(TCP::SACK, 250, a, a + sizeof(a))
);
pdu.add_option(
TCP::option(TCP::SACK, 250, a, a + sizeof(a))
);
pdu.add_option(
TCP::option(TCP::SACK, 250, a, a + sizeof(a))
);
// probably we'd expect it to crash if it's not working, valgrind plx
EXPECT_EQ(3U, pdu.options().size());
EXPECT_EQ(pdu.serialize().size(), pdu.size());
}
示例4:
bool Signature::quirkT2( const Packet &p ) const
{
if( p.inetIs< IPv4 >( 0 ) && p.transIs< TCP >( 0 ) )
{
TCP tcp = p.getTrans<TCP>( 0 );
std::vector< SmartPtr< TCPOption > > options = tcp.options();
for( int i = 0; i < options.size(); ++i )
{
if( options[i]->kind() == TCPOption::TIME_STAMP_OPTION )
{
TimeStampOption* tsopt = static_cast<TimeStampOption*>(options[i].data());
if( tsopt->tsecr() != 0 )
return true;
}
}
}
return false;
}