227 lines
10 KiB
C#
227 lines
10 KiB
C#
/* ----------------------------------------------------------------------------
|
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
|
* Version 2.0.9
|
|
*
|
|
* Do not make changes to this file unless you know what you are doing--modify
|
|
* the SWIG interface file instead.
|
|
* ----------------------------------------------------------------------------- */
|
|
|
|
namespace org.doubango.ipsecWRAP {
|
|
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
class ipsec_libPINVOKE {
|
|
|
|
protected class SWIGExceptionHelper {
|
|
|
|
public delegate void ExceptionDelegate(string message);
|
|
public delegate void ExceptionArgumentDelegate(string message, string paramName);
|
|
|
|
static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
|
|
static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
|
|
static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
|
|
static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
|
|
static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
|
|
static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
|
|
static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
|
|
static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
|
|
static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
|
|
static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
|
|
static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
|
|
|
|
static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
|
|
static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
|
|
static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="SWIGRegisterExceptionCallbacks_ipsec_lib")]
|
|
public static extern void SWIGRegisterExceptionCallbacks_ipsec_lib(
|
|
ExceptionDelegate applicationDelegate,
|
|
ExceptionDelegate arithmeticDelegate,
|
|
ExceptionDelegate divideByZeroDelegate,
|
|
ExceptionDelegate indexOutOfRangeDelegate,
|
|
ExceptionDelegate invalidCastDelegate,
|
|
ExceptionDelegate invalidOperationDelegate,
|
|
ExceptionDelegate ioDelegate,
|
|
ExceptionDelegate nullReferenceDelegate,
|
|
ExceptionDelegate outOfMemoryDelegate,
|
|
ExceptionDelegate overflowDelegate,
|
|
ExceptionDelegate systemExceptionDelegate);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_ipsec_lib")]
|
|
public static extern void SWIGRegisterExceptionCallbacksArgument_ipsec_lib(
|
|
ExceptionArgumentDelegate argumentDelegate,
|
|
ExceptionArgumentDelegate argumentNullDelegate,
|
|
ExceptionArgumentDelegate argumentOutOfRangeDelegate);
|
|
|
|
static void SetPendingApplicationException(string message) {
|
|
SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingArithmeticException(string message) {
|
|
SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingDivideByZeroException(string message) {
|
|
SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingIndexOutOfRangeException(string message) {
|
|
SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingInvalidCastException(string message) {
|
|
SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingInvalidOperationException(string message) {
|
|
SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingIOException(string message) {
|
|
SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingNullReferenceException(string message) {
|
|
SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingOutOfMemoryException(string message) {
|
|
SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingOverflowException(string message) {
|
|
SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingSystemException(string message) {
|
|
SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve()));
|
|
}
|
|
|
|
static void SetPendingArgumentException(string message, string paramName) {
|
|
SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
|
|
}
|
|
static void SetPendingArgumentNullException(string message, string paramName) {
|
|
Exception e = SWIGPendingException.Retrieve();
|
|
if (e != null) message = message + " Inner Exception: " + e.Message;
|
|
SWIGPendingException.Set(new System.ArgumentNullException(paramName, message));
|
|
}
|
|
static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
|
|
Exception e = SWIGPendingException.Retrieve();
|
|
if (e != null) message = message + " Inner Exception: " + e.Message;
|
|
SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message));
|
|
}
|
|
|
|
static SWIGExceptionHelper() {
|
|
SWIGRegisterExceptionCallbacks_ipsec_lib(
|
|
applicationDelegate,
|
|
arithmeticDelegate,
|
|
divideByZeroDelegate,
|
|
indexOutOfRangeDelegate,
|
|
invalidCastDelegate,
|
|
invalidOperationDelegate,
|
|
ioDelegate,
|
|
nullReferenceDelegate,
|
|
outOfMemoryDelegate,
|
|
overflowDelegate,
|
|
systemDelegate);
|
|
|
|
SWIGRegisterExceptionCallbacksArgument_ipsec_lib(
|
|
argumentDelegate,
|
|
argumentNullDelegate,
|
|
argumentOutOfRangeDelegate);
|
|
}
|
|
}
|
|
|
|
protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
|
|
|
|
public class SWIGPendingException {
|
|
[ThreadStatic]
|
|
private static Exception pendingException = null;
|
|
private static int numExceptionsPending = 0;
|
|
|
|
public static bool Pending {
|
|
get {
|
|
bool pending = false;
|
|
if (numExceptionsPending > 0)
|
|
if (pendingException != null)
|
|
pending = true;
|
|
return pending;
|
|
}
|
|
}
|
|
|
|
public static void Set(Exception e) {
|
|
if (pendingException != null)
|
|
throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
|
|
pendingException = e;
|
|
lock(typeof(ipsec_libPINVOKE)) {
|
|
numExceptionsPending++;
|
|
}
|
|
}
|
|
|
|
public static Exception Retrieve() {
|
|
Exception e = null;
|
|
if (numExceptionsPending > 0) {
|
|
if (pendingException != null) {
|
|
e = pendingException;
|
|
pendingException = null;
|
|
lock(typeof(ipsec_libPINVOKE)) {
|
|
numExceptionsPending--;
|
|
}
|
|
}
|
|
}
|
|
return e;
|
|
}
|
|
}
|
|
|
|
|
|
protected class SWIGStringHelper {
|
|
|
|
public delegate string SWIGStringDelegate(string message);
|
|
static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="SWIGRegisterStringCallback_ipsec_lib")]
|
|
public static extern void SWIGRegisterStringCallback_ipsec_lib(SWIGStringDelegate stringDelegate);
|
|
|
|
static string CreateString(string cString) {
|
|
return cString;
|
|
}
|
|
|
|
static SWIGStringHelper() {
|
|
SWIGRegisterStringCallback_ipsec_lib(stringDelegate);
|
|
}
|
|
}
|
|
|
|
static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
|
|
|
|
|
|
static ipsec_libPINVOKE() {
|
|
}
|
|
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_new_IPSecCtx")]
|
|
public static extern IntPtr new_IPSecCtx(int jarg1, bool jarg2, int jarg3, int jarg4, int jarg5, int jarg6);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_delete_IPSecCtx")]
|
|
public static extern void delete_IPSecCtx(HandleRef jarg1);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_start")]
|
|
public static extern int IPSecCtx_start(HandleRef jarg1);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_setLocal")]
|
|
public static extern int IPSecCtx_setLocal(HandleRef jarg1, string jarg2, string jarg3, ushort jarg4, ushort jarg5);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_setKeys")]
|
|
public static extern int IPSecCtx_setKeys(HandleRef jarg1, IntPtr jarg2, IntPtr jarg3);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_setRemote")]
|
|
public static extern int IPSecCtx_setRemote(HandleRef jarg1, uint jarg2, uint jarg3, ushort jarg4, ushort jarg5, ulong jarg6);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_stop")]
|
|
public static extern int IPSecCtx_stop(HandleRef jarg1);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiUC")]
|
|
public static extern uint IPSecCtx_getSpiUC(HandleRef jarg1);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiUS")]
|
|
public static extern uint IPSecCtx_getSpiUS(HandleRef jarg1);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiPC")]
|
|
public static extern uint IPSecCtx_getSpiPC(HandleRef jarg1);
|
|
|
|
[DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiPS")]
|
|
public static extern uint IPSecCtx_getSpiPS(HandleRef jarg1);
|
|
}
|
|
|
|
}
|