refactor: session module (split to define/utils/pool/table/timer/transition/manager)

This commit is contained in:
luwenpeng
2024-06-25 10:32:51 +08:00
parent 71422ebb36
commit 076b3c7b0b
55 changed files with 342 additions and 227 deletions

View File

@@ -23,7 +23,7 @@ struct metadata
struct sids sids;
uint64_t session_id;
uint64_t domain_id;
uint64_t domain;
uint16_t link_id;
int is_ctrl;

View File

@@ -66,14 +66,14 @@ uint64_t packet_get_session_id(const struct packet *pkt)
return pkt->meta.session_id;
}
void packet_set_domain_id(struct packet *pkt, uint64_t id)
void packet_set_domain(struct packet *pkt, uint64_t domain)
{
pkt->meta.domain_id = id;
pkt->meta.domain = domain;
}
uint64_t packet_get_domain_id(const struct packet *pkt)
uint64_t packet_get_domain(const struct packet *pkt)
{
return pkt->meta.domain_id;
return pkt->meta.domain;
}
void packet_set_link_id(struct packet *pkt, uint16_t id)
@@ -326,7 +326,6 @@ int packet_get_innermost_tuple6(const struct packet *pkt, struct tuple6 *tuple)
const struct raw_layer *layer_l3 = NULL;
const struct raw_layer *layer_l4 = NULL;
const struct raw_layer *layer = NULL;
uint64_t domain = packet_get_domain_id(pkt);
for (int8_t i = pkt->layers_used - 1; i >= 0; i--)
{
@@ -375,7 +374,7 @@ int packet_get_innermost_tuple6(const struct packet *pkt, struct tuple6 *tuple)
if (layer_l3 && layer_l4 && layer_l4 - layer_l3 == 1)
{
tuple->domain = packet_get_domain_id(pkt);
tuple->domain = packet_get_domain(pkt);
return 0;
}
else
@@ -392,7 +391,6 @@ int packet_get_outermost_tuple6(const struct packet *pkt, struct tuple6 *tuple)
const struct raw_layer *layer_l3 = NULL;
const struct raw_layer *layer_l4 = NULL;
const struct raw_layer *layer = NULL;
uint64_t domain = packet_get_domain_id(pkt);
for (int8_t i = 0; i < pkt->layers_used; i++)
{
@@ -441,7 +439,7 @@ int packet_get_outermost_tuple6(const struct packet *pkt, struct tuple6 *tuple)
if (layer_l3 && layer_l4 && layer_l4 - layer_l3 == 1)
{
tuple->domain = packet_get_domain_id(pkt);
tuple->domain = packet_get_domain(pkt);
return 0;
}
else

View File

@@ -22,8 +22,8 @@ void packet_prepend_sids(struct packet *pkt, const struct sids *sids);
void packet_set_session_id(struct packet *pkt, uint64_t id);
uint64_t packet_get_session_id(const struct packet *pkt);
void packet_set_domain_id(struct packet *pkt, uint64_t id);
uint64_t packet_get_domain_id(const struct packet *pkt);
void packet_set_domain(struct packet *pkt, uint64_t domain);
uint64_t packet_get_domain(const struct packet *pkt);
void packet_set_link_id(struct packet *pkt, uint16_t id);
uint16_t packet_get_link_id(const struct packet *pkt);