rename struct packet_layer to struct raw_layer

This commit is contained in:
luwenpeng
2024-06-14 10:48:11 +08:00
parent 020c8303c6
commit 1f78881cbb
20 changed files with 251 additions and 251 deletions

View File

@@ -48,7 +48,7 @@ enum layer_proto
LAYER_PROTO_GTPV1_U = 62,
};
struct packet_layer
struct raw_layer
{
enum layer_proto type;
const char *hdr_ptr; // header pointer
@@ -81,8 +81,8 @@ enum packet_direction packet_get_direction(const struct packet *pkt);
uint64_t packet_get_session_id(const struct packet *pkt);
void packet_prepend_sid_list(struct packet *pkt, const struct sid_list *list);
int8_t packet_get_layer_count(const struct packet *pkt);
const struct packet_layer *packet_get_layer(const struct packet *pkt, int8_t idx);
int packet_get_layer_count(const struct packet *pkt);
const struct raw_layer *packet_get_raw_layer(const struct packet *pkt, int idx);
const char *packet_get_data(const struct packet *pkt);
uint16_t packet_get_len(const struct packet *pkt);
@@ -107,11 +107,11 @@ static inline int packet_get_addr(const struct packet *pkt, struct address *src_
{
const struct ip *ip4_hdr = NULL;
const struct ip6_hdr *ip6_hdr = NULL;
const struct packet_layer *layer = NULL;
int8_t num = packet_get_layer_count(pkt);
for (int8_t i = num - 1; i >= 0; i--)
const struct raw_layer *layer = NULL;
int num = packet_get_layer_count(pkt);
for (int i = num - 1; i >= 0; i--)
{
layer = packet_get_layer(pkt, i);
layer = packet_get_raw_layer(pkt, i);
if (layer->type == LAYER_PROTO_IPV4)
{
ip4_hdr = (const struct ip *)layer->hdr_ptr;
@@ -151,11 +151,11 @@ static inline int packet_get_port(const struct packet *pkt, uint16_t *src_port,
{
const struct tcphdr *tcp_hdr = NULL;
const struct udphdr *udp_hdr = NULL;
const struct packet_layer *layer = NULL;
int8_t num = packet_get_layer_count(pkt);
for (int8_t i = num - 1; i >= 0; i--)
const struct raw_layer *layer = NULL;
int num = packet_get_layer_count(pkt);
for (int i = num - 1; i >= 0; i--)
{
layer = packet_get_layer(pkt, i);
layer = packet_get_raw_layer(pkt, i);
if (layer->type == LAYER_PROTO_TCP)
{
tcp_hdr = (const struct tcphdr *)layer->hdr_ptr;