# Path: scapy/main.py
# def load_layer(name, globals_dict=None, symb_list=None):
#     # type: (str, Optional[Dict[str, Any]], Optional[List[str]]) -> None
#     """Loads a Scapy layer module to make variables, objects and functions
#     available globally.
# 
#     """
#     _load("scapy.layers." + LAYER_ALIASES.get(name, name),
#           globals_dict=globals_dict, symb_list=symb_list)
# 
# def load_contrib(name, globals_dict=None, symb_list=None):
#     # type: (str, Optional[Dict[str, Any]], Optional[List[str]]) -> None
#     """Loads a Scapy contrib module to make variables, objects and
#     functions available globally.
# 
#     If no contrib module can be found with the given name, try to find
#     a layer module, since a contrib module may become a layer module.
# 
#     """
#     try:
#         importlib.import_module("scapy.contrib." + name)
#         _load("scapy.contrib." + name,
#               globals_dict=globals_dict, symb_list=symb_list)
#     except ImportError as e:
#         # if layer not found in contrib, try in layers
#         try:
#             load_layer(name,
#                        globals_dict=globals_dict, symb_list=symb_list)
#         except ImportError:
#             raise e  # Let's raise the original error to avoid confusion
# 
# Path: scapy/config.py
# class ConfClass(object):
# class Interceptor(object):
# class ProgPath(ConfClass):
# class ConfigFieldList:
# class Emphasize(ConfigFieldList):
# class Resolve(ConfigFieldList):
# class Num2Layer:
# class LayersList(List[Type['scapy.packet.Packet']]):
# class CommandsList(List[Callable[..., Any]]):
# class CacheInstance(Dict[str, Any], object):
# class NetCache:
# class Conf(ConfClass):
#     def configure(self, cnf):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self,
#                  name,  # type: str
#                  default,  # type: Any
#                  hook,  # type: Callable[..., Any]
#                  args=None,  # type: Optional[List[Any]]
#                  kargs=None  # type: Optional[Dict[str, Any]]
#                  ):
#     def __get__(self, obj, typ=None):
#     def set_from_hook(obj, name, val):
#     def __set__(self, obj, val):
# def _readonly(name):
#     def __init__(self):
#     def _is_field(f):
#     def _recalc_layer_list(self):
#     def add(self, *flds):
#     def remove(self, *flds):
#     def __contains__(self, elt):
#     def __repr__(self):
#     def __init__(self):
#     def register(self, num, layer):
#     def register_num2layer(self, num, layer):
#     def register_layer2num(self, num, layer):
#     def __getitem__(self, item):
#     def __contains__(self, item):
#     def get(self,
#             item,  # type: Union[int, Type[Packet]]
#             default=None,  # type: Optional[Type[Packet]]
#             ):
#     def __repr__(self):
#     def __init__(self):
#     def __repr__(self):
#     def register(self, layer):
#     def layers(self):
#     def filter(self, items):
#     def unfilter(self):
#     def __repr__(self):
#     def register(self, cmd):
# def lsc():
#     def __init__(self, name="noname", timeout=None):
#     def flush(self):
#     def __getitem__(self, item):
#     def get(self, item, default=None):
#     def __setitem__(self, item, v):
#     def update(self,  # type: ignore
#                other,  # type: Any
#                **kwargs  # type: Any
#                ):
#     def iteritems(self):
#     def iterkeys(self):
#     def __iter__(self):
#     def itervalues(self):
#     def items(self):
#     def keys(self):
#     def values(self):
#     def __len__(self):
#     def summary(self):
#     def __repr__(self):
#     def copy(self):
#     def __init__(self):
#     def add_cache(self, cache):
#     def new_cache(self, name, timeout=None):
#     def __delattr__(self, attr):
#     def update(self, other):
#     def flush(self):
#     def __repr__(self):
# def _version_checker(module, minver):
# def isCryptographyValid():
# def isCryptographyAdvanced():
# def isPyPy():
# def _prompt_changer(attr, val, old):
# def _set_conf_sockets():
# def _socket_changer(attr, val, old):
# def _loglevel_changer(attr, val, old):
# def _iface_changer(attr, val, old):
#     def __getattribute__(self, attr):
# def crypto_validator(func):
#     def func_in(*args, **kwargs):
# def scapy_delete_temp_files():


import os
import subprocess
import sys
import scapy.modules.six as six
    import importlib
from platform import python_implementation
from scapy.main import load_layer, load_contrib
from scapy.config import conf
from scapy.error import log_runtime, Scapy_Exception
from scapy.consts import LINUX
        from scapy.contrib.cansocket_native import *  # noqa: F403
        from scapy.contrib.cansocket_python_can import *  # noqa: F403
    from scapy.contrib.cansocket_python_can import *  # noqa: F403
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Nils Weiss <nils@we155.de>
# This program is published under a GPLv2 license


# """ Default imports required for setup of CAN interfaces  """




load_layer("can", globals_dict=globals())
conf.contribs['CAN']['swap-bytes'] = False

# ############################################################################
# """ Define interface names for automotive tests  """
# ############################################################################
iface0 = "vcan0"
iface1 = "vcan1"

try:
    _root = os.geteuid() == 0
except AttributeError:
    _root = False

_not_pypy = "pypy" not in python_implementation().lower()
_socket_can_support = False



# Path: scapy/main.py
# def load_layer(name, globals_dict=None, symb_list=None):
#     # type: (str, Optional[Dict[str, Any]], Optional[List[str]]) -> None
#     """Loads a Scapy layer module to make variables, objects and functions
#     available globally.
# 
#     """
#     _load("scapy.layers." + LAYER_ALIASES.get(name, name),
#           globals_dict=globals_dict, symb_list=symb_list)
# 
# def load_contrib(name, globals_dict=None, symb_list=None):
#     # type: (str, Optional[Dict[str, Any]], Optional[List[str]]) -> None
#     """Loads a Scapy contrib module to make variables, objects and
#     functions available globally.
# 
#     If no contrib module can be found with the given name, try to find
#     a layer module, since a contrib module may become a layer module.
# 
#     """
#     try:
#         importlib.import_module("scapy.contrib." + name)
#         _load("scapy.contrib." + name,
#               globals_dict=globals_dict, symb_list=symb_list)
#     except ImportError as e:
#         # if layer not found in contrib, try in layers
#         try:
#             load_layer(name,
#                        globals_dict=globals_dict, symb_list=symb_list)
#         except ImportError:
#             raise e  # Let's raise the original error to avoid confusion
# 
# Path: scapy/config.py
# class ConfClass(object):
# class Interceptor(object):
# class ProgPath(ConfClass):
# class ConfigFieldList:
# class Emphasize(ConfigFieldList):
# class Resolve(ConfigFieldList):
# class Num2Layer:
# class LayersList(List[Type['scapy.packet.Packet']]):
# class CommandsList(List[Callable[..., Any]]):
# class CacheInstance(Dict[str, Any], object):
# class NetCache:
# class Conf(ConfClass):
#     def configure(self, cnf):
#     def __repr__(self):
#     def __str__(self):
#     def __init__(self,
#                  name,  # type: str
#                  default,  # type: Any
#                  hook,  # type: Callable[..., Any]
#                  args=None,  # type: Optional[List[Any]]
#                  kargs=None  # type: Optional[Dict[str, Any]]
#                  ):
#     def __get__(self, obj, typ=None):
#     def set_from_hook(obj, name, val):
#     def __set__(self, obj, val):
# def _readonly(name):
#     def __init__(self):
#     def _is_field(f):
#     def _recalc_layer_list(self):
#     def add(self, *flds):
#     def remove(self, *flds):
#     def __contains__(self, elt):
#     def __repr__(self):
#     def __init__(self):
#     def register(self, num, layer):
#     def register_num2layer(self, num, layer):
#     def register_layer2num(self, num, layer):
#     def __getitem__(self, item):
#     def __contains__(self, item):
#     def get(self,
#             item,  # type: Union[int, Type[Packet]]
#             default=None,  # type: Optional[Type[Packet]]
#             ):
#     def __repr__(self):
#     def __init__(self):
#     def __repr__(self):
#     def register(self, layer):
#     def layers(self):
#     def filter(self, items):
#     def unfilter(self):
#     def __repr__(self):
#     def register(self, cmd):
# def lsc():
#     def __init__(self, name="noname", timeout=None):
#     def flush(self):
#     def __getitem__(self, item):
#     def get(self, item, default=None):
#     def __setitem__(self, item, v):
#     def update(self,  # type: ignore
#                other,  # type: Any
#                **kwargs  # type: Any
#                ):
#     def iteritems(self):
#     def iterkeys(self):
#     def __iter__(self):
#     def itervalues(self):
#     def items(self):
#     def keys(self):
#     def values(self):
#     def __len__(self):
#     def summary(self):
#     def __repr__(self):
#     def copy(self):
#     def __init__(self):
#     def add_cache(self, cache):
#     def new_cache(self, name, timeout=None):
#     def __delattr__(self, attr):
#     def update(self, other):
#     def flush(self):
#     def __repr__(self):
# def _version_checker(module, minver):
# def isCryptographyValid():
# def isCryptographyAdvanced():
# def isPyPy():
# def _prompt_changer(attr, val, old):
# def _set_conf_sockets():
# def _socket_changer(attr, val, old):
# def _loglevel_changer(attr, val, old):
# def _iface_changer(attr, val, old):
#     def __getattribute__(self, attr):
# def crypto_validator(func):
#     def func_in(*args, **kwargs):
# def scapy_delete_temp_files():


# Path: test/contrib/automotive/interface_mockup.py
import os
import subprocess
import sys
import scapy.modules.six as six
    import importlib
from platform import python_implementation
from scapy.main import load_layer, load_contrib
from scapy.config import conf
from scapy.error import log_runtime, Scapy_Exception
from scapy.consts import LINUX
        from scapy.contrib.cansocket_native import *  # noqa: F403
        from scapy.contrib.cansocket_python_can import *  # noqa: F403
    from scapy.contrib.cansocket_python_can import *  # noqa: F403

# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Nils Weiss <nils@we155.de>
# This program is published under a GPLv2 license


# """ Default imports required for setup of CAN interfaces  """




load_layer("can", globals_dict=globals())
conf.contribs['CAN']['swap-bytes'] = False

# ############################################################################
# """ Define interface names for automotive tests  """
# ############################################################################
iface0 = "vcan0"
iface1 = "vcan1"

try:
    _root = os.geteuid() == 0
except AttributeError:
    _root = False

_not_pypy = "pypy" not in python_implementation().lower()
_socket_can_support = False



def test_and_setup_socket_can(iface_name):