HeaderInsertionTests.cpp 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875
  1. /*
  2. * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above
  10. * copyright notice, this list of conditions and the following
  11. * disclaimer in the documentation and/or other materials provided
  12. * with the distribution.
  13. * * Neither the name of The Linux Foundation nor the names of its
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  18. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  20. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  21. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  22. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  23. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  24. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  25. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  26. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  27. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #include "RoutingDriverWrapper.h"
  30. #include "HeaderInsertion.h"
  31. #include "Filtering.h"
  32. #include "IPAFilteringTable.h"
  33. #include "hton.h" // for htonl
  34. #include "TestsUtils.h"
  35. #include <string.h>
  36. #define IPV4_DST_ADDR_OFFSET (16)
  37. class IPAHeaderInsertionTestFixture: public TestBase {
  38. public:
  39. IPAHeaderInsertionTestFixture() : m_uBufferSize(0)
  40. {
  41. memset(m_aBuffer, 0, sizeof(m_aBuffer));
  42. m_testSuiteName.push_back("Insertion");
  43. }
  44. virtual bool AddRules() = 0;
  45. virtual bool ModifyPackets() = 0;
  46. virtual bool TestLogic() = 0;
  47. bool Setup()
  48. {
  49. ConfigureScenario(PHASE_FIVE_TEST_CONFIGURATION);
  50. m_producer.Open(INTERFACE0_TO_IPA_DATA_PATH,
  51. INTERFACE0_FROM_IPA_DATA_PATH);
  52. m_Consumer1.Open(INTERFACE1_TO_IPA_DATA_PATH,
  53. INTERFACE1_FROM_IPA_DATA_PATH);
  54. m_Consumer2.Open(INTERFACE2_TO_IPA_DATA_PATH,
  55. INTERFACE2_FROM_IPA_DATA_PATH);
  56. m_Consumer3.Open(INTERFACE3_TO_IPA_DATA_PATH,
  57. INTERFACE3_FROM_IPA_DATA_PATH);
  58. if (!m_Routing.DeviceNodeIsOpened()) {
  59. LOG_MSG_ERROR(
  60. "Routing block is not ready for immediate commands!\n");
  61. return false;
  62. }
  63. if (!m_Filtering.DeviceNodeIsOpened()) {
  64. LOG_MSG_ERROR(
  65. "Filtering block is not ready for immediate commands!\n");
  66. return false;
  67. }
  68. if (!m_HeaderInsertion.DeviceNodeIsOpened())
  69. {
  70. LOG_MSG_ERROR("Header Insertion block is not ready for immediate commands!\n");
  71. return false;
  72. }
  73. m_HeaderInsertion.Reset();// resetting this component will reset both Routing and Filtering tables.
  74. return true;
  75. } // Setup()
  76. bool Run()
  77. {
  78. m_uBufferSize = BUFF_MAX_SIZE;
  79. LOG_MSG_STACK("Entering Function");
  80. // Add the relevant filtering rules
  81. if (!AddRules()) {
  82. LOG_MSG_ERROR("Failed adding filtering rules.");
  83. return false;
  84. }
  85. // Load input data (IP packet) from file
  86. if (!LoadDefaultPacket(m_eIP, m_aBuffer, m_uBufferSize)) {
  87. LOG_MSG_ERROR("Failed default Packet");
  88. return false;
  89. }
  90. if (!ModifyPackets()) {
  91. LOG_MSG_ERROR("Failed to modify packets.");
  92. return false;
  93. }
  94. if (!TestLogic()) {
  95. LOG_MSG_ERROR("Test failed, Input and expected output mismatch.");
  96. return false;
  97. }
  98. LOG_MSG_STACK("Leaving Function (Returning True)");
  99. return true;
  100. } // Run()
  101. bool Teardown()
  102. {
  103. m_HeaderInsertion.Reset();// resetting this component will reset both Routing and Filtering tables.
  104. m_producer.Close();
  105. m_Consumer1.Close();
  106. m_Consumer2.Close();
  107. m_Consumer3.Close();
  108. return true;
  109. } // Teardown()
  110. ~IPAHeaderInsertionTestFixture() {}
  111. static RoutingDriverWrapper m_Routing;
  112. static Filtering m_Filtering;
  113. static HeaderInsertion m_HeaderInsertion;
  114. InterfaceAbstraction m_producer;
  115. InterfaceAbstraction m_Consumer1;
  116. InterfaceAbstraction m_Consumer2;
  117. InterfaceAbstraction m_Consumer3;
  118. protected:
  119. static const size_t BUFF_MAX_SIZE = 1024;
  120. static const uint8_t MAX_HEADER_SIZE = 64; // 64Bytes - Max Header Length
  121. enum ipa_ip_type m_eIP;
  122. uint8_t m_aBuffer[BUFF_MAX_SIZE]; // Input file \ IP packet
  123. size_t m_uBufferSize;
  124. };
  125. RoutingDriverWrapper IPAHeaderInsertionTestFixture::m_Routing;
  126. Filtering IPAHeaderInsertionTestFixture::m_Filtering;
  127. HeaderInsertion IPAHeaderInsertionTestFixture::m_HeaderInsertion;
  128. //---------------------------------------------------------------------------/
  129. // Test002: Test that 802.3 header was inserted Correctly /
  130. //---------------------------------------------------------------------------/
  131. class IPAHeaderInsertionTest001: public IPAHeaderInsertionTestFixture {
  132. public:
  133. IPAHeaderInsertionTest001() {
  134. m_name = "IPAHeaderInsertionTest001";
  135. m_description =
  136. "Header Insertion Test 001 - Test RMNet Header Insertion\
  137. 1. Generate and commit RMNet.3 header Insertion \
  138. 2. Generate and commit routing table containing bypass rule. \
  139. 3. Generate and commit bypass filtering rule. \
  140. 4. Send a packet, and verify that the RMNet.3 Header was inserted correctly.";
  141. Register(*this);
  142. uint8_t aRMNetHeader[6] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
  143. m_nHeadertoAddSize = sizeof(aRMNetHeader);
  144. memcpy(m_aHeadertoAdd, aRMNetHeader, m_nHeadertoAddSize);
  145. }
  146. // Test Description:
  147. // 1. Generate and commit single bypass routing table.
  148. virtual bool AddRules() {
  149. m_eIP = IPA_IP_v4;
  150. const char bypass0[20] = "Bypass0";
  151. struct ipa_ioc_get_rt_tbl sRoutingTable;
  152. bool bRetVal = true;
  153. struct ipa_ioc_get_hdr sRetHeader;
  154. IPAFilteringTable cFilterTable;
  155. struct ipa_flt_rule_add sFilterRuleEntry;
  156. uint32_t nRTTableHdl=0;
  157. memset(&sRoutingTable, 0, sizeof(sRoutingTable));
  158. memset(&sRetHeader, 0, sizeof(sRetHeader));
  159. strlcpy(sRetHeader.name, "IEEE802_3", sizeof(sRetHeader.name));
  160. LOG_MSG_STACK("Entering Function");
  161. // Create Header:
  162. // Allocate Memory, populate it, and add in to the Header Insertion.
  163. struct ipa_ioc_add_hdr * pHeaderDescriptor = NULL;
  164. pHeaderDescriptor = (struct ipa_ioc_add_hdr *) calloc(1,
  165. sizeof(struct ipa_ioc_add_hdr)
  166. + 1 * sizeof(struct ipa_hdr_add));
  167. if (!pHeaderDescriptor) {
  168. LOG_MSG_ERROR("calloc failed to allocate pHeaderDescriptor");
  169. bRetVal = false;
  170. goto bail;
  171. }
  172. pHeaderDescriptor->commit = true;
  173. pHeaderDescriptor->num_hdrs = 1;
  174. strlcpy(pHeaderDescriptor->hdr[0].name, sRetHeader.name, sizeof(pHeaderDescriptor->hdr[0].name));
  175. memcpy(pHeaderDescriptor->hdr[0].hdr, m_aHeadertoAdd,
  176. m_nHeadertoAddSize); //Header's Data
  177. pHeaderDescriptor->hdr[0].hdr_len = m_nHeadertoAddSize;
  178. pHeaderDescriptor->hdr[0].hdr_hdl = -1; //Return Value
  179. pHeaderDescriptor->hdr[0].is_partial = false;
  180. pHeaderDescriptor->hdr[0].status = -1; // Return Parameter
  181. strlcpy(sRetHeader.name, pHeaderDescriptor->hdr[0].name, sizeof(sRetHeader.name));
  182. if (!m_HeaderInsertion.AddHeader(pHeaderDescriptor))
  183. {
  184. LOG_MSG_ERROR("m_HeaderInsertion.AddHeader(pHeaderDescriptor) Failed.");
  185. bRetVal = false;
  186. goto bail;
  187. }
  188. if (!m_HeaderInsertion.GetHeaderHandle(&sRetHeader))
  189. {
  190. LOG_MSG_ERROR(" Failed");
  191. bRetVal = false;
  192. goto bail;
  193. }
  194. if (!CreateBypassRoutingTable(&m_Routing, m_eIP, bypass0, IPA_CLIENT_TEST2_CONS,
  195. sRetHeader.hdl,&nRTTableHdl)) {
  196. LOG_MSG_ERROR("CreateBypassRoutingTable Failed\n");
  197. bRetVal = false;
  198. goto bail;
  199. }
  200. LOG_MSG_INFO("CreateBypassRoutingTable completed successfully");
  201. sRoutingTable.ip = m_eIP;
  202. strlcpy(sRoutingTable.name, bypass0, sizeof(sRoutingTable.name));
  203. if (!m_Routing.GetRoutingTable(&sRoutingTable)) {
  204. LOG_MSG_ERROR(
  205. "m_routing.GetRoutingTable(&sRoutingTable=0x%p) Failed.", &sRoutingTable);
  206. bRetVal = false;
  207. goto bail;
  208. }
  209. // Creating Filtering Rules
  210. cFilterTable.Init(m_eIP,IPA_CLIENT_TEST_PROD,false,1);
  211. LOG_MSG_INFO("Creation of filtering table completed successfully");
  212. // Configuring Filtering Rule No.1
  213. cFilterTable.GeneratePresetRule(0,sFilterRuleEntry);
  214. sFilterRuleEntry.at_rear = true;
  215. sFilterRuleEntry.flt_rule_hdl = -1; // return Value
  216. sFilterRuleEntry.status = -1; // return value
  217. sFilterRuleEntry.rule.action = IPA_PASS_TO_ROUTING;
  218. sFilterRuleEntry.rule.rt_tbl_hdl = nRTTableHdl; //put here the handle corresponding to Routing Rule 1
  219. if (
  220. ((uint8_t)-1 == cFilterTable.AddRuleToTable(sFilterRuleEntry)) ||
  221. !m_Filtering.AddFilteringRule(cFilterTable.GetFilteringTable())
  222. )
  223. {
  224. LOG_MSG_ERROR ("Adding Rule (0) to Filtering block Failed.");
  225. bRetVal = false;
  226. goto bail;
  227. } else
  228. {
  229. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n", cFilterTable.ReadRuleFromTable(0)->flt_rule_hdl,cFilterTable.ReadRuleFromTable(0)->status);
  230. }
  231. bail:
  232. Free(pHeaderDescriptor);
  233. LOG_MSG_STACK(
  234. "Leaving Function (Returning %s)", bRetVal?"True":"False");
  235. return bRetVal;
  236. } // AddRules()
  237. virtual bool ModifyPackets() {
  238. // This test doesn't modify the original IP Packet.
  239. return true;
  240. } // ModifyPacktes ()
  241. virtual bool TestLogic() {
  242. memset(m_aExpectedBuffer, 0, sizeof(m_aExpectedBuffer));
  243. m_aExpectedBufSize = 0;
  244. memcpy(m_aExpectedBuffer, m_aHeadertoAdd, m_nHeadertoAddSize);
  245. memcpy(m_aExpectedBuffer+m_nHeadertoAddSize,m_aBuffer,m_uBufferSize);
  246. m_aExpectedBufSize = m_nHeadertoAddSize + m_uBufferSize;
  247. if (!SendReceiveAndCompare(&m_producer, m_aBuffer, m_uBufferSize,
  248. &m_Consumer1, m_aExpectedBuffer, m_aExpectedBufSize)) {
  249. LOG_MSG_ERROR("SendReceiveAndCompare failed.");
  250. return false;
  251. }
  252. return true;
  253. }
  254. private:
  255. uint8_t m_aExpectedBuffer[BUFF_MAX_SIZE]; // Input file / IP packet
  256. size_t m_aExpectedBufSize;
  257. uint8_t m_aHeadertoAdd[MAX_HEADER_SIZE];
  258. size_t m_nHeadertoAddSize;
  259. };
  260. //---------------------------------------------------------------------------/
  261. // Test002: Test that 802.3 header was inserted Correctly /
  262. //---------------------------------------------------------------------------/
  263. class IPAHeaderInsertionTest002: public IPAHeaderInsertionTestFixture {
  264. public:
  265. IPAHeaderInsertionTest002() {
  266. m_name = "IPAHeaderInsertionTest002";
  267. m_description =
  268. "Header Insertion Test 002 - Test IEEE802.3 Header Insertion\
  269. 1. Generate and commit IEEE802.3 header Insertion \
  270. 2. Generate and commit routing table containing bypass rule. \
  271. 3. Generate and commit bypass filtering rule. \
  272. 4. Send a packet, and verify that the IEEE802.3 Header was inserted correctly \
  273. and that the header Length was updated as well";
  274. Register(*this);
  275. uint8_t aIEEE802_3Header[22] = { 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
  276. 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x00, 0x46, 0xAE, 0xAF, 0xB0,// the correct size (00 46) is inserted here.
  277. 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6 };
  278. m_nHeadertoAddSize = sizeof(aIEEE802_3Header);
  279. memcpy(m_aHeadertoAdd, aIEEE802_3Header, m_nHeadertoAddSize);
  280. }
  281. // Test Description:
  282. // 1. Generate and commit single bypass routing table.
  283. virtual bool AddRules() {
  284. m_eIP = IPA_IP_v4;
  285. const char bypass0[20] = "Bypass0";
  286. struct ipa_ioc_get_rt_tbl sRoutingTable;
  287. bool bRetVal = true;
  288. struct ipa_ioc_get_hdr sRetHeader;
  289. IPAFilteringTable cFilterTable;
  290. struct ipa_flt_rule_add sFilterRuleEntry;
  291. uint32_t nRTTableHdl=0;
  292. memset(&sRoutingTable, 0, sizeof(sRoutingTable));
  293. memset(&sRetHeader, 0, sizeof(sRetHeader));
  294. strlcpy(sRetHeader.name, "IEEE802_3", sizeof(sRetHeader.name));
  295. LOG_MSG_STACK("Entering Function");
  296. // Create Header:
  297. // Allocate Memory, populate it, and add in to the Header Insertion.
  298. struct ipa_ioc_add_hdr * pHeaderDescriptor = NULL;
  299. pHeaderDescriptor = (struct ipa_ioc_add_hdr *) calloc(1,
  300. sizeof(struct ipa_ioc_add_hdr)
  301. + 1 * sizeof(struct ipa_hdr_add));
  302. if (!pHeaderDescriptor) {
  303. LOG_MSG_ERROR("calloc failed to allocate pHeaderDescriptor");
  304. bRetVal = false;
  305. goto bail;
  306. }
  307. pHeaderDescriptor->commit = true;
  308. pHeaderDescriptor->num_hdrs = 1;
  309. strlcpy(pHeaderDescriptor->hdr[0].name, sRetHeader.name, sizeof(pHeaderDescriptor->hdr[0].name)); // Header's Name
  310. memcpy(pHeaderDescriptor->hdr[0].hdr, m_aHeadertoAdd,
  311. m_nHeadertoAddSize); //Header's Data
  312. pHeaderDescriptor->hdr[0].hdr[12] = 0x00; //set length to zero, to confirm if ipa updates or not
  313. pHeaderDescriptor->hdr[0].hdr_len = m_nHeadertoAddSize;
  314. pHeaderDescriptor->hdr[0].hdr_hdl = -1; //Return Value
  315. pHeaderDescriptor->hdr[0].is_partial = false;
  316. pHeaderDescriptor->hdr[0].status = -1; // Return Parameter
  317. strlcpy(sRetHeader.name, pHeaderDescriptor->hdr[0].name, sizeof(sRetHeader.name));
  318. if (!m_HeaderInsertion.AddHeader(pHeaderDescriptor))
  319. {
  320. LOG_MSG_ERROR("m_HeaderInsertion.AddHeader(pHeaderDescriptor) Failed.");
  321. bRetVal = false;
  322. goto bail;
  323. }
  324. if (!m_HeaderInsertion.GetHeaderHandle(&sRetHeader))
  325. {
  326. LOG_MSG_ERROR(" Failed");
  327. bRetVal = false;
  328. goto bail;
  329. }
  330. if (!CreateBypassRoutingTable(&m_Routing, m_eIP, bypass0, IPA_CLIENT_TEST3_CONS,
  331. sRetHeader.hdl,&nRTTableHdl)) {
  332. LOG_MSG_ERROR("CreateBypassRoutingTable Failed\n");
  333. bRetVal = false;
  334. goto bail;
  335. }
  336. LOG_MSG_INFO("CreateBypassRoutingTable completed successfully");
  337. sRoutingTable.ip = m_eIP;
  338. strlcpy(sRoutingTable.name, bypass0, sizeof(sRoutingTable.name));
  339. if (!m_Routing.GetRoutingTable(&sRoutingTable)) {
  340. LOG_MSG_ERROR(
  341. "m_routing.GetRoutingTable(&sRoutingTable=0x%p) Failed.", &sRoutingTable);
  342. bRetVal = false;
  343. goto bail;
  344. }
  345. // Creating Filtering Rules
  346. cFilterTable.Init(m_eIP,IPA_CLIENT_TEST_PROD,false,1);
  347. LOG_MSG_INFO("Creation of filtering table completed successfully");
  348. // Configuring Filtering Rule No.1
  349. cFilterTable.GeneratePresetRule(0,sFilterRuleEntry);
  350. sFilterRuleEntry.at_rear = true;
  351. sFilterRuleEntry.flt_rule_hdl = -1; // return Value
  352. sFilterRuleEntry.status = -1; // return value
  353. sFilterRuleEntry.rule.action = IPA_PASS_TO_ROUTING;
  354. sFilterRuleEntry.rule.rt_tbl_hdl = nRTTableHdl; //put here the handle corresponding to Routing Rule 1
  355. if (
  356. ((uint8_t)-1 == cFilterTable.AddRuleToTable(sFilterRuleEntry)) ||
  357. !m_Filtering.AddFilteringRule(cFilterTable.GetFilteringTable())
  358. )
  359. {
  360. LOG_MSG_ERROR ("Adding Rule (0) to Filtering block Failed.");
  361. bRetVal = false;
  362. goto bail;
  363. } else
  364. {
  365. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n", cFilterTable.ReadRuleFromTable(0)->flt_rule_hdl,cFilterTable.ReadRuleFromTable(0)->status);
  366. }
  367. bail:
  368. Free(pHeaderDescriptor);
  369. LOG_MSG_STACK(
  370. "Leaving Function (Returning %s)", bRetVal?"True":"False");
  371. return bRetVal;
  372. } // AddRules()
  373. virtual bool ModifyPackets() {
  374. // This test doesn't modify the original IP Packet.
  375. return true;
  376. } // ModifyPacktes ()
  377. virtual bool TestLogic() {
  378. memset(m_aExpectedBuffer, 0, sizeof(m_aExpectedBuffer));
  379. m_aExpectedBufSize = 0;
  380. memcpy(m_aExpectedBuffer, m_aHeadertoAdd, m_nHeadertoAddSize);
  381. memcpy(m_aExpectedBuffer+m_nHeadertoAddSize,m_aBuffer,m_uBufferSize);
  382. m_aExpectedBufSize = m_nHeadertoAddSize + m_uBufferSize;
  383. if (!SendReceiveAndCompare(&m_producer, m_aBuffer, m_uBufferSize,
  384. &m_Consumer2, m_aExpectedBuffer, m_aExpectedBufSize)) {
  385. LOG_MSG_ERROR("SendReceiveAndCompare failed.");
  386. return false;
  387. }
  388. return true;
  389. }
  390. private:
  391. uint8_t m_aExpectedBuffer[BUFF_MAX_SIZE]; // Input file / IP packet
  392. size_t m_aExpectedBufSize;
  393. uint8_t m_aHeadertoAdd[MAX_HEADER_SIZE];
  394. size_t m_nHeadertoAddSize;
  395. };
  396. //---------------------------------------------------------------------------/
  397. // Test003: Test Three Different Header Insertions /
  398. //---------------------------------------------------------------------------/
  399. class IPAHeaderInsertionTest003: public IPAHeaderInsertionTestFixture {
  400. public:
  401. IPAHeaderInsertionTest003() :
  402. m_aExpectedBufSize(BUFF_MAX_SIZE),
  403. m_nHeadertoAddSize1(0),
  404. m_nHeadertoAddSize2(0),
  405. m_nHeadertoAddSize3(0)
  406. {
  407. m_name = "IPAHeaderInsertionTest003";
  408. m_description =
  409. "Header Insertion Test 003 - Test RmNet,IEEE802.3 and IEEE802.3 with const (1) addition to the length field\
  410. 1. Generate and commit two types of header Insertion RmNet and IEE802.3 \
  411. 2. Generate and commit three routing tables. \
  412. Each table contains a single \"bypass\" rule (all data goes to output pipe 0, 1 and 2 (accordingly)) \
  413. Routing table 1 is used to add RmNet Header \
  414. Routing table 2 is used to add IEEE802.3 Header (requires update of the Length field) \
  415. Routing table 3 is used to add IEEE802.3 Header with additional const (1) to the length field \
  416. 3. Generate and commit Three filtering rules (MASK = 0xFF..FF). \
  417. All DST_IP == 127.0.0.1 traffic goes to routing table 1 \
  418. All DST_IP == 192.169.1.1 traffic goes to routing table 2 \
  419. All DST_IP == 192.169.1.2 traffic goes to routing table 3";
  420. Register(*this);
  421. uint8_t aRMNetHeader[6] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
  422. uint8_t aIEEE802_3Header1[22] = { 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
  423. 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x00, 0x46, 0xAE, 0xAF, 0xB0,
  424. 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6 };
  425. uint8_t aIEEE802_3Header2[22] = { 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
  426. 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x00, 0x47, 0xAE, 0xAF, 0xB0,
  427. 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6 };
  428. m_nHeadertoAddSize1 = sizeof(aRMNetHeader);
  429. memcpy(m_aHeadertoAdd1, aRMNetHeader, m_nHeadertoAddSize1);
  430. m_nHeadertoAddSize2 = sizeof(aIEEE802_3Header1);
  431. memcpy(m_aHeadertoAdd2, aIEEE802_3Header1, m_nHeadertoAddSize2);
  432. m_nHeadertoAddSize3 = sizeof(aIEEE802_3Header2);
  433. memcpy(m_aHeadertoAdd3, aIEEE802_3Header2, m_nHeadertoAddSize3);
  434. }
  435. // Test Description:
  436. // 1. Generate and commit single bypass routing table.
  437. virtual bool AddRules() {
  438. m_eIP = IPA_IP_v4;
  439. const char aBypass1[20] = "Bypass1";
  440. const char aBypass2[20] = "Bypass2";
  441. const char aBypass3[20] = "Bypass3";
  442. uint32_t nTableHdl01, nTableHdl02, nTableHdl03;
  443. bool bRetVal = true;
  444. IPAFilteringTable cFilterTable0;
  445. struct ipa_flt_rule_add sFilterRuleEntry;
  446. struct ipa_ioc_get_hdr sGetHeader1,sGetHeader2;
  447. LOG_MSG_STACK("Entering Function");
  448. memset(&sFilterRuleEntry, 0, sizeof(sFilterRuleEntry));
  449. memset(&sGetHeader1, 0, sizeof(sGetHeader1));
  450. memset(&sGetHeader2, 0, sizeof(sGetHeader2));
  451. // Create Header:
  452. // Allocate Memory, populate it, and add in to the Header Insertion.
  453. struct ipa_ioc_add_hdr * pHeaderDescriptor = NULL;
  454. pHeaderDescriptor = (struct ipa_ioc_add_hdr *) calloc(1,
  455. sizeof(struct ipa_ioc_add_hdr)
  456. + 2 * sizeof(struct ipa_hdr_add));
  457. if (!pHeaderDescriptor) {
  458. LOG_MSG_ERROR("calloc failed to allocate pHeaderDescriptor");
  459. bRetVal = false;
  460. goto bail;
  461. }
  462. pHeaderDescriptor->commit = true;
  463. pHeaderDescriptor->num_hdrs = 2;
  464. // Adding Header No1.
  465. strlcpy(pHeaderDescriptor->hdr[0].name, "RMNet", sizeof(pHeaderDescriptor->hdr[0].name)); // Header's Name
  466. memcpy(pHeaderDescriptor->hdr[0].hdr, m_aHeadertoAdd1,
  467. m_nHeadertoAddSize1); //Header's Data
  468. pHeaderDescriptor->hdr[0].hdr_len = m_nHeadertoAddSize1;
  469. pHeaderDescriptor->hdr[0].hdr_hdl = -1; //Return Value
  470. pHeaderDescriptor->hdr[0].is_partial = false;
  471. pHeaderDescriptor->hdr[0].status = -1; // Return Parameter
  472. // Adding Header No2.
  473. strlcpy(pHeaderDescriptor->hdr[1].name, "IEEE_802_3", sizeof(pHeaderDescriptor->hdr[1].name)); // Header's Name
  474. memcpy(pHeaderDescriptor->hdr[1].hdr, m_aHeadertoAdd2,
  475. m_nHeadertoAddSize2); //Header's Data
  476. pHeaderDescriptor->hdr[1].hdr_len = m_nHeadertoAddSize2;
  477. pHeaderDescriptor->hdr[1].hdr_hdl = -1; //Return Value
  478. pHeaderDescriptor->hdr[1].is_partial = false;
  479. pHeaderDescriptor->hdr[1].status = -1; // Return Parameter
  480. strlcpy(sGetHeader1.name, pHeaderDescriptor->hdr[0].name, sizeof(sGetHeader1.name));
  481. strlcpy(sGetHeader2.name, pHeaderDescriptor->hdr[1].name, sizeof(sGetHeader2.name));
  482. if (!m_HeaderInsertion.AddHeader(pHeaderDescriptor))
  483. {
  484. LOG_MSG_ERROR("m_HeaderInsertion.AddHeader(pHeaderDescriptor) Failed.");
  485. bRetVal = false;
  486. goto bail;
  487. }
  488. if (!m_HeaderInsertion.GetHeaderHandle(&sGetHeader1))
  489. {
  490. LOG_MSG_ERROR(" Failed");
  491. bRetVal = false;
  492. goto bail;
  493. }
  494. LOG_MSG_DEBUG("Received Header1 Handle = 0x%x",sGetHeader1.hdl);
  495. if (!m_HeaderInsertion.GetHeaderHandle(&sGetHeader2))
  496. {
  497. LOG_MSG_ERROR(" Failed");
  498. bRetVal = false;
  499. goto bail;
  500. }
  501. LOG_MSG_DEBUG("Received Header2 Handle = 0x%x",sGetHeader2.hdl);
  502. if (!CreateBypassRoutingTable(&m_Routing, m_eIP, aBypass1, IPA_CLIENT_TEST2_CONS,
  503. sGetHeader1.hdl,&nTableHdl01)) {
  504. LOG_MSG_ERROR("CreateBypassRoutingTable Failed\n");
  505. bRetVal = false;
  506. goto bail;
  507. }
  508. if (!CreateBypassRoutingTable(&m_Routing, m_eIP, aBypass2, IPA_CLIENT_TEST3_CONS,
  509. sGetHeader2.hdl,&nTableHdl02)) {
  510. LOG_MSG_ERROR("CreateBypassRoutingTable Failed\n");
  511. bRetVal = false;
  512. goto bail;
  513. }
  514. if (!CreateBypassRoutingTable(&m_Routing, m_eIP, aBypass3, IPA_CLIENT_TEST4_CONS,
  515. sGetHeader2.hdl,&nTableHdl03)) {
  516. LOG_MSG_ERROR("CreateBypassRoutingTable Failed\n");
  517. bRetVal = false;
  518. goto bail;
  519. }
  520. LOG_MSG_INFO("Creation of three bypass routing tables completed successfully TblHdl1=0x%x, TblHdl2=0x%x, TblHdl3=0x%x",
  521. nTableHdl01,nTableHdl02,nTableHdl03);
  522. // Creating Filtering Rules
  523. cFilterTable0.Init(m_eIP,IPA_CLIENT_TEST_PROD,false,3);
  524. LOG_MSG_INFO("Creation of filtering table completed successfully");
  525. // Configuring Filtering Rule No.1
  526. cFilterTable0.GeneratePresetRule(1,sFilterRuleEntry);
  527. sFilterRuleEntry.at_rear = true;
  528. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  529. sFilterRuleEntry.status = -1; // return value
  530. sFilterRuleEntry.rule.action=IPA_PASS_TO_ROUTING;
  531. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl01; //put here the handle corresponding to Routing Rule 1
  532. sFilterRuleEntry.rule.attrib.attrib_mask = IPA_FLT_DST_ADDR; // Destination IP Based Filtering
  533. sFilterRuleEntry.rule.attrib.u.v4.dst_addr_mask = 0xFF0000FF; // Mask
  534. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0x7F000001; // Filter DST_IP == 127.0.0.1.
  535. if ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry))
  536. {
  537. LOG_MSG_ERROR ("Adding Rule (0) to Filtering table Failed.");
  538. bRetVal = false;
  539. goto bail;
  540. }
  541. // Configuring Filtering Rule No.2
  542. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  543. sFilterRuleEntry.status = -1; // return Value
  544. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl02; //put here the handle corresponding to Routing Rule 2
  545. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0xC0A80101; // Filter DST_IP == 192.168.1.1.
  546. if ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry))
  547. {
  548. LOG_MSG_ERROR ("Adding Rule(1) to Filtering table Failed.");
  549. bRetVal = false;
  550. goto bail;
  551. }
  552. // Configuring Filtering Rule No.3
  553. sFilterRuleEntry.flt_rule_hdl=-1; // return Value
  554. sFilterRuleEntry.status = -1; // return value
  555. sFilterRuleEntry.rule.rt_tbl_hdl=nTableHdl03; //put here the handle corresponding to Routing Rule 2
  556. sFilterRuleEntry.rule.attrib.u.v4.dst_addr = 0xC0A80102; // Filter DST_IP == 192.168.1.2.
  557. if ((uint8_t)-1 == cFilterTable0.AddRuleToTable(sFilterRuleEntry))
  558. {
  559. LOG_MSG_ERROR ("Adding Rule(2) to Filtering table Failed.");
  560. bRetVal = false;
  561. goto bail;
  562. }
  563. if (!m_Filtering.AddFilteringRule(cFilterTable0.GetFilteringTable())) {
  564. LOG_MSG_ERROR ("Failed to commit Filtering rules");
  565. bRetVal = false;
  566. goto bail;
  567. }
  568. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n", cFilterTable0.ReadRuleFromTable(0)->flt_rule_hdl,cFilterTable0.ReadRuleFromTable(0)->status);
  569. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n", cFilterTable0.ReadRuleFromTable(1)->flt_rule_hdl,cFilterTable0.ReadRuleFromTable(1)->status);
  570. LOG_MSG_DEBUG("flt rule hdl0=0x%x, status=0x%x\n", cFilterTable0.ReadRuleFromTable(2)->flt_rule_hdl,cFilterTable0.ReadRuleFromTable(2)->status);
  571. bail:
  572. Free(pHeaderDescriptor);
  573. LOG_MSG_STACK(
  574. "Leaving Function (Returning %s)", bRetVal?"True":"False");
  575. return bRetVal;
  576. } // AddRules()
  577. virtual bool ModifyPackets() {
  578. // This test doesn't modify the original IP Packet.
  579. return true;
  580. } // ModifyPacktes ()
  581. virtual bool TestLogic() {
  582. bool bRetVal = true;
  583. m_aExpectedBufSize = 0;
  584. uint32_t nIPv4DSTAddr;
  585. LOG_MSG_STACK("Entering Function");
  586. //Packet No. 1
  587. memset(m_aExpectedBuffer, 0, sizeof(m_aExpectedBuffer));
  588. nIPv4DSTAddr = ntohl(0x7F000001);
  589. memcpy (&m_aBuffer[IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,sizeof(nIPv4DSTAddr));
  590. memcpy(m_aExpectedBuffer, m_aHeadertoAdd1, m_nHeadertoAddSize1);
  591. memcpy(m_aExpectedBuffer+m_nHeadertoAddSize1,m_aBuffer,m_uBufferSize);
  592. m_aExpectedBufSize = m_nHeadertoAddSize1 + m_uBufferSize;
  593. if (!SendReceiveAndCompare(&m_producer, m_aBuffer, m_uBufferSize,
  594. &m_Consumer1, m_aExpectedBuffer, m_aExpectedBufSize))
  595. {
  596. LOG_MSG_ERROR("SendReceiveAndCompare failed.");
  597. bRetVal=false;
  598. }
  599. //Packet No. 2
  600. memset(m_aExpectedBuffer, 0, sizeof(m_aExpectedBuffer));
  601. nIPv4DSTAddr = ntohl(0xC0A80101);//192.168.1.1
  602. memcpy (&m_aBuffer[IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,sizeof(nIPv4DSTAddr));
  603. memcpy(m_aExpectedBuffer, m_aHeadertoAdd2, m_nHeadertoAddSize2);
  604. memcpy(m_aExpectedBuffer+m_nHeadertoAddSize2,m_aBuffer,m_uBufferSize);
  605. m_aExpectedBufSize = m_nHeadertoAddSize2 + m_uBufferSize;
  606. if (!SendReceiveAndCompare(&m_producer, m_aBuffer, m_uBufferSize,
  607. &m_Consumer2, m_aExpectedBuffer, m_aExpectedBufSize))
  608. {
  609. LOG_MSG_ERROR("SendReceiveAndCompare failed.");
  610. bRetVal=false;
  611. }
  612. //Packet No. 3
  613. nIPv4DSTAddr = ntohl(0xC0A80102);//192.168.1.2
  614. memcpy (&m_aBuffer[IPV4_DST_ADDR_OFFSET],&nIPv4DSTAddr,sizeof(nIPv4DSTAddr));
  615. memcpy(m_aExpectedBuffer, m_aHeadertoAdd3, m_nHeadertoAddSize3);
  616. memcpy(m_aExpectedBuffer+m_nHeadertoAddSize3,m_aBuffer,m_uBufferSize);
  617. m_aExpectedBufSize = m_nHeadertoAddSize3 + m_uBufferSize;
  618. if (!SendReceiveAndCompare(&m_producer, m_aBuffer, m_uBufferSize,
  619. &m_Consumer3, m_aExpectedBuffer, m_aExpectedBufSize))
  620. {
  621. LOG_MSG_ERROR("SendReceiveAndCompare failed.");
  622. bRetVal=false;
  623. }
  624. LOG_MSG_STACK("Leaving Function (Returning %s)",bRetVal?"True":"False");
  625. return bRetVal;
  626. }
  627. private:
  628. uint8_t m_aExpectedBuffer[BUFF_MAX_SIZE]; // Input file / IP packet
  629. size_t m_aExpectedBufSize;
  630. uint8_t m_aHeadertoAdd1[MAX_HEADER_SIZE],m_aHeadertoAdd2[MAX_HEADER_SIZE],m_aHeadertoAdd3[MAX_HEADER_SIZE];
  631. size_t m_nHeadertoAddSize1,m_nHeadertoAddSize2,m_nHeadertoAddSize3;
  632. };
  633. class IPAHeaderInsertionTest004: public IPAHeaderInsertionTestFixture {
  634. public:
  635. IPAHeaderInsertionTest004() {
  636. m_name = "IPAHeaderInsertionTest004";
  637. m_description =
  638. "Header Insertion Test 004 - Test header insertion with bad len values.";
  639. Register(*this);
  640. uint8_t aRMNetHeader[6] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
  641. m_nHeadertoAddSize = sizeof(aRMNetHeader);
  642. memcpy(m_aHeadertoAdd, aRMNetHeader, m_nHeadertoAddSize);
  643. }
  644. virtual bool AddRules() {
  645. // Not adding any rules here.
  646. return true;
  647. } // AddRules()
  648. virtual bool ModifyPackets() {
  649. // This test doesn't modify the original IP Packet.
  650. return true;
  651. } // ModifyPacktes ()
  652. bool AddSingleHeaderAndCheck(uint8_t len) {
  653. m_eIP = IPA_IP_v4;
  654. bool bRetVal = true;
  655. struct ipa_ioc_get_hdr sRetHeader;
  656. memset(&sRetHeader, 0, sizeof(sRetHeader));
  657. strlcpy(sRetHeader.name, "Generic", sizeof(sRetHeader.name));
  658. LOG_MSG_STACK("Entering Function");
  659. // Create Header:
  660. // Allocate Memory, populate it, and add in to the Header Insertion.
  661. struct ipa_ioc_add_hdr * pHeaderDescriptor = NULL;
  662. pHeaderDescriptor = (struct ipa_ioc_add_hdr *) calloc(1,
  663. sizeof(struct ipa_ioc_add_hdr)
  664. + 1 * sizeof(struct ipa_hdr_add));
  665. if (!pHeaderDescriptor) {
  666. LOG_MSG_ERROR("calloc failed to allocate pHeaderDescriptor");
  667. bRetVal = false;
  668. goto bail;
  669. }
  670. pHeaderDescriptor->commit = true;
  671. pHeaderDescriptor->num_hdrs = 1;
  672. strlcpy(pHeaderDescriptor->hdr[0].name, sRetHeader.name, sizeof(pHeaderDescriptor->hdr[0].name));
  673. memcpy(pHeaderDescriptor->hdr[0].hdr, m_aHeadertoAdd,
  674. m_nHeadertoAddSize); //Header's Data
  675. pHeaderDescriptor->hdr[0].hdr_len = len;
  676. pHeaderDescriptor->hdr[0].hdr_hdl = -1; //Return Value
  677. pHeaderDescriptor->hdr[0].is_partial = false;
  678. pHeaderDescriptor->hdr[0].status = -1; // Return Parameter
  679. strlcpy(sRetHeader.name, pHeaderDescriptor->hdr[0].name, sizeof(sRetHeader.name));
  680. if (!m_HeaderInsertion.AddHeader(pHeaderDescriptor))
  681. {
  682. LOG_MSG_ERROR("m_HeaderInsertion.AddHeader(pHeaderDescriptor) Failed.");
  683. bRetVal = false;
  684. goto bail;
  685. }
  686. if (!m_HeaderInsertion.GetHeaderHandle(&sRetHeader))
  687. {
  688. LOG_MSG_ERROR(" Failed");
  689. bRetVal = false;
  690. goto bail;
  691. }
  692. bail:
  693. Free(pHeaderDescriptor);
  694. LOG_MSG_STACK(
  695. "Leaving Function (Returning %s)", bRetVal?"True":"False");
  696. return bRetVal;
  697. } // AddSingleHeaderAndCheck()
  698. virtual bool TestLogic() {
  699. // Try to add headers with invalid values.
  700. // Valid values are between 1 to IPA_HDR_MAX_SIZE (64).
  701. // We expect the below functions to fail.
  702. if (AddSingleHeaderAndCheck(0)) {
  703. LOG_MSG_ERROR("This is unexpected, this can't succeed");
  704. return false;
  705. }
  706. if (AddSingleHeaderAndCheck(MAX_HEADER_SIZE + 1)) {
  707. LOG_MSG_ERROR("This is unexpected, this can't succeed");
  708. return false;
  709. }
  710. // Add one header which is OK
  711. if (!AddSingleHeaderAndCheck(m_nHeadertoAddSize)) {
  712. LOG_MSG_ERROR("This is unexpected, this can't succeed");
  713. return false;
  714. }
  715. return true;
  716. }
  717. private:
  718. uint8_t m_aHeadertoAdd[MAX_HEADER_SIZE];
  719. size_t m_nHeadertoAddSize;
  720. };
  721. class IPAHeaderInsertionTest005: public IPAHeaderInsertionTestFixture {
  722. public:
  723. IPAHeaderInsertionTest005() {
  724. m_name = "IPAHeaderInsertionTest005";
  725. m_description =
  726. "Header Insertion Test 005 - Test Multiple RMNet Header Insertion\
  727. - Stress test - Generate and commit multiple header Insertion";
  728. this->m_runInRegression = false;
  729. Register(*this);
  730. uint8_t aRMNetHeader[6] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
  731. m_nHeadertoAddSize = sizeof(aRMNetHeader);
  732. memcpy(m_aHeadertoAdd, aRMNetHeader, m_nHeadertoAddSize);
  733. }
  734. // Test Description:
  735. // 1. Generate and commit single bypass routing table.
  736. virtual bool AddRules() {
  737. m_eIP = IPA_IP_v4;
  738. bool bRetVal = true;
  739. struct ipa_ioc_get_hdr sRetHeader;
  740. char Name[] = "IEEE802_3\0";
  741. memset(&sRetHeader, 0, sizeof(sRetHeader));
  742. strlcpy (sRetHeader.name, Name, sizeof(sRetHeader.name));
  743. LOG_MSG_STACK("Entering Function");
  744. // Create Header:
  745. // Allocate Memory, populate it, and add in to the Header Insertion.
  746. struct ipa_ioc_add_hdr * pHeaderDescriptor = NULL;
  747. pHeaderDescriptor = (struct ipa_ioc_add_hdr *) calloc(1,
  748. sizeof(struct ipa_ioc_add_hdr)
  749. + 1 * sizeof(struct ipa_hdr_add));
  750. if (!pHeaderDescriptor) {
  751. LOG_MSG_ERROR("calloc failed to allocate pHeaderDescriptor");
  752. bRetVal = false;
  753. goto bail;
  754. }
  755. pHeaderDescriptor->commit = true;
  756. pHeaderDescriptor->num_hdrs = 1;
  757. strlcpy(pHeaderDescriptor->hdr[0].name, sRetHeader.name, sizeof(pHeaderDescriptor->hdr[0].name));
  758. memcpy(pHeaderDescriptor->hdr[0].hdr, m_aHeadertoAdd,
  759. m_nHeadertoAddSize); //Header's Data
  760. pHeaderDescriptor->hdr[0].hdr_len = m_nHeadertoAddSize;
  761. pHeaderDescriptor->hdr[0].hdr_hdl = -1; //Return Value
  762. pHeaderDescriptor->hdr[0].is_partial = false;
  763. pHeaderDescriptor->hdr[0].status = -1; // Return Parameter
  764. strlcpy(sRetHeader.name, pHeaderDescriptor->hdr[0].name, sizeof(sRetHeader.name));
  765. // stress test to check if the target crashes, failure is expected before reaching 500
  766. for (int i = 0; i < 500; i++) {
  767. LOG_MSG_DEBUG("IPAHeaderInsertionTest005::AddRules iter=%d\n",i);
  768. if (!m_HeaderInsertion.AddHeader(pHeaderDescriptor))
  769. {
  770. LOG_MSG_ERROR("m_HeaderInsertion.AddHeader(pHeaderDescriptor) Failed on %d iteration.\n",i);
  771. goto bail;
  772. }
  773. }
  774. bail:
  775. Free(pHeaderDescriptor);
  776. LOG_MSG_STACK(
  777. "Leaving Function (Returning %s)", bRetVal?"True":"False");
  778. return bRetVal;
  779. } // AddRules()
  780. virtual bool ModifyPackets() {
  781. // This test doesn't modify the original IP Packet.
  782. return true;
  783. } // ModifyPacktes ()
  784. virtual bool TestLogic() {
  785. return true;
  786. }
  787. private:
  788. uint8_t m_aHeadertoAdd[MAX_HEADER_SIZE];
  789. size_t m_nHeadertoAddSize;
  790. };
  791. static IPAHeaderInsertionTest001 ipaHeaderInsertionTest001;
  792. static IPAHeaderInsertionTest002 ipaHeaderInsertionTest002;
  793. static IPAHeaderInsertionTest003 ipaHeaderInsertionTest003;
  794. static IPAHeaderInsertionTest004 ipaHeaderInsertionTest004;
  795. static IPAHeaderInsertionTest005 ipaHeaderInsertionTest005;