Add test case for tunnel

This commit is contained in:
luwenpeng
2024-06-19 14:43:32 +08:00
parent 327d6e7b14
commit c3fd452793
17 changed files with 933 additions and 138 deletions

View File

@@ -91,7 +91,7 @@ unsigned char v2_over_udp_ctrl_msg[] = {
0x00, 0x08, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x80, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x01, 0x80, 0x08, 0x00, 0x00, 0x00, 0x0a, 0x00,
0x08};
TEST(L2TP_V2_OVER_UDP_UTILS, CRTL_MSG)
TEST(L2TPV2_OVER_UDP_UTILS, CRTL_MSG)
{
const struct l2tp_hdr *hdr = (struct l2tp_hdr *)v2_over_udp_ctrl_msg;
@@ -117,7 +117,7 @@ TEST(L2TP_V2_OVER_UDP_UTILS, CRTL_MSG)
unsigned char v2_over_udp_data_msg[] = {
0x40, 0x02, 0x00, 0x4e, 0x71, 0x46, 0x00, 0x02};
TEST(L2TP_V2_OVER_UDP_UTILS, DATA_MSG)
TEST(L2TPV2_OVER_UDP_UTILS, DATA_MSG)
{
const struct l2tp_hdr *hdr = (struct l2tp_hdr *)v2_over_udp_data_msg;
@@ -132,7 +132,7 @@ TEST(L2TP_V2_OVER_UDP_UTILS, DATA_MSG)
unsigned char v3_over_udp_ctrl_msg[] = {};
TEST(L2TP_V3_OVER_UDP_UTILS, CRTL_MSG)
TEST(L2TPV3_OVER_UDP_UTILS, CRTL_MSG)
{
// TODO
}
@@ -153,7 +153,7 @@ TEST(L2TP_V3_OVER_UDP_UTILS, CRTL_MSG)
unsigned char v3_over_udp_data_msg[] = {
0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00};
TEST(L2TP_V3_OVER_UDP_UTILS, DATA_MSG)
TEST(L2TPV3_OVER_UDP_UTILS, DATA_MSG)
{
const struct l2tp_hdr *hdr = (struct l2tp_hdr *)v3_over_udp_data_msg;
@@ -168,7 +168,7 @@ TEST(L2TP_V3_OVER_UDP_UTILS, DATA_MSG)
unsigned char v3_over_ip_ctrl_msg[] = {};
TEST(L2TP_V3_OVER_IP_UTILS, CRTL_MSG)
TEST(L2TPV3_OVER_IP_UTILS, CRTL_MSG)
{
// TODO
}
@@ -183,7 +183,7 @@ TEST(L2TP_V3_OVER_IP_UTILS, CRTL_MSG)
unsigned char v3_over_ip_data_msg[] = {
0x00, 0x00, 0x96, 0x52, 0xca, 0x03, 0x10, 0x78};
TEST(L2TP_V3_OVER_IP_UTILS, DATA_MSG)
TEST(L2TPV3_OVER_IP_UTILS, DATA_MSG)
{
EXPECT_TRUE(ntohl(*((uint32_t *)v3_over_ip_data_msg)) != 0); // data message
EXPECT_TRUE(calc_ip_l2tpv3_hdr_len((const char *)v3_over_ip_data_msg, sizeof(v3_over_ip_data_msg)) == 8);