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"); } } }
private PortMapper() { natpmpPortMapper = new NATPMPPortMapper(); upnpPortMapper = new UPnPPortMapper(); portMappings = new List<PortMapping>(); portMappingsToRemove = new List<PortMapping>(); existingUPnPPortMappingsToRemove = new List<ExistingUPnPPortMapping>(); }
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(); } }
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(); } }
private void natpmpPortMapper_DidEndWorking(NATPMPPortMapper sender) { DecreaseWorkCount(); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void natpmpPortMapper_DidBeginWorking(NATPMPPortMapper sender) { IncreaseWorkCount(); }