macdivert.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:wireless-network-reproduction 作者: FinalTheory 项目源码 文件源码
def _load_lib(self, lib_path):
        """
        Loads the libdivert library, and configuring its arguments type
        :param lib_path: The OS path where to load the libdivert.so
        :return: None
        """
        self._lib = cdll.LoadLibrary(lib_path)

        # set the types of parameters
        for func_name, argtypes in self.divert_argtypes.items():
            # first check if function exists
            if not hasattr(self._lib, func_name):
                raise RuntimeError("Not a valid libdivert library")
            setattr(getattr(self._lib, func_name), "argtypes", argtypes)

        # set the types of return value
        for func_name, restype in self.divert_restypes.items():
            setattr(getattr(self._lib, func_name), "restype", restype)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号