# Path: nitro/event.py
# class SyscallDirection(Enum):
#     """System call direction"""
#     enter = 0
#     exit = 1


import logging
import json
from collections import defaultdict
from nitro.event import SyscallDirection
from libvmi import LibvmiError

class Backend:
    """
    Base class for Backends. ``Backend`` provides functionality for dispatching
    hooks and keeping statistics about processed events.
    """

    __slots__ = (
        "domain",
        "libvmi",
        "hooks",
        "stats",
        "listener",
        "syscall_filtering"
    )

    def __init__(self, domain, libvmi, listener, syscall_filtering=True):
        """Create a new ``Backend``"""

        #: libvirt domain associated with the backend
        self.domain = domain
        #: handle to libvmi
        self.libvmi = libvmi
        #: ``Listener`` associated with the ``Backend``
        self.listener = listener
        #: Is system call filtering enabled for the backend
        self.syscall_filtering = syscall_filtering
        #: Event hooks
        self.hooks = {
            SyscallDirection.enter: {},

# Path: nitro/event.py
# class SyscallDirection(Enum):
#     """System call direction"""
#     enter = 0
#     exit = 1


# Path: nitro/backends/backend.py
import logging
import json
from collections import defaultdict
from nitro.event import SyscallDirection
from libvmi import LibvmiError


class Backend:
    """
    Base class for Backends. ``Backend`` provides functionality for dispatching
    hooks and keeping statistics about processed events.
    """

    __slots__ = (
        "domain",
        "libvmi",
        "hooks",
        "stats",
        "listener",
        "syscall_filtering"
    )

    def __init__(self, domain, libvmi, listener, syscall_filtering=True):
        """Create a new ``Backend``"""

        #: libvirt domain associated with the backend
        self.domain = domain
        #: handle to libvmi
        self.libvmi = libvmi
        #: ``Listener`` associated with the ``Backend``
        self.listener = listener
        #: Is system call filtering enabled for the backend
        self.syscall_filtering = syscall_filtering
        #: Event hooks
        self.hooks = {
            SyscallDirection.enter: {},

            SyscallDirection.exit: {}