00001 #ifndef _SEAP_PACKETQ_H 00002 #define _SEAP_PACKETQ_H 00003 00004 #include <stdint.h> 00005 #include <pthread.h> 00006 #include "_seap-packet.h" 00007 00008 struct SEAP_packetq_item { 00009 struct SEAP_packetq_item *next; 00010 struct SEAP_packetq_item *prev; 00011 SEAP_packet_t *packet; 00012 }; 00013 00014 #define SEAP_PACKETQ_DONTFREE 0x00000001 00015 00016 typedef struct { 00017 pthread_mutex_t lock; 00018 uint32_t flags; 00019 int count; 00020 00021 struct SEAP_packetq_item *first; 00022 struct SEAP_packetq_item *last; 00023 } SEAP_packetq_t; 00024 00025 int SEAP_packetq_init(SEAP_packetq_t *queue); 00026 void SEAP_packetq_free(SEAP_packetq_t *queue); 00027 00028 struct SEAP_packetq_item *SEAP_packetq_item_new(void); 00029 void SEAP_packetq_item_free(struct SEAP_packetq_item *i, bool freepacket); 00030 00031 int SEAP_packetq_get(SEAP_packetq_t *queue, SEAP_packet_t **packet_dst); 00032 int SEAP_packetq_put(SEAP_packetq_t *queue, SEAP_packet_t *packet); 00033 00034 int SEAP_packetq_count(SEAP_packetq_t *queue); 00035 00036 #endif /* _SEAP_PACKETQ_H */