refactor: rename struct raw_layer to struct layer_private
This commit is contained in:
@@ -142,14 +142,14 @@ static void calculate_length_and_checksum(const struct packet *origin_pkt, int l
|
||||
struct gtp2_hdr *gtp2 = NULL;
|
||||
struct gre0_hdr *gre0 = NULL;
|
||||
struct gre1_hdr *gre1 = NULL;
|
||||
struct raw_layer *curr_layer = NULL;
|
||||
struct raw_layer *last_layer = NULL;
|
||||
struct layer_private *curr_layer = NULL;
|
||||
struct layer_private *last_layer = NULL;
|
||||
struct fingerprint finger = {};
|
||||
calc_packet_fingerprint(&finger);
|
||||
for (int i = layer_count - 1; i >= 0; i--)
|
||||
{
|
||||
curr_layer = (struct raw_layer *)packet_get_raw_layer(origin_pkt, i);
|
||||
last_layer = (struct raw_layer *)packet_get_raw_layer(origin_pkt, i + 1);
|
||||
curr_layer = (struct layer_private *)packet_get_layer(origin_pkt, i);
|
||||
last_layer = (struct layer_private *)packet_get_layer(origin_pkt, i + 1);
|
||||
curr_hdr_ptr = new_pkt_data + curr_layer->hdr_offset;
|
||||
last_hdr_ptr = last_layer ? new_pkt_data + last_layer->hdr_offset : NULL;
|
||||
switch (curr_layer->proto)
|
||||
@@ -262,7 +262,7 @@ struct packet *packet_build_tcp(const struct packet *origin_pkt, uint32_t tcp_se
|
||||
|
||||
// check the innermost layer of the original packet
|
||||
int layer_count = packet_get_layer_count(origin_pkt);
|
||||
const struct raw_layer *tcp_layer = packet_get_raw_layer(origin_pkt, layer_count - 1);
|
||||
const struct layer_private *tcp_layer = packet_get_layer(origin_pkt, layer_count - 1);
|
||||
if (tcp_layer == NULL || tcp_layer->proto != LAYER_PROTO_TCP)
|
||||
{
|
||||
PACKET_CRAFT_LOG_ERROR("craft TCP packet failed, the innermost layer of the original packet is not TCP");
|
||||
@@ -313,7 +313,7 @@ struct packet *packet_build_udp(const struct packet *origin_pkt, const char *udp
|
||||
|
||||
// check the innermost layer of the original packet
|
||||
int layer_count = packet_get_layer_count(origin_pkt);
|
||||
const struct raw_layer *udp_layer = packet_get_raw_layer(origin_pkt, layer_count - 1);
|
||||
const struct layer_private *udp_layer = packet_get_layer(origin_pkt, layer_count - 1);
|
||||
if (udp_layer == NULL || udp_layer->proto != LAYER_PROTO_UDP)
|
||||
{
|
||||
PACKET_CRAFT_LOG_ERROR("craft UDP packet failed, the innermost layer of the original packet is not UDP");
|
||||
@@ -354,10 +354,10 @@ struct packet *packet_build_l3(const struct packet *origin_pkt, uint8_t ip_proto
|
||||
|
||||
int i = 0;
|
||||
int layers = packet_get_layer_count(origin_pkt);
|
||||
const struct raw_layer *l3_layer = NULL;
|
||||
const struct layer_private *l3_layer = NULL;
|
||||
for (i = layers - 1; i >= 0; i--)
|
||||
{
|
||||
l3_layer = packet_get_raw_layer(origin_pkt, i);
|
||||
l3_layer = packet_get_layer(origin_pkt, i);
|
||||
if (l3_layer->proto == LAYER_PROTO_IPV4 || l3_layer->proto == LAYER_PROTO_IPV6)
|
||||
{
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user