nfproxy module writing: written part of the firegex lib, frontend refactored and improved, c++ improves
This commit is contained in:
38
fgex-lib/firegex/nfproxy/__init__.py
Normal file
38
fgex-lib/firegex/nfproxy/__init__.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import functools
|
||||
|
||||
ACCEPT = 0
|
||||
DROP = 1
|
||||
REJECT = 2
|
||||
MANGLE = 3
|
||||
EXCEPTION = 4
|
||||
INVALID = 5
|
||||
|
||||
def pyfilter(func):
|
||||
"""
|
||||
Decorator to mark functions that will be used in the proxy.
|
||||
Stores the function reference in a global registry.
|
||||
"""
|
||||
if not hasattr(pyfilter, "registry"):
|
||||
pyfilter.registry = set()
|
||||
|
||||
pyfilter.registry.add(func.__name__)
|
||||
|
||||
@functools.wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
return func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
def get_pyfilters():
|
||||
"""Returns the list of functions marked with @pyfilter."""
|
||||
return list(pyfilter.registry)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user