From 5d7cdd67be31d44a15dfee17b1c9dc16d5d9360a Mon Sep 17 00:00:00 2001 From: dowright Date: Tue, 24 Aug 2021 18:23:07 -0700 Subject: [PATCH] work on new packet --- new_packet.pxd | 4 ++-- new_packet.pyx | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/new_packet.pxd b/new_packet.pxd index 8b29a54..3409240 100644 --- a/new_packet.pxd +++ b/new_packet.pxd @@ -173,7 +173,7 @@ cdef enum: cdef class CPacket: cdef nfq_q_handle *_qh cdef nfq_data *_nfa - # cdef nfqnl_msg_packet_hdr *_hdr + cdef nfqnl_msg_packet_hdr *_hdr # cdef nfqnl_msg_packet_hw *_hw cdef u_int32_t id @@ -194,7 +194,7 @@ cdef class CPacket: cdef timeval timestamp cdef u_int8_t hw_addr[8] - cdef void parse(self, nfq_q_handle *qh, nfq_data *nfa) nogil + cdef u_int32_t parse(self, nfq_q_handle *qh, nfq_data *nfa) nogil cdef void _parse(self) nogil cdef void verdict(self, u_int32_t verdict) diff --git a/new_packet.pyx b/new_packet.pyx index c4cf5ff..46810b6 100644 --- a/new_packet.pyx +++ b/new_packet.pyx @@ -60,13 +60,11 @@ cdef class CPacket: '''Assign a packet from NFQ to this object. Parse the header and load local values.''' - # cdef unsigned char *data - self._qh = qh self._nfa = nfa - nfqnl_msg_packet_hdr *hdr = nfq_get_msg_packet_hdr(nfa) - self.id = ntohl(hdr.packet_id) + self._hdr = nfq_get_msg_packet_hdr(nfa) + self.id = ntohl(self._hdr.packet_id) # NOTE: these are not needed at this moment. # self.hw_protocol = ntohs(hdr.hw_protocol) # self.hook = hdr.hook