aboutsummaryrefslogtreecommitdiff
path: root/Mono.Nat
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-27 23:09:44 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-27 23:09:44 -0400
commit5dca85fe150c2f13f58e04279101576536098a4c (patch)
treed151b7130e518bc7a3156ea2bc1b879af03b6098 /Mono.Nat
parenta7339f23a5d401bf489d49825a632cc502e78367 (diff)
simplify PmpNatDevice
Diffstat (limited to 'Mono.Nat')
-rw-r--r--Mono.Nat/Pmp/PmpNatDevice.cs87
1 files changed, 0 insertions, 87 deletions
diff --git a/Mono.Nat/Pmp/PmpNatDevice.cs b/Mono.Nat/Pmp/PmpNatDevice.cs
index 0337381b6..0deaf4af8 100644
--- a/Mono.Nat/Pmp/PmpNatDevice.cs
+++ b/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)
{