示例#1
0
 public SudoInterface(WlanInterface wlan)
 {
     _id = wlan.InterfaceGuid.ToString();
     //Calling InterfaceName cuases an infinite loop
     //_name = wlan.InterfaceName;
     _desc = wlan.InterfaceDescription;
 }
 public SudoInterface(WlanInterface wlan)
 {
     _id   = wlan.InterfaceGuid.ToString();
     _desc = wlan.InterfaceDescription;
 }
示例#3
0
        private void OnWlanNotification(ref Wlan.WlanNotificationData notifyData, IntPtr context)
        {
            WlanInterface interface2 = _ifaces.ContainsKey(notifyData.interfaceGuid) ? _ifaces[notifyData.interfaceGuid] : null;

            switch (notifyData.notificationSource)
            {
            case Wlan.WlanNotificationSource.Acm:
                switch (notifyData.notificationCode)
                {
                case 8:
                    if (notifyData.dataSize >= Marshal.SizeOf(0))
                    {
                        Wlan.WlanReasonCode reasonCode = (Wlan.WlanReasonCode)Marshal.ReadInt32(notifyData.dataPtr);
                        if (interface2 != null)
                        {
                            interface2.OnWlanReason(notifyData, reasonCode);
                        }
                    }
                    goto Label_0194;

                case 9:
                case 10:
                case 11:
                case 20:
                case 0x15:
                {
                    Wlan.WlanConnectionNotificationData?nullable = ParseWlanConnectionNotification(ref notifyData);
                    if (nullable.HasValue && (interface2 != null))
                    {
                        interface2.OnWlanConnection(notifyData, nullable.Value);
                    }
                    goto Label_0194;
                }

                case 12:
                case 15:
                case 0x10:
                case 0x11:
                case 0x12:
                case 0x13:
                    goto Label_0194;

                case 13:
                    InterfaceArrivedEvent.Raise(this, new InterfaceNotificationEventsArgs(notifyData.interfaceGuid));
                    goto Label_0194;

                case 14:
                    InterfaceRemovedEvent.Raise(this, new InterfaceNotificationEventsArgs(notifyData.interfaceGuid));
                    goto Label_0194;
                }
                break;

            case Wlan.WlanNotificationSource.Msm:
                switch (notifyData.notificationCode)
                {
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                case 9:
                case 10:
                case 11:
                case 12:
                case 13:
                {
                    Wlan.WlanConnectionNotificationData?nullable2 = ParseWlanConnectionNotification(ref notifyData);
                    if (nullable2.HasValue && (interface2 != null))
                    {
                        interface2.OnWlanConnection(notifyData, nullable2.Value);
                    }
                    goto Label_0194;
                }

                case 7:
                case 8:
                    goto Label_0194;
                }
                goto Label_0194;
            }
Label_0194:
            if (interface2 != null)
            {
                interface2.OnWlanNotification(notifyData);
            }
        }
        public void Init(NetworkInterface wlanInterface, out Exception error)
        {
            error = null;
            _interface = null;

            Guid interfaceId = new Guid(wlanInterface.Id);
            //Translate the NetworkInterface to a WlanInterface
            foreach (WlanInterface wlan in InterfaceManager.Instance.WlanClient.Interfaces)
            {
                if (!wlan.InterfaceGuid.Equals(interfaceId)) continue;

                _interface = wlan;
                break;
            }
            if(_interface == null)
            {
                error = new ArgumentException("Invalid wireless interface", "wlanInterface");
                return;
            }

            _interface.WlanNotification += WlanApi_WlanNotification;
        }
示例#5
0
 public SudoInterface(WlanInterface wlan)
 {
     _id = wlan.InterfaceGuid.ToString();
     _desc = wlan.InterfaceDescription;
 }