48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
#ifndef _PACKET_H
|
|
#define _PACKET_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
|
|
#define MAX_SIDS 8
|
|
struct sids
|
|
{
|
|
uint16_t sid[MAX_SIDS];
|
|
int used;
|
|
};
|
|
void packet_prepend_sids(struct packet *pkt, const struct sids *sids);
|
|
|
|
enum packet_direction
|
|
{
|
|
PACKET_DIRECTION_OUTGOING = 0, // Internal -> External: 0
|
|
PACKET_DIRECTION_INCOMING = 1, // External -> Internal: 1
|
|
};
|
|
enum packet_direction packet_get_direction(const struct packet *pkt);
|
|
|
|
enum packet_action
|
|
{
|
|
PACKET_ACTION_FORWARD = 0, // must be zero
|
|
PACKET_ACTION_DROP = 1,
|
|
PACKET_ACTION_DEFER = 2, // TODO
|
|
};
|
|
void packet_set_action(struct packet *pkt, enum packet_action action);
|
|
enum packet_action packet_get_action(const struct packet *pkt);
|
|
|
|
uint64_t packet_get_session_id(const struct packet *pkt);
|
|
|
|
const char *packet_get_raw_data(const struct packet *pkt);
|
|
uint16_t packet_get_raw_len(const struct packet *pkt);
|
|
|
|
const char *packet_get_payload(const struct packet *pkt);
|
|
uint16_t packet_get_payload_len(const struct packet *pkt);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|