Refactored packet API to support struct layer (using union to contain different types of encapsulation headers)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "packet_priv.h"
|
||||
#include "packet_utils.h"
|
||||
|
||||
/******************************************************************************
|
||||
* [Protocols in frame: eth:ethertype:ip:data]
|
||||
@@ -47,6 +48,7 @@ unsigned char data1[] = {
|
||||
TEST(PACKET_FRAG, IPV4_FRAGMENT)
|
||||
{
|
||||
struct packet handler;
|
||||
memset(&handler, 0, sizeof(handler));
|
||||
packet_parse(&handler, (const char *)data1, sizeof(data1));
|
||||
EXPECT_TRUE(packet_is_fragment(&handler) == true);
|
||||
|
||||
@@ -155,6 +157,7 @@ unsigned char data2[] = {
|
||||
TEST(PACKET_FRAG, IPV6_FRAGMENT)
|
||||
{
|
||||
struct packet handler;
|
||||
memset(&handler, 0, sizeof(handler));
|
||||
packet_parse(&handler, (const char *)data2, sizeof(data2));
|
||||
EXPECT_TRUE(packet_is_fragment(&handler) == true);
|
||||
|
||||
@@ -231,6 +234,7 @@ unsigned char data3[] = {
|
||||
TEST(PACKET_FRAG, IPV4_IPV6_NOT_FRAGMENT)
|
||||
{
|
||||
struct packet handler;
|
||||
memset(&handler, 0, sizeof(handler));
|
||||
packet_parse(&handler, (const char *)data3, sizeof(data3));
|
||||
EXPECT_TRUE(packet_is_fragment(&handler) == false);
|
||||
|
||||
@@ -293,6 +297,7 @@ unsigned char data4[] = {
|
||||
TEST(PACKET_FRAG, IPV6_IPV6_NOT_FRAGMENT)
|
||||
{
|
||||
struct packet handler;
|
||||
memset(&handler, 0, sizeof(handler));
|
||||
packet_parse(&handler, (const char *)data4, sizeof(data4));
|
||||
EXPECT_TRUE(packet_is_fragment(&handler) == false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user