58 lines
1.9 KiB
C
58 lines
1.9 KiB
C
|
|
#ifndef _PACKET_UTILS_H
|
||
|
|
#define _PACKET_UTILS_H
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C"
|
||
|
|
{
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
#include "packet_priv.h"
|
||
|
|
|
||
|
|
/******************************************************************************
|
||
|
|
* metadata utils
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
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);
|
||
|
|
|
||
|
|
void packet_set_sids(struct packet *pkt, const struct sids *sids);
|
||
|
|
const struct sids *packet_get_sids(const struct packet *pkt);
|
||
|
|
void packet_prepend_sids(struct packet *pkt, const struct sids *sids);
|
||
|
|
|
||
|
|
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_id(struct packet *pkt, uint64_t id);
|
||
|
|
uint64_t packet_get_domain_id(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);
|
||
|
|
enum packet_direction packet_get_direction(const struct packet *pkt);
|
||
|
|
|
||
|
|
void packet_set_action(struct packet *pkt, enum packet_action action);
|
||
|
|
enum packet_action packet_get_action(const struct packet *pkt);
|
||
|
|
|
||
|
|
void packet_set_origin_ctx(struct packet *pkt, void *ctx);
|
||
|
|
const void *packet_get_origin_ctx(const struct packet *pkt);
|
||
|
|
|
||
|
|
/******************************************************************************
|
||
|
|
* other uitls
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
int packet_is_fragment(const struct packet *pkt);
|
||
|
|
struct packet *packet_new(uint16_t pkt_len);
|
||
|
|
struct packet *packet_dup(const struct packet *pkt);
|
||
|
|
void packet_free(struct packet *pkt);
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif
|