rename struct layer_private to struct layer_internal
This commit is contained in:
@@ -164,7 +164,7 @@ void *packet_get_user_data(struct packet *pkt)
|
||||
int packet_get_innermost_tuple2(const struct packet *pkt, struct tuple2 *tuple)
|
||||
{
|
||||
memset(tuple, 0, sizeof(struct tuple2));
|
||||
const struct layer_private *layer = NULL;
|
||||
const struct layer_internal *layer = NULL;
|
||||
|
||||
for (int8_t i = pkt->layers_used - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -196,7 +196,7 @@ int packet_get_innermost_tuple2(const struct packet *pkt, struct tuple2 *tuple)
|
||||
int packet_get_outermost_tuple2(const struct packet *pkt, struct tuple2 *tuple)
|
||||
{
|
||||
memset(tuple, 0, sizeof(struct tuple2));
|
||||
const struct layer_private *layer = NULL;
|
||||
const struct layer_internal *layer = NULL;
|
||||
|
||||
for (int8_t i = 0; i < pkt->layers_used; i++)
|
||||
{
|
||||
@@ -228,9 +228,9 @@ int packet_get_outermost_tuple2(const struct packet *pkt, struct tuple2 *tuple)
|
||||
int packet_get_innermost_tuple4(const struct packet *pkt, struct tuple4 *tuple)
|
||||
{
|
||||
memset(tuple, 0, sizeof(struct tuple4));
|
||||
const struct layer_private *layer_l3 = NULL;
|
||||
const struct layer_private *layer_l4 = NULL;
|
||||
const struct layer_private *layer = NULL;
|
||||
const struct layer_internal *layer_l3 = NULL;
|
||||
const struct layer_internal *layer_l4 = NULL;
|
||||
const struct layer_internal *layer = NULL;
|
||||
|
||||
for (int8_t i = pkt->layers_used - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -290,9 +290,9 @@ int packet_get_innermost_tuple4(const struct packet *pkt, struct tuple4 *tuple)
|
||||
int packet_get_outermost_tuple4(const struct packet *pkt, struct tuple4 *tuple)
|
||||
{
|
||||
memset(tuple, 0, sizeof(struct tuple4));
|
||||
const struct layer_private *layer_l3 = NULL;
|
||||
const struct layer_private *layer_l4 = NULL;
|
||||
const struct layer_private *layer = NULL;
|
||||
const struct layer_internal *layer_l3 = NULL;
|
||||
const struct layer_internal *layer_l4 = NULL;
|
||||
const struct layer_internal *layer = NULL;
|
||||
|
||||
for (int8_t i = 0; i < pkt->layers_used; i++)
|
||||
{
|
||||
@@ -352,9 +352,9 @@ int packet_get_outermost_tuple4(const struct packet *pkt, struct tuple4 *tuple)
|
||||
int packet_get_innermost_tuple6(const struct packet *pkt, struct tuple6 *tuple)
|
||||
{
|
||||
memset(tuple, 0, sizeof(struct tuple6));
|
||||
const struct layer_private *layer_l3 = NULL;
|
||||
const struct layer_private *layer_l4 = NULL;
|
||||
const struct layer_private *layer = NULL;
|
||||
const struct layer_internal *layer_l3 = NULL;
|
||||
const struct layer_internal *layer_l4 = NULL;
|
||||
const struct layer_internal *layer = NULL;
|
||||
|
||||
for (int8_t i = pkt->layers_used - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -417,9 +417,9 @@ int packet_get_innermost_tuple6(const struct packet *pkt, struct tuple6 *tuple)
|
||||
int packet_get_outermost_tuple6(const struct packet *pkt, struct tuple6 *tuple)
|
||||
{
|
||||
memset(tuple, 0, sizeof(struct tuple6));
|
||||
const struct layer_private *layer_l3 = NULL;
|
||||
const struct layer_private *layer_l4 = NULL;
|
||||
const struct layer_private *layer = NULL;
|
||||
const struct layer_internal *layer_l3 = NULL;
|
||||
const struct layer_internal *layer_l4 = NULL;
|
||||
const struct layer_internal *layer = NULL;
|
||||
|
||||
for (int8_t i = 0; i < pkt->layers_used; i++)
|
||||
{
|
||||
@@ -488,7 +488,7 @@ int packet_get_layer_count(const struct packet *pkt)
|
||||
|
||||
const struct layer *packet_get_layer_by_idx(const struct packet *pkt, int idx)
|
||||
{
|
||||
const struct layer_private *layer = packet_get_layer(pkt, idx);
|
||||
const struct layer_internal *layer = packet_get_layer(pkt, idx);
|
||||
if (layer == NULL)
|
||||
{
|
||||
return NULL;
|
||||
@@ -499,7 +499,7 @@ const struct layer *packet_get_layer_by_idx(const struct packet *pkt, int idx)
|
||||
}
|
||||
}
|
||||
|
||||
const struct layer_private *packet_get_layer(const struct packet *pkt, int idx)
|
||||
const struct layer_internal *packet_get_layer(const struct packet *pkt, int idx)
|
||||
{
|
||||
if (idx < 0 || idx >= pkt->layers_used)
|
||||
{
|
||||
@@ -508,9 +508,9 @@ const struct layer_private *packet_get_layer(const struct packet *pkt, int idx)
|
||||
return &pkt->layers[idx];
|
||||
}
|
||||
|
||||
const struct layer_private *packet_get_innermost_layer(const struct packet *pkt, enum layer_proto proto)
|
||||
const struct layer_internal *packet_get_innermost_layer(const struct packet *pkt, enum layer_proto proto)
|
||||
{
|
||||
const struct layer_private *layer = NULL;
|
||||
const struct layer_internal *layer = NULL;
|
||||
|
||||
for (int8_t i = pkt->layers_used - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -524,9 +524,9 @@ const struct layer_private *packet_get_innermost_layer(const struct packet *pkt,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const struct layer_private *packet_get_outermost_layer(const struct packet *pkt, enum layer_proto proto)
|
||||
const struct layer_internal *packet_get_outermost_layer(const struct packet *pkt, enum layer_proto proto)
|
||||
{
|
||||
const struct layer_private *layer = NULL;
|
||||
const struct layer_internal *layer = NULL;
|
||||
|
||||
for (int8_t i = 0; i < pkt->layers_used; i++)
|
||||
{
|
||||
@@ -548,10 +548,10 @@ struct tunnel_detector
|
||||
{
|
||||
enum tunnel_type type;
|
||||
int contain_layers;
|
||||
int (*identify_func)(const struct layer_private *curr, const struct layer_private *next1, const struct layer_private *next2);
|
||||
int (*identify_func)(const struct layer_internal *curr, const struct layer_internal *next1, const struct layer_internal *next2);
|
||||
};
|
||||
|
||||
static int is_ipv4_tunnel(const struct layer_private *curr, const struct layer_private *next1, const struct layer_private *next2 __attribute__((unused)))
|
||||
static int is_ipv4_tunnel(const struct layer_internal *curr, const struct layer_internal *next1, const struct layer_internal *next2 __attribute__((unused)))
|
||||
{
|
||||
if (curr && curr->proto == LAYER_PROTO_IPV4 &&
|
||||
next1 && (next1->proto == LAYER_PROTO_IPV4 || next1->proto == LAYER_PROTO_IPV6))
|
||||
@@ -562,7 +562,7 @@ static int is_ipv4_tunnel(const struct layer_private *curr, const struct layer_p
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_ipv6_tunnel(const struct layer_private *curr, const struct layer_private *next1, const struct layer_private *next2 __attribute__((unused)))
|
||||
static int is_ipv6_tunnel(const struct layer_internal *curr, const struct layer_internal *next1, const struct layer_internal *next2 __attribute__((unused)))
|
||||
{
|
||||
if (curr && curr->proto == LAYER_PROTO_IPV6 &&
|
||||
next1 && (next1->proto == LAYER_PROTO_IPV4 || next1->proto == LAYER_PROTO_IPV6))
|
||||
@@ -573,7 +573,7 @@ static int is_ipv6_tunnel(const struct layer_private *curr, const struct layer_p
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_gre_tunnel(const struct layer_private *curr, const struct layer_private *next1, const struct layer_private *next2 __attribute__((unused)))
|
||||
static int is_gre_tunnel(const struct layer_internal *curr, const struct layer_internal *next1, const struct layer_internal *next2 __attribute__((unused)))
|
||||
{
|
||||
if (curr && (curr->proto == LAYER_PROTO_IPV4 || curr->proto == LAYER_PROTO_IPV6) &&
|
||||
next1 && next1->proto == LAYER_PROTO_GRE)
|
||||
@@ -584,7 +584,7 @@ static int is_gre_tunnel(const struct layer_private *curr, const struct layer_pr
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_gtp_tunnel(const struct layer_private *curr, const struct layer_private *next1, const struct layer_private *next2)
|
||||
static int is_gtp_tunnel(const struct layer_internal *curr, const struct layer_internal *next1, const struct layer_internal *next2)
|
||||
{
|
||||
if (curr && (curr->proto == LAYER_PROTO_IPV4 || curr->proto == LAYER_PROTO_IPV6) &&
|
||||
next1 && next1->proto == LAYER_PROTO_UDP &&
|
||||
@@ -596,7 +596,7 @@ static int is_gtp_tunnel(const struct layer_private *curr, const struct layer_pr
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_vxlan_tunnel(const struct layer_private *curr, const struct layer_private *next1, const struct layer_private *next2)
|
||||
static int is_vxlan_tunnel(const struct layer_internal *curr, const struct layer_internal *next1, const struct layer_internal *next2)
|
||||
{
|
||||
if (curr && (curr->proto == LAYER_PROTO_IPV4 || curr->proto == LAYER_PROTO_IPV6) &&
|
||||
next1 && next1->proto == LAYER_PROTO_UDP &&
|
||||
@@ -608,7 +608,7 @@ static int is_vxlan_tunnel(const struct layer_private *curr, const struct layer_
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_l2tp_tunnel(const struct layer_private *curr, const struct layer_private *next1, const struct layer_private *next2)
|
||||
static int is_l2tp_tunnel(const struct layer_internal *curr, const struct layer_internal *next1, const struct layer_internal *next2)
|
||||
{
|
||||
if (curr && (curr->proto == LAYER_PROTO_IPV4 || curr->proto == LAYER_PROTO_IPV6) &&
|
||||
next1 && next1->proto == LAYER_PROTO_UDP &&
|
||||
@@ -620,7 +620,7 @@ static int is_l2tp_tunnel(const struct layer_private *curr, const struct layer_p
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_teredo_tunnel(const struct layer_private *curr, const struct layer_private *next1, const struct layer_private *next2)
|
||||
static int is_teredo_tunnel(const struct layer_internal *curr, const struct layer_internal *next1, const struct layer_internal *next2)
|
||||
{
|
||||
if (curr && curr->proto == LAYER_PROTO_IPV4 &&
|
||||
next1 && next1->proto == LAYER_PROTO_UDP &&
|
||||
@@ -643,7 +643,7 @@ static struct tunnel_detector detectors[] = {
|
||||
};
|
||||
|
||||
// return index of detectors
|
||||
static int detect_tunnel(const struct layer_private *curr, const struct layer_private *next1, const struct layer_private *next2)
|
||||
static int detect_tunnel(const struct layer_internal *curr, const struct layer_internal *next1, const struct layer_internal *next2)
|
||||
{
|
||||
for (int i = 0; i < (int)(sizeof(detectors) / sizeof(detectors[0])); i++)
|
||||
{
|
||||
@@ -660,9 +660,9 @@ int packet_get_tunnel_count(const struct packet *pkt)
|
||||
{
|
||||
int count = 0;
|
||||
int used = packet_get_layer_count(pkt);
|
||||
const struct layer_private *curr = NULL;
|
||||
const struct layer_private *next1 = NULL;
|
||||
const struct layer_private *next2 = NULL;
|
||||
const struct layer_internal *curr = NULL;
|
||||
const struct layer_internal *next1 = NULL;
|
||||
const struct layer_internal *next2 = NULL;
|
||||
|
||||
for (int i = 0; i < used; i++)
|
||||
{
|
||||
@@ -685,9 +685,9 @@ int packet_get_tunnel_by_idx(const struct packet *pkt, int idx, struct tunnel *o
|
||||
int ret = -1;
|
||||
int count = 0;
|
||||
int used = packet_get_layer_count(pkt);
|
||||
const struct layer_private *curr = NULL;
|
||||
const struct layer_private *next1 = NULL;
|
||||
const struct layer_private *next2 = NULL;
|
||||
const struct layer_internal *curr = NULL;
|
||||
const struct layer_internal *next1 = NULL;
|
||||
const struct layer_internal *next2 = NULL;
|
||||
memset(out, 0, sizeof(struct tunnel));
|
||||
|
||||
for (int i = 0; i < used; i++)
|
||||
|
||||
Reference in New Issue
Block a user