Explorar o código

simplify PmpNatDevice

Luke Pulverenti %!s(int64=8) %!d(string=hai) anos
pai
achega
5dca85fe15
Modificáronse 1 ficheiros con 0 adicións e 87 borrados
  1. 0 87
      Mono.Nat/Pmp/PmpNatDevice.cs

+ 0 - 87
Mono.Nat/Pmp/PmpNatDevice.cs

@@ -52,93 +52,12 @@ namespace Mono.Nat.Pmp
 			get { return localAddress; }
 		}
 
-		public override IPAddress GetExternalIP ()
-		{
-			return publicAddress;
-		}
-
 	    public override Task CreatePortMap(Mapping mapping)
 	    {
             CreatePortMap(mapping, true);
 	        return Task.FromResult(true);
 	    }
 
-        public override IAsyncResult BeginCreatePortMap(Mapping mapping, AsyncCallback callback, object asyncState)
-		{
-			PortMapAsyncResult pmar = new PortMapAsyncResult (mapping.Protocol, mapping.PublicPort, PmpConstants.DefaultLeaseTime, callback, asyncState);
-			ThreadPool.QueueUserWorkItem (delegate 
-            {
-				try 
-                {
-					CreatePortMap(pmar.Mapping, true);
-					pmar.Complete();
-				} 
-                catch (Exception e) 
-                {
-					pmar.Complete(e);
-				}
-			});
-			return pmar;
-		}
-
-		public override IAsyncResult BeginDeletePortMap (Mapping mapping, AsyncCallback callback, object asyncState)
-		{
-			PortMapAsyncResult pmar =  new PortMapAsyncResult (mapping, callback, asyncState);
-			ThreadPool.QueueUserWorkItem (delegate {
-				try {
-					CreatePortMap(pmar.Mapping, false);
-					pmar.Complete();
-				} catch (Exception e) {
-					pmar.Complete(e);
-				}
-			});
-			return pmar;
-		}
-
-		public override void EndCreatePortMap (IAsyncResult result)
-		{
-			PortMapAsyncResult pmar = result as PortMapAsyncResult;
-			pmar.AsyncWaitHandle.WaitOne ();
-		}
-
-		public override void EndDeletePortMap (IAsyncResult result)
-		{
-			PortMapAsyncResult pmar = result as PortMapAsyncResult;
-			pmar.AsyncWaitHandle.WaitOne ();
-		}
-		
-		public override IAsyncResult BeginGetAllMappings (AsyncCallback callback, object asyncState)
-		{
-			//NAT-PMP does not specify a way to get all port mappings
-			throw new NotSupportedException ();
-		}
-
-		public override IAsyncResult BeginGetExternalIP (AsyncCallback callback, object asyncState)
-		{
-            StartOp(ref externalIpResult, callback, asyncState);
-            AsyncResult result = externalIpResult;
-            result.Complete();
-            return result;
-		}
-
-		public override IAsyncResult BeginGetSpecificMapping (Protocol protocol, int port, AsyncCallback callback, object asyncState)
-		{
-			//NAT-PMP does not specify a way to get a specific port map
-			throw new NotSupportedException ();
-		}
-		
-		public override Mapping[] EndGetAllMappings (IAsyncResult result)
-		{
-			//NAT-PMP does not specify a way to get all port mappings
-			throw new NotSupportedException ();
-		}
-
-		public override IPAddress EndGetExternalIP (IAsyncResult result)
-		{
-            EndOp(result, ref externalIpResult);
-			return publicAddress;
-		}
-
         private void StartOp(ref AsyncResult result, AsyncCallback callback, object asyncState)
         {
             if (pendingOp == true)
@@ -165,12 +84,6 @@ namespace Mono.Nat.Pmp
             pendingOp = false;
             actual = null;
         }
-
-		public override Mapping EndGetSpecificMapping (IAsyncResult result)
-		{
-			//NAT-PMP does not specify a way to get a specific port map
-			throw new NotSupportedException ();
-		}
 		
 		public override bool Equals(object obj)
 		{