2024-04-20 17:59:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
struct rawpacket
|
|
|
|
{
|
|
|
|
struct sockaddr_storage dst;
|
|
|
|
char ifout[IFNAMSIZ+1];
|
|
|
|
uint32_t fwmark;
|
2024-06-18 14:39:06 +00:00
|
|
|
size_t len, len_payload;
|
2024-04-20 17:59:45 +00:00
|
|
|
uint8_t *packet;
|
|
|
|
TAILQ_ENTRY(rawpacket) next;
|
|
|
|
};
|
|
|
|
TAILQ_HEAD(rawpacket_tailhead, rawpacket);
|
|
|
|
|
|
|
|
void rawpacket_queue_init(struct rawpacket_tailhead *q);
|
|
|
|
void rawpacket_queue_destroy(struct rawpacket_tailhead *q);
|
|
|
|
bool rawpacket_queue_empty(const struct rawpacket_tailhead *q);
|
|
|
|
unsigned int rawpacket_queue_count(const struct rawpacket_tailhead *q);
|
2024-06-18 14:39:06 +00:00
|
|
|
struct rawpacket *rawpacket_queue(struct rawpacket_tailhead *q,const struct sockaddr_storage* dst,uint32_t fwmark,const char *ifout,const void *data,size_t len,size_t len_payload);
|
2024-04-20 17:59:45 +00:00
|
|
|
struct rawpacket *rawpacket_dequeue(struct rawpacket_tailhead *q);
|
|
|
|
void rawpacket_free(struct rawpacket *rp);
|