rename struct packet_layer to struct raw_layer
This commit is contained in:
@@ -233,10 +233,10 @@ static int build_tcp_packet(const struct packet *first, uint16_t ip_id, uint8_t
|
||||
struct udphdr *udphdr;
|
||||
struct ip *iphdr;
|
||||
struct ip6_hdr *ip6hdr;
|
||||
struct packet_layer *curr;
|
||||
struct packet_layer *last;
|
||||
struct raw_layer *curr;
|
||||
struct raw_layer *last;
|
||||
int len = packet_get_len(first);
|
||||
int8_t layers = packet_get_layer_count(first);
|
||||
int layers = packet_get_layer_count(first);
|
||||
|
||||
if ((tcp_pld == NULL && pld_len > 0) || (tcp_pld != NULL && pld_len <= 0))
|
||||
{
|
||||
@@ -249,9 +249,9 @@ static int build_tcp_packet(const struct packet *first, uint16_t ip_id, uint8_t
|
||||
}
|
||||
|
||||
memcpy(pkt_buff, packet_get_data(first), len);
|
||||
for (int8_t i = layers - 1; i >= 0; i--)
|
||||
for (int i = layers - 1; i >= 0; i--)
|
||||
{
|
||||
curr = (struct packet_layer *)packet_get_layer(first, i);
|
||||
curr = (struct raw_layer *)packet_get_raw_layer(first, i);
|
||||
switch (curr->type)
|
||||
{
|
||||
case LAYER_PROTO_TCP:
|
||||
@@ -273,7 +273,7 @@ static int build_tcp_packet(const struct packet *first, uint16_t ip_id, uint8_t
|
||||
break;
|
||||
case LAYER_PROTO_IPV4:
|
||||
iphdr = (struct ip *)(pkt_buff + curr->hdr_offset);
|
||||
last = (struct packet_layer *)packet_get_layer(first, i + 1);
|
||||
last = (struct raw_layer *)packet_get_raw_layer(first, i + 1);
|
||||
if (last->type == LAYER_PROTO_TCP)
|
||||
{
|
||||
tcphdr = (struct tcphdr *)(pkt_buff + last->hdr_offset);
|
||||
@@ -288,7 +288,7 @@ static int build_tcp_packet(const struct packet *first, uint16_t ip_id, uint8_t
|
||||
break;
|
||||
case LAYER_PROTO_IPV6:
|
||||
ip6hdr = (struct ip6_hdr *)(pkt_buff + curr->hdr_offset);
|
||||
last = (struct packet_layer *)packet_get_layer(first, i + 1);
|
||||
last = (struct raw_layer *)packet_get_raw_layer(first, i + 1);
|
||||
if (last->type == LAYER_PROTO_TCP)
|
||||
{
|
||||
tcphdr = (struct tcphdr *)(pkt_buff + last->hdr_offset);
|
||||
@@ -320,10 +320,10 @@ static int build_udp_packet(const struct packet *first, const char *udp_pld, int
|
||||
struct udphdr *udphdr;
|
||||
struct ip *iphdr;
|
||||
struct ip6_hdr *ip6hdr;
|
||||
struct packet_layer *curr;
|
||||
struct packet_layer *last;
|
||||
struct raw_layer *curr;
|
||||
struct raw_layer *last;
|
||||
int len = packet_get_len(first);
|
||||
int8_t layers = packet_get_layer_count(first);
|
||||
int layers = packet_get_layer_count(first);
|
||||
|
||||
if ((udp_pld == NULL && pld_len > 0) || (udp_pld != NULL && pld_len <= 0))
|
||||
{
|
||||
@@ -336,9 +336,9 @@ static int build_udp_packet(const struct packet *first, const char *udp_pld, int
|
||||
}
|
||||
|
||||
memcpy(pkt_buff, packet_get_data(first), len);
|
||||
for (int8_t i = layers - 1; i >= 0; i--)
|
||||
for (int i = layers - 1; i >= 0; i--)
|
||||
{
|
||||
curr = (struct packet_layer *)packet_get_layer(first, i);
|
||||
curr = (struct raw_layer *)packet_get_raw_layer(first, i);
|
||||
switch (curr->type)
|
||||
{
|
||||
case LAYER_PROTO_UDP:
|
||||
@@ -356,7 +356,7 @@ static int build_udp_packet(const struct packet *first, const char *udp_pld, int
|
||||
break;
|
||||
case LAYER_PROTO_IPV4:
|
||||
iphdr = (struct ip *)(pkt_buff + curr->hdr_offset);
|
||||
last = (struct packet_layer *)packet_get_layer(first, i + 1);
|
||||
last = (struct raw_layer *)packet_get_raw_layer(first, i + 1);
|
||||
if (last->type == LAYER_PROTO_UDP)
|
||||
{
|
||||
udphdr = (struct udphdr *)(pkt_buff + last->hdr_offset);
|
||||
@@ -366,7 +366,7 @@ static int build_udp_packet(const struct packet *first, const char *udp_pld, int
|
||||
break;
|
||||
case LAYER_PROTO_IPV6:
|
||||
ip6hdr = (struct ip6_hdr *)(pkt_buff + curr->hdr_offset);
|
||||
last = (struct packet_layer *)packet_get_layer(first, i + 1);
|
||||
last = (struct raw_layer *)packet_get_raw_layer(first, i + 1);
|
||||
if (last->type == LAYER_PROTO_UDP)
|
||||
{
|
||||
udphdr = (struct udphdr *)(pkt_buff + last->hdr_offset);
|
||||
|
||||
Reference in New Issue
Block a user