Ejemplo n.º 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");
                }
            }
        }
Ejemplo n.º 2
0
        private PortMapper()
        {
            natpmpPortMapper = new NATPMPPortMapper();
            upnpPortMapper = new UPnPPortMapper();

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

            existingUPnPPortMappingsToRemove = new List<ExistingUPnPPortMapping>();
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 5
0
 private void natpmpPortMapper_DidEndWorking(NATPMPPortMapper sender)
 {
     DecreaseWorkCount();
 }
Ejemplo n.º 6
0
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
 private void natpmpPortMapper_DidBeginWorking(NATPMPPortMapper sender)
 {
     IncreaseWorkCount();
 }