Use HelperHandleRegitry

This commit is contained in:
Pragyansh Chaturvedi
2025-10-01 03:53:11 +05:30
parent 6cd07498fe
commit 61f6743f0a
5 changed files with 36 additions and 30 deletions

15
pythonbpf/helpers.py Normal file
View File

@ -0,0 +1,15 @@
import ctypes
def ktime():
return ctypes.c_int64(0)
def pid():
return ctypes.c_int32(0)
def deref(ptr):
"dereference a pointer"
result = ctypes.cast(ptr, ctypes.POINTER(ctypes.c_void_p)).contents.value
return result if result is not None else 0
XDP_DROP = ctypes.c_int64(1)
XDP_PASS = ctypes.c_int64(2)