Пример #1
0
        private void natpmpPortMapper_DidReceiveBroadcastExternalIPChange(NATPMPPortMapper sender, IPAddress ip, IPAddress senderIP)
        {
            if (isRunning)
            {
                DebugLog.WriteLine("natpmpPortMapper_DidReceiveBroadcastExternalIPChange");

                if (senderIP == localIPAddress)
                {
                    DebugLog.WriteLine("Refreshing because of NAT-PMP device external IP broadcast");
                    Refresh();
                }
                else
                {
                    DebugLog.WriteLine("Got information from rogue NAT-PMP device");
                }
            }
        }
Пример #2
0
        private PortMapper()
        {
            natpmpPortMapper = new NATPMPPortMapper();
            upnpPortMapper = new UPnPPortMapper();

            portMappings = new List<PortMapping>();
            portMappingsToRemove = new List<PortMapping>();

            existingUPnPPortMappingsToRemove = new List<ExistingUPnPPortMapping>();
        }
Пример #3
0
        private void natpmpPortMapper_DidGetExternalIPAddress(NATPMPPortMapper sender, System.Net.IPAddress ip)
        {
            bool shouldNotify = false;

            if (natpmpStatus == MappingStatus.Trying)
            {
                natpmpStatus = MappingStatus.Works;
                mappingProtocol = MappingProtocol.NATPMP;
                shouldNotify = true;
            }

            externalIPAddress = ip;
            OnExternalIPAddressDidChange();

            if (shouldNotify)
            {
                OnDidFinishSearchForRouter();
            }
        }
Пример #4
0
        private void natpmpPortMapper_DidFail(NATPMPPortMapper sender)
        {
            DebugLog.WriteLine("natpmpPortMapper_DidFail");

            if (natpmpStatus == MappingStatus.Trying)
            {
                natpmpStatus = MappingStatus.Failed;
            }
            else if (natpmpStatus == MappingStatus.Works)
            {
                externalIPAddress = null;
            }

            if (upnpStatus == MappingStatus.Failed)
            {
                OnDidFinishSearchForRouter();
            }
        }
Пример #5
0
 private void natpmpPortMapper_DidEndWorking(NATPMPPortMapper sender)
 {
     DecreaseWorkCount();
 }
Пример #6
0
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
 private void natpmpPortMapper_DidBeginWorking(NATPMPPortMapper sender)
 {
     IncreaseWorkCount();
 }