pqueue.h 783 B

123456789101112131415161718192021222324252627282930
  1. #ifndef PQUEUE_H
  2. #define PQUEUE_H
  3. #include <time.h>
  4. #include <sys/time.h>
  5. /* wait this many seconds for missing packets before forgetting about them */
  6. #define DEFAULT_PACKET_TIMEOUT 0.3
  7. extern int packet_timeout_usecs;
  8. /* assume packet is bad/spoofed if it's more than this many seqs ahead */
  9. #define MISSING_WINDOW 300
  10. /* Packet queue structure: linked list of packets received out-of-order */
  11. typedef struct pqueue {
  12. struct pqueue *next;
  13. struct pqueue *prev;
  14. int seq;
  15. struct timeval expires;
  16. unsigned char *packet;
  17. int packlen;
  18. int capacity;
  19. } pqueue_t;
  20. int pqueue_add (int seq, unsigned char *packet, int packlen);
  21. int pqueue_del (pqueue_t *point);
  22. pqueue_t *pqueue_head ();
  23. int pqueue_expiry_time (pqueue_t *entry);
  24. #endif /* PQUEUE_H */