work on new packet

This commit is contained in:
dowright 2021-08-24 18:23:07 -07:00 committed by DOWRIGHT
parent 9f2a2a9ccc
commit 5d7cdd67be
2 changed files with 4 additions and 6 deletions

View File

@ -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)

View File

@ -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