}
#endif
+#define PACKET_RELEASE_REFS(p) do { \
+ FlowDeReference(&((p)->flow)); \
+ HostDeReference(&((p)->host_src)); \
+ HostDeReference(&((p)->host_dst)); \
+ } while (0)
+
/**
* \brief Recycle a packet structure for reuse.
* \todo the mutex destroy & init is necessary because of the memset, reconsider
*/
-#define PACKET_DO_RECYCLE(p) do { \
+#define PACKET_REINIT(p) do { \
CLEAR_ADDR(&(p)->src); \
CLEAR_ADDR(&(p)->dst); \
(p)->sp = 0; \
(p)->vlan_id[0] = 0; \
(p)->vlan_id[1] = 0; \
(p)->vlan_idx = 0; \
- FlowDeReference(&((p)->flow)); \
(p)->ts.tv_sec = 0; \
(p)->ts.tv_usec = 0; \
(p)->datalink = 0; \
(p)->payload_len = 0; \
(p)->pktlen = 0; \
(p)->alerts.cnt = 0; \
- HostDeReference(&((p)->host_src)); \
- HostDeReference(&((p)->host_dst)); \
(p)->pcap_cnt = 0; \
(p)->tunnel_rtv_cnt = 0; \
(p)->tunnel_tpr_cnt = 0; \
PACKET_PROFILING_RESET((p)); \
} while (0)
-#define PACKET_RECYCLE(p) PACKET_DO_RECYCLE((p))
+#define PACKET_RECYCLE(p) do { \
+ PACKET_RELEASE_REFS((p)); \
+ PACKET_REINIT((p)); \
+ } while (0)
/**
* \brief Cleanup a packet so that we can free it. No memset needed..
*/
-#define PACKET_CLEANUP(p) do { \
+#define PACKET_DESTRUCTOR(p) do { \
if ((p)->pktvar != NULL) { \
PktVarFree((p)->pktvar); \
} \