work on new packet

This commit is contained in:
dowright 2021-08-24 18:34:36 -07:00 committed by DOWRIGHT
parent cb0a699d78
commit 9cd786ec9b

View File

@ -48,7 +48,7 @@ cdef class CPacket:
self._verdict_is_set = False
self._mark = 0
self.payload = 0
# self.payload = 0
# def __str__(self):
# cdef iphdr *hdr = <iphdr*>self.payload
@ -109,7 +109,7 @@ cdef class CPacket:
self.payload = self.data[iphdr_len+tcphdr_len:self.data_len]
if (ip_header.protocol == IPPROTO_UDP):
elif (ip_header.protocol == IPPROTO_UDP):
self.udp_header = <udphdr*>self.data[iphdr_len]
@ -117,7 +117,7 @@ cdef class CPacket:
self.payload = self.data[iphdr_len + udphdr_len:self.data_len]
if (ip_header.protocol == IPPROTO_ICMP):
elif (ip_header.protocol == IPPROTO_ICMP):
self.icmp_header = <icmphdr*>self.data[iphdr_len]
@ -200,6 +200,11 @@ cdef class CPacket:
self.icmp_header.type,
)
else:
proto_header = (
cdef int 0,
)
return proto_header
def get_payload(self):