refactor: rename packet_utils.cpp to packet.cpp
This commit is contained in:
@@ -58,25 +58,65 @@ struct packet
|
||||
struct metadata meta;
|
||||
};
|
||||
|
||||
inline void packet_set_route_ctx(struct packet *pkt, const struct route_ctx *ctx)
|
||||
{
|
||||
pkt->meta.route_ctx = *ctx;
|
||||
}
|
||||
/******************************************************************************
|
||||
* metadata utils
|
||||
******************************************************************************/
|
||||
|
||||
inline const struct route_ctx *packet_get_route_ctx(const struct packet *pkt)
|
||||
{
|
||||
return &pkt->meta.route_ctx;
|
||||
}
|
||||
void packet_set_route_ctx(struct packet *pkt, const struct route_ctx *ctx);
|
||||
const struct route_ctx *packet_get_route_ctx(const struct packet *pkt);
|
||||
|
||||
inline void packet_set_origin_ctx(struct packet *pkt, void *ctx)
|
||||
{
|
||||
pkt->meta.origin_ctx = ctx;
|
||||
}
|
||||
void packet_set_origin_ctx(struct packet *pkt, void *ctx);
|
||||
const void *packet_get_origin_ctx(const struct packet *pkt);
|
||||
|
||||
inline const void *packet_get_origin_ctx(const struct packet *pkt)
|
||||
{
|
||||
return pkt->meta.origin_ctx;
|
||||
}
|
||||
void packet_set_sids(struct packet *pkt, const struct sids *sids);
|
||||
const struct sids *packet_get_sids(const struct packet *pkt);
|
||||
|
||||
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(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);
|
||||
|
||||
void packet_set_ctrl(struct packet *pkt, uint8_t ctrl);
|
||||
uint8_t packet_is_ctrl(const struct packet *pkt);
|
||||
|
||||
void packet_set_direction(struct packet *pkt, enum packet_direction dir);
|
||||
|
||||
void *packet_get_user_data(struct packet *pkt);
|
||||
void packet_set_user_data(struct packet *pkt, void *data);
|
||||
|
||||
/******************************************************************************
|
||||
* tuple uitls
|
||||
******************************************************************************/
|
||||
|
||||
// return 0: found
|
||||
// return -1: not found
|
||||
int packet_get_innermost_tuple2(const struct packet *pkt, struct tuple2 *tuple);
|
||||
int packet_get_outermost_tuple2(const struct packet *pkt, struct tuple2 *tuple);
|
||||
|
||||
// return 0: found
|
||||
// return -1: not found
|
||||
int packet_get_innermost_tuple4(const struct packet *pkt, struct tuple4 *tuple);
|
||||
int packet_get_outermost_tuple4(const struct packet *pkt, struct tuple4 *tuple);
|
||||
|
||||
// return 0: found
|
||||
// return -1: not found
|
||||
int packet_get_innermost_tuple6(const struct packet *pkt, struct tuple6 *tuple);
|
||||
int packet_get_outermost_tuple6(const struct packet *pkt, struct tuple6 *tuple);
|
||||
|
||||
/******************************************************************************
|
||||
* other uitls
|
||||
******************************************************************************/
|
||||
|
||||
struct packet *packet_new(uint16_t pkt_len);
|
||||
struct packet *packet_dup(const struct packet *pkt);
|
||||
void packet_free(struct packet *pkt);
|
||||
|
||||
int packet_is_fragment(const struct packet *pkt);
|
||||
void layer_convert(const struct raw_layer *in, struct layer *out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user