Lines Matching defs:packet
17 #define MIN_CAPACITY 128 /* min allocated buffer for a packet */
19 static int pqueue_alloc (int seq, unsigned char *packet, int packlen, pqueue_t **new);
31 static int pqueue_alloc(int seq, unsigned char *packet, int packlen, pqueue_t **new) {
72 newent->packet = (unsigned char *)realloc(newent->packet, packlen);
74 if (!newent->packet) {
75 syslog(LOG_WARNING, "error reallocating packet: %s", strerror(errno));
97 /* a new queue entry was allocated. Allocate the packet buffer */
100 DEBUG_CMD(syslog(LOG_DEBUG, "allocating for packet size %d", size););
101 newent->packet = (unsigned char *)malloc(size);
102 if (!newent->packet) {
103 syslog(LOG_WARNING, "error allocating packet: %s", strerror(errno));
110 memcpy(newent->packet, packet, packlen);
127 int pqueue_add (int seq, unsigned char *packet, int packlen) {
131 if ( 0 != pqueue_alloc(seq, packet, packlen, &newent) ) {
137 // queue already contains this packet
138 syslog(LOG_WARNING, "discarding duplicate packet %d", seq);
161 /* We didn't find anywhere to insert the packet,
164 * so this packet belongs at the end of the queue (which might be empty)