Decorator Functions¶
pcapkit.utilities.decorators contains several useful
decorators, including seekset()
and beholder().
- @pcapkit.utilities.decorators.seekset(func)[source]¶
Read file from start then set back to original.
Important
This decorator function is designed for decorating class methods.
The decorator will keep the current offset of
self._file, then call the decorated function. Afterwards, it will rewind the offset ofself._fileto the original and returns the return value from the decorated function.Note
The decorated function should have following signature:
func(self, *args, **kw)
- @pcapkit.utilities.decorators.beholder(func)[source]¶
Behold extraction procedure.
Important
This decorator function is designed for decorating class methods.
This decorate first keep the current offset of
self._file, then try to call the decorated function. Should any exception raised, it will re-parse theself._fileasRawprotocol.Note
The decorated function should have following signature:
func(self, proto, length, *args, **kwargs)
Important
pcapkit.utilities.decorators.seekset() and
pcapkit.utilities.decorators.beholder() are designed
for decorating class methods.