/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.12
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace SLNet {

using System;
using System.Runtime.InteropServices;

public class NatPunchthroughClient : PluginInterface2 {
  private HandleRef swigCPtr;

  internal NatPunchthroughClient(IntPtr cPtr, bool cMemoryOwn) : base(SLikeNetPINVOKE.NatPunchthroughClient_SWIGUpcast(cPtr), cMemoryOwn) {
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(NatPunchthroughClient obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~NatPunchthroughClient() {
    Dispose();
  }

  public override void Dispose() {
    lock(this) {
      if (swigCPtr.Handle != IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          SLikeNetPINVOKE.delete_NatPunchthroughClient(swigCPtr);
        }
        swigCPtr = new HandleRef(null, IntPtr.Zero);
      }
      GC.SuppressFinalize(this);
      base.Dispose();
    }
  }

  public static NatPunchthroughClient GetInstance() {
    IntPtr cPtr = SLikeNetPINVOKE.NatPunchthroughClient_GetInstance();
    NatPunchthroughClient ret = (cPtr == IntPtr.Zero) ? null : new NatPunchthroughClient(cPtr, false);
    return ret;
  }

  public static void DestroyInstance(NatPunchthroughClient i) {
    SLikeNetPINVOKE.NatPunchthroughClient_DestroyInstance(NatPunchthroughClient.getCPtr(i));
  }

  public NatPunchthroughClient() : this(SLikeNetPINVOKE.new_NatPunchthroughClient(), true) {
  }

  public void FindRouterPortStride(SystemAddress facilitator) {
    SLikeNetPINVOKE.NatPunchthroughClient_FindRouterPortStride(swigCPtr, SystemAddress.getCPtr(facilitator));
    if (SLikeNetPINVOKE.SWIGPendingException.Pending) throw SLikeNetPINVOKE.SWIGPendingException.Retrieve();
  }

  public bool OpenNAT(RakNetGUID destination, SystemAddress facilitator) {
    bool ret = SLikeNetPINVOKE.NatPunchthroughClient_OpenNAT(swigCPtr, RakNetGUID.getCPtr(destination), SystemAddress.getCPtr(facilitator));
    if (SLikeNetPINVOKE.SWIGPendingException.Pending) throw SLikeNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public PunchthroughConfiguration GetPunchthroughConfiguration() {
    IntPtr cPtr = SLikeNetPINVOKE.NatPunchthroughClient_GetPunchthroughConfiguration(swigCPtr);
    PunchthroughConfiguration ret = (cPtr == IntPtr.Zero) ? null : new PunchthroughConfiguration(cPtr, false);
    return ret;
  }

  public void SetDebugInterface(NatPunchthroughDebugInterface i) {
    SLikeNetPINVOKE.NatPunchthroughClient_SetDebugInterface(swigCPtr, NatPunchthroughDebugInterface.getCPtr(i));
  }

  public void GetUPNPPortMappings(string externalPort, string internalPort, SystemAddress natPunchthroughServerAddress) {
    SLikeNetPINVOKE.NatPunchthroughClient_GetUPNPPortMappings(swigCPtr, externalPort, internalPort, SystemAddress.getCPtr(natPunchthroughServerAddress));
    if (SLikeNetPINVOKE.SWIGPendingException.Pending) throw SLikeNetPINVOKE.SWIGPendingException.Retrieve();
  }

  public void Clear() {
    SLikeNetPINVOKE.NatPunchthroughClient_Clear(swigCPtr);
  }

  public SWIGTYPE_p_SLNet__NatPunchthroughClient__SendPing sp {
    set {
      SLikeNetPINVOKE.NatPunchthroughClient_sp_set(swigCPtr, SWIGTYPE_p_SLNet__NatPunchthroughClient__SendPing.getCPtr(value));
    } 
    get {
      IntPtr cPtr = SLikeNetPINVOKE.NatPunchthroughClient_sp_get(swigCPtr);
      SWIGTYPE_p_SLNet__NatPunchthroughClient__SendPing ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_SLNet__NatPunchthroughClient__SendPing(cPtr, false);
      return ret;
    } 
  }

}

}
