work on new packet

This commit is contained in:
dowright 2021-08-23 19:32:21 -07:00 committed by DOWRIGHT
parent 7c9a98ea70
commit 5a15325f1a
3 changed files with 23 additions and 3 deletions

View File

@ -27,8 +27,8 @@ cdef extern from "netinet/tcp.h":
u_int32_t th_seq
u_int32_t th_ack
u_int8_t th_x2:4
u_int8_t th_off:4
u_int8_t th_x2
u_int8_t th_off
u_int8_t th_flags

View File

@ -1,3 +1,23 @@
#!/usr/bin/env python3
import socket
# Constants for module users
cdef int COPY_NONE = 0
cdef int COPY_META = 1
cdef int COPY_PACKET = 2
cdef u_int16_t DEFAULT_MAX_QUEUELEN = 1024
cdef u_int16_t MaxPacketSize = 0xFFFF
# buffer size - metadata size
cdef u_int16_t MaxCopySize = 4096 - 80
# Socket queue should hold max number of packets of copy size bytes
# formula: DEF_MAX_QUEUELEN * (MaxCopySize+SockOverhead) / 2
cdef u_int32_t SockRcvSize = 1024 * 4796 // 2
cdef class CPacket:
'''parent class designed to index/parse full tcp/ip packets (including ethernet). two alternate
constructors are supplied to support nfqueue or raw sockets.

View File

@ -6,7 +6,7 @@ from Cython.Distutils import build_ext
cmd = {'build_ext': build_ext}
ext = Extension(
'dnx_nfqueue', sources=['new_packet.pyx'], libraries=['netfilter_queue'])
'new_packet', sources=['new_packet.pyx'], libraries=['netfilter_queue'])
setup(
name='DNX-NFQUEUE', cmdclass=cmd, ext_modules=cythonize(ext, language_level='3')