Ejemplo n.º 1
0
		public AuthRequest(AccessPoint ap)
		{	
			_network	= ap.Network;
			_interface	= ap.Interface;

			_isPasswordRequired = 
				_network.securityEnabled &&
				_network.dot11DefaultCipherAlgorithm != Dot11CipherAlgorithm.None;

			_isEAPStore =
				_network.dot11DefaultAuthAlgorithm == Dot11AuthAlgorithm.RSNA ||
				_network.dot11DefaultAuthAlgorithm == Dot11AuthAlgorithm.WPA;

			_isUsernameRequired = _isEAPStore;
			_isDomainSupported	= _isEAPStore;
		}
Ejemplo n.º 2
0
		internal AccessPoint(WlanInterface interfac, WlanAvailableNetwork network)
		{
			_interface = interfac;
			_network = network;
		}
Ejemplo n.º 3
0
        // Called from interop
        private void OnWlanNotification(ref WlanNotificationData notifyData, IntPtr context)
        {
            if (NoWifiAvailable)
            {
                return;
            }

            WlanInterface wlanIface = ifaces.ContainsKey(notifyData.interfaceGuid) ? ifaces[notifyData.interfaceGuid] : null;

            switch (notifyData.notificationSource)
            {
            case WlanNotificationSource.ACM:
                switch ((WlanNotificationCodeAcm)notifyData.notificationCode)
                {
                case WlanNotificationCodeAcm.ConnectionStart:
                case WlanNotificationCodeAcm.ConnectionComplete:
                case WlanNotificationCodeAcm.ConnectionAttemptFail:
                case WlanNotificationCodeAcm.Disconnecting:
                case WlanNotificationCodeAcm.Disconnected:
                    WlanConnectionNotificationData?connNotifyData = WlanHelpers.ParseWlanConnectionNotification(ref notifyData);

                    if (connNotifyData.HasValue && wlanIface != null)
                    {
                        wlanIface.OnWlanConnection(notifyData, connNotifyData.Value);
                    }

                    break;

                case WlanNotificationCodeAcm.ScanFail:
                    int expectedSize = Marshal.SizeOf(typeof(int));

                    if (notifyData.dataSize >= expectedSize)
                    {
                        int reasonInt = Marshal.ReadInt32(notifyData.dataPtr);

                        // Want to make sure this doesn't crash if windows sends a reasoncode not defined in the enum.
                        if (Enum.IsDefined(typeof(WlanReasonCode), reasonInt))
                        {
                            WlanReasonCode reasonCode = (WlanReasonCode)reasonInt;

                            if (wlanIface != null)
                            {
                                wlanIface.OnWlanReason(notifyData, reasonCode);
                            }
                        }
                    }
                    break;
                }
                break;

            case WlanNotificationSource.MSM:
                switch ((WlanNotificationCodeMsm)notifyData.notificationCode)
                {
                case WlanNotificationCodeMsm.Associating:
                case WlanNotificationCodeMsm.Associated:
                case WlanNotificationCodeMsm.Authenticating:
                case WlanNotificationCodeMsm.Connected:
                case WlanNotificationCodeMsm.RoamingStart:
                case WlanNotificationCodeMsm.RoamingEnd:
                case WlanNotificationCodeMsm.Disassociating:
                case WlanNotificationCodeMsm.Disconnected:
                case WlanNotificationCodeMsm.PeerJoin:
                case WlanNotificationCodeMsm.PeerLeave:
                case WlanNotificationCodeMsm.AdapterRemoval:
                    WlanConnectionNotificationData?connNotifyData = WlanHelpers.ParseWlanConnectionNotification(ref notifyData);

                    if (connNotifyData.HasValue && wlanIface != null)
                    {
                        wlanIface.OnWlanConnection(notifyData, connNotifyData.Value);
                    }

                    break;
                }
                break;
            }

            if (wlanIface != null)
            {
                wlanIface.OnWlanNotification(notifyData);
            }
        }