Add packet utils to packet.h
This commit is contained in:
@@ -72,9 +72,36 @@ int packet_get_outermost_tuple6(const struct packet *pkt, struct tuple6 *tuple);
|
||||
const struct packet_layer *packet_get_innermost_layer(const struct packet *pkt, enum layer_type type);
|
||||
const struct packet_layer *packet_get_outermost_layer(const struct packet *pkt, enum layer_type type);
|
||||
|
||||
/******************************************************************************
|
||||
* Utils
|
||||
******************************************************************************/
|
||||
|
||||
int8_t packet_get_layers(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);
|
||||
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);
|
||||
|
||||
void packet_set_ctrl(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);
|
||||
|
||||
void packet_set_sid_list(struct packet *pkt, uint16_t *sid, int num);
|
||||
int packet_get_sid_list(const struct packet *pkt, uint16_t *sid, int num); // return number of sid
|
||||
void packet_prepend_sid_list(struct packet *pkt, uint16_t *sid, int num);
|
||||
void packet_append_sid_list(struct packet *pkt, uint16_t *sid, int num);
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* Example: getting the innermost TCP layer
|
||||
|
||||
Reference in New Issue
Block a user