Added new test for a different regex supporting the Cisco style that omits

some parameters prescribed in RFC4568.
This commit is contained in:
pierre-luc
2010-01-27 18:53:17 -05:00
parent c8e739f1e2
commit 0e9fb9c149
2 changed files with 23 additions and 0 deletions

View File

@ -122,6 +122,26 @@ void SdesNegotiatorTest::testKeyParamsPattern()
pattern = NULL;
}
void SdesNegotiatorTest::testKeyParamsPatternCiscoStyle()
{
std::string subject = "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj";
pattern = new sfl::Pattern("(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \
"(?P<srtpKeyInfo>[A-Za-z0-9\x2B\x2F\x3D]+)" \
"(\\|2\\^(?P<lifetime>[0-9]+)\\|" \
"(?P<mkiValue>[0-9]+)\\:" \
"(?P<mkiLength>[0-9]{1,3})\\;?)?", "g");
*pattern << subject;
pattern->matches();
CPPUNIT_ASSERT(pattern->group("srtpKeyMethod").compare("inline:"));
CPPUNIT_ASSERT(pattern->group("srtpKeyInfo").compare("d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj") == 0);
delete pattern;
pattern = NULL;
}
/**
* Make sure that all the fields can be extracted
* properly from the syntax.

View File

@ -65,6 +65,7 @@ class SdesNegotiatorTest : public CppUnit::TestCase {
CPPUNIT_TEST( testTagPattern );
CPPUNIT_TEST( testCryptoSuitePattern );
CPPUNIT_TEST( testKeyParamsPattern );
CPPUNIT_TEST( testKeyParamsPatternCiscoStyle );
CPPUNIT_TEST( testNegotiation );
// CPPUNIT_TEST( testComponent );
CPPUNIT_TEST_SUITE_END();
@ -91,6 +92,8 @@ class SdesNegotiatorTest : public CppUnit::TestCase {
void testKeyParamsPattern();
void testKeyParamsPatternCiscoStyle();
void testNegotiation();
void testComponent();