/** * \brief Return a packet to where it was allocated. */ void PacketFreeOrRelease(Packet *p) { if (p->flags & PKT_ALLOC) PacketFree(p); else PacketPoolReturnPacket(p); }
/** \brief a initialized packet * * \warning Use *only* at init, not at packet runtime */ static void PacketPoolStorePacket(Packet *p) { /* Clear the PKT_ALLOC flag, since that indicates to push back * onto the ring buffer. */ p->flags &= ~PKT_ALLOC; p->pool = GetThreadPacketPool(); p->ReleasePacket = PacketPoolReturnPacket; PacketPoolReturnPacket(p); }
/** \brief a initialized packet * * \warning Use *only* at init, not at packet runtime */ void PacketPoolStorePacket(Packet *p) { if (RingBufferIsFull(ringbuffer)) { exit(1); } /* Clear the PKT_ALLOC flag, since that indicates to push back * onto the ring buffer. */ p->flags &= ~PKT_ALLOC; p->ReleasePacket = PacketPoolReturnPacket; PacketPoolReturnPacket(p); SCLogDebug("buffersize %u", RingBufferSize(ringbuffer)); }