update session finite state machine & add tcp init -> opening test case

This commit is contained in:
luwenpeng
2024-01-23 14:30:46 +08:00
parent 4fbafab4e3
commit 1f668b1a01
16 changed files with 2049 additions and 1021 deletions

View File

@@ -124,6 +124,11 @@ static inline const uint8_t *ipv4_hdr_get_opt_ptr(const struct ip *hdr)
return (const uint8_t *)hdr + sizeof(struct ip);
}
static inline void ipv4_hdr_set_ipid(struct ip *hdr, uint16_t ipid)
{
hdr->ip_id = htons(ipid);
}
#ifdef __cpluscplus
}
#endif

View File

@@ -16,6 +16,7 @@ extern "C"
struct metadata
{
char data[64];
// TODO
};
@@ -120,6 +121,7 @@ static inline struct packet *packet_dup(const struct packet *pkt)
pkt_dup->layers[i].pld_ptr = pkt_dup->data_ptr + pkt->layers[i].hdr_offset + pkt->layers[i].hdr_len;
}
}
packet_set0_metadata(pkt_dup, metadata_dup(packet_get0_metadata(pkt)));
return pkt_dup;
}
@@ -128,6 +130,9 @@ static inline void packet_free(struct packet *pkt)
{
if (pkt)
{
metadata_free((struct metadata *)packet_get0_metadata(pkt));
packet_set0_metadata(pkt, NULL);
if (pkt->data_ptr)
{
free((char *)pkt->data_ptr);