rename session_direction to flow_direction

This commit is contained in:
luwenpeng
2024-05-09 14:57:12 +08:00
parent 37d12ebcfc
commit cc380d9271
21 changed files with 610 additions and 556 deletions

View File

@@ -19,7 +19,7 @@ enum packet_origin packet_get_origin(const struct packet *pkt)
return pkt->origin;
}
int8_t packet_get_layers(const struct packet *pkt)
int8_t packet_get_layers_number(const struct packet *pkt)
{
return pkt->layers_used;
}
@@ -61,14 +61,14 @@ uint16_t packet_get_payload_len(const struct packet *pkt)
return pkt->layers[pkt->layers_used - 1].pld_len;
}
int packet_need_drop(const struct packet *pkt)
void packet_set_action(struct packet *pkt, enum packet_action action)
{
return pkt->need_drop;
pkt->action = action;
}
void packet_set_drop(struct packet *pkt)
enum packet_action packet_get_action(const struct packet *pkt)
{
pkt->need_drop = 1;
return pkt->action;
}
void packet_set_origin_ctx(struct packet *pkt, void *ctx)
@@ -174,8 +174,7 @@ int packet_is_ctrl(const struct packet *pkt)
}
}
// 1: E2I, 0: I2E
void packet_set_direction(struct packet *pkt, int dir)
void packet_set_direction(struct packet *pkt, enum packet_direction dir)
{
if (packet_get_origin(pkt) == PACKET_ORIGIN_MARSIO)
{
@@ -192,15 +191,14 @@ void packet_set_direction(struct packet *pkt, int dir)
}
}
// 1: E2I, 0: I2E
int packet_get_direction(const struct packet *pkt)
enum packet_direction packet_get_direction(const struct packet *pkt)
{
int direction = 0;
enum packet_direction dir = PACKET_DIRECTION_INCOMING;
if (packet_get_origin(pkt) == PACKET_ORIGIN_MARSIO)
{
marsio_buff_t *mbuff = (marsio_buff_t *)packet_get_origin_ctx(pkt);
assert(mbuff != NULL);
if (marsio_buff_get_metadata(mbuff, MR_BUFF_DIR, &direction, sizeof(direction)) <= 0)
if (marsio_buff_get_metadata(mbuff, MR_BUFF_DIR, &dir, sizeof(dir)) <= 0)
{
PACKET_LOG_ERROR("failed to get direction");
}
@@ -210,7 +208,7 @@ int packet_get_direction(const struct packet *pkt)
PACKET_LOG_ERROR("packet origin is not marsio, failed to get direction");
}
return direction;
return dir;
}
void packet_set_session_id(struct packet *pkt, uint64_t sess_id)