Ejemplo n.º 1
0
        public VirtualDevice()
        {
            _tapcfg = NativeLib.GetInstance();
            int version = _tapcfg.get_version();
            if (version != TAPCFG_VERSION) {
                string theirVersion = (version >> 16) + "." + (version & 0xffff);
                string ourVersion = (TAPCFG_VERSION >> 16) + "." + (TAPCFG_VERSION & 0xffff);
                throw new Exception("Library version mismatch, got " + theirVersion + " required " + ourVersion);
            }
            _handle = _tapcfg.init();
            if (_handle == IntPtr.Zero) {
                throw new Exception("Error initializing the tapcfg library");
            }

            LogCallback = new LogCallback(defaultCallback);
        }
Ejemplo n.º 2
0
        public VirtualDevice()
        {
            _tapcfg = NativeLib.GetInstance();
            int version = _tapcfg.get_version();

            if (version != TAPCFG_VERSION)
            {
                string theirVersion = (version >> 16) + "." + (version & 0xffff);
                string ourVersion   = (TAPCFG_VERSION >> 16) + "." + (TAPCFG_VERSION & 0xffff);
                throw new Exception("Library version mismatch, got " + theirVersion + " required " + ourVersion);
            }
            _handle = _tapcfg.init();
            if (_handle == IntPtr.Zero)
            {
                throw new Exception("Error initializing the tapcfg library");
            }

            LogCallback = new LogCallback(defaultCallback);
        }