rename session_direction to flow_direction
This commit is contained in:
@@ -45,8 +45,8 @@ struct packet
|
||||
const char *data_ptr;
|
||||
uint16_t data_len;
|
||||
|
||||
int need_drop;
|
||||
void *origin_ctx; // mbuff or pcap pointer
|
||||
enum packet_action action;
|
||||
enum packet_origin origin;
|
||||
};
|
||||
|
||||
@@ -62,23 +62,6 @@ uint64_t packet_get_hash(const struct packet *pkt, enum ldbc_method method, int
|
||||
* Utils
|
||||
******************************************************************************/
|
||||
|
||||
void packet_set_origin(struct packet *pkt, enum packet_origin origin);
|
||||
enum packet_origin packet_get_origin(const struct packet *pkt);
|
||||
|
||||
void packet_set_origin_ctx(struct packet *pkt, void *ctx);
|
||||
void *packet_get_origin_ctx(const struct packet *pkt);
|
||||
|
||||
int packet_is_fragment(const struct packet *pkt);
|
||||
|
||||
void packet_set_ctrl(struct packet *pkt);
|
||||
|
||||
struct packet *packet_new(uint16_t pkt_len);
|
||||
void packet_free(struct packet *pkt);
|
||||
struct packet *packet_dup(const struct packet *pkt);
|
||||
|
||||
void packet_set_domain(struct packet *pkt, uint64_t domain);
|
||||
uint64_t packet_get_domain(const struct packet *pkt);
|
||||
|
||||
#define MAX_ROUTE_CTX 64
|
||||
struct route_ctx
|
||||
{
|
||||
@@ -88,6 +71,31 @@ struct route_ctx
|
||||
void packet_set_route_ctx(struct packet *pkt, const struct route_ctx *ctx);
|
||||
void packet_get_route_ctx(const struct packet *pkt, struct route_ctx *ctx);
|
||||
|
||||
void packet_set_origin(struct packet *pkt, enum packet_origin origin);
|
||||
enum packet_origin packet_get_origin(const struct packet *pkt);
|
||||
|
||||
void packet_set_origin_ctx(struct packet *pkt, void *ctx);
|
||||
void *packet_get_origin_ctx(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_ctrl(struct packet *pkt);
|
||||
int packet_is_ctrl(const struct packet *pkt);
|
||||
|
||||
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_append_sid_list(struct packet *pkt, const struct sid_list *list);
|
||||
|
||||
struct packet *packet_new(uint16_t pkt_len);
|
||||
void packet_free(struct packet *pkt);
|
||||
struct packet *packet_dup(const struct packet *pkt);
|
||||
|
||||
void packet_set_session_id(struct packet *pkt, uint64_t sess_id);
|
||||
void packet_set_direction(struct packet *pkt, enum packet_direction dir);
|
||||
|
||||
int packet_is_fragment(const struct packet *pkt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user