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

@@ -78,7 +78,30 @@ const struct packet_layer *packet_get_outermost_layer(const struct packet *pkt,
* Utils
******************************************************************************/
int8_t packet_get_layers(const struct packet *pkt);
#define MAX_SID_NUM 8
struct sid_list
{
uint16_t sid[MAX_SID_NUM];
int used;
};
enum packet_direction
{
PACKET_DIRECTION_OUTGOING = 0, // Internal -> External: 0
PACKET_DIRECTION_INCOMING = 1, // External -> Internal: 1
};
enum packet_action
{
PACKET_ACTION_FORWARD = 0,
PACKET_ACTION_DROP = 1,
};
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_layers_number(const struct packet *pkt);
const struct packet_layer *packet_get_layer(const struct packet *pkt, int8_t idx);
const char *packet_get_data(const struct packet *pkt);
@@ -87,27 +110,8 @@ uint16_t packet_get_len(const struct packet *pkt);
const char *packet_get_payload(const struct packet *pkt);
uint16_t packet_get_payload_len(const struct packet *pkt);
int packet_need_drop(const struct packet *pkt);
void packet_set_drop(struct packet *pkt);
int packet_is_ctrl(const struct packet *pkt);
void packet_set_direction(struct packet *pkt, int dir);
int packet_get_direction(const struct packet *pkt); // 1: E2I, 0: I2E
void packet_set_session_id(struct packet *pkt, uint64_t sess_id);
uint64_t packet_get_session_id(const struct packet *pkt);
#define MAX_SID_NUM 8
struct sid_list
{
uint16_t sid[MAX_SID_NUM];
int used;
};
void packet_set_sid_list(struct packet *pkt, const struct sid_list *list);
void packet_get_sid_list(const struct packet *pkt, struct sid_list *list);
void packet_prepend_sid_list(struct packet *pkt, const struct sid_list *list);
void packet_append_sid_list(struct packet *pkt, const struct sid_list *list);
void packet_set_action(struct packet *pkt, enum packet_action action);
enum packet_action packet_get_action(const struct packet *pkt);
/*
******************************************************************************
@@ -138,7 +142,7 @@ void packet_append_sid_list(struct packet *pkt, const struct sid_list *list);
******************************************************************************
*
* // inorder
* int8_t layers = packet_get_layers(pkt);
* int8_t layers = packet_get_layers_number(pkt);
* for (int8_t i = 0; i < layers; i++)
* {
* const struct packet_layer *layer = packet_get_layer(pkt, i);