From d8cddb9799ae7000692d372dbf0e766a57bd98c9 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Tue, 4 Nov 2025 05:19:22 +0530 Subject: [PATCH] Add signature extraction to HelperHandlerRegistry --- pythonbpf/helper/helper_registry.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pythonbpf/helper/helper_registry.py b/pythonbpf/helper/helper_registry.py index 7fbb597..dccb8c2 100644 --- a/pythonbpf/helper/helper_registry.py +++ b/pythonbpf/helper/helper_registry.py @@ -40,3 +40,22 @@ class HelperHandlerRegistry: def has_handler(cls, helper_name): """Check if a handler function is registered for a helper""" return helper_name in cls._handlers + + @classmethod + def get_signature(cls, helper_name): + """Get the signature of a helper function""" + return cls._handlers.get(helper_name) + + @classmethod + def get_param_type(cls, helper_name, index): + """Get the type of a parameter of a helper function by the index""" + signature = cls.get_signature(helper_name) + if signature and 0 <= index < len(signature.arg_types): + return signature.arg_types[index] + return None + + @classmethod + def get_return_type(cls, helper_name): + """Get the return type of a helper function""" + signature = cls.get_signature(helper_name) + return signature.return_type if signature else None