53 if (
len <
sizeof(NshHdr)) {
57 if (!PacketIncreaseCheckLayers(
p)) {
62 const NshHdr *hdr = (
const NshHdr *)pkt;
99 uint32_t
spi = ((
spi_si & 0xFFFFFF00) >> 8);
100 uint8_t si = (uint8_t)(
spi_si & 0xFF);
130 static uint8_t valid_nsh_packet[] = { 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x02, 0x02, 0x45, 0x10,
131 0x00, 0x3c, 0x78, 0x8f, 0x40, 0x00, 0x3f, 0x06, 0x79, 0x05, 0x0b, 0x06, 0x06, 0x06, 0x33, 0x06,
132 0x06, 0x06, 0xbd, 0x2e, 0x00, 0x16, 0xc9, 0xee, 0x07, 0x62, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02,
133 0x16, 0xd0, 0x2f, 0x36, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4, 0x04, 0x02, 0x08, 0x0a, 0xa9, 0x5f,
134 0x7f, 0xed, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x07 };
136 static int DecodeNSHTestHeaderTooSmall(
void)
155 static int DecodeNSHTestUnsupportedVersion(
void)
167 valid_nsh_packet[0] = 0xFF;
169 valid_nsh_packet[0] = 0x00;
176 static int DecodeNSHTestPacketTooSmall(
void)
195 static int DecodeNSHTestReservedType(
void)
207 valid_nsh_packet[2] = 0x00;
209 valid_nsh_packet[2] = 0x02;
216 static int DecodeNSHTestInvalidType(
void)
228 valid_nsh_packet[2] = 0x01;
230 valid_nsh_packet[2] = 0x02;
236 static int DecodeNSHTestUnsupportedType(
void)
248 valid_nsh_packet[2] = 0x03;
250 valid_nsh_packet[2] = 0x02;
257 static int DecodeNSHTestUnknownPayload(
void)
269 valid_nsh_packet[3] = 0x99;
271 valid_nsh_packet[3] = 0x01;
283 UtRegisterTest(
"DecodeNSHTestHeaderTooSmall", DecodeNSHTestHeaderTooSmall);
284 UtRegisterTest(
"DecodeNSHTestUnsupportedVersion", DecodeNSHTestUnsupportedVersion);
285 UtRegisterTest(
"DecodeNSHTestPacketTooSmall", DecodeNSHTestPacketTooSmall);
286 UtRegisterTest(
"DecodeNSHTestReservedType", DecodeNSHTestReservedType);
287 UtRegisterTest(
"DecodeNSHTestInvalidType", DecodeNSHTestInvalidType);
288 UtRegisterTest(
"DecodeNSHTestUnsupportedType", DecodeNSHTestUnsupportedType);
289 UtRegisterTest(
"DecodeNSHTestUnknownPayload", DecodeNSHTestUnknownPayload);