ipsec_libPINVOKE.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 2.0.9
  4. *
  5. * Do not make changes to this file unless you know what you are doing--modify
  6. * the SWIG interface file instead.
  7. * ----------------------------------------------------------------------------- */
  8. namespace org.doubango.ipsecWRAP {
  9. using System;
  10. using System.Runtime.InteropServices;
  11. class ipsec_libPINVOKE {
  12. protected class SWIGExceptionHelper {
  13. public delegate void ExceptionDelegate(string message);
  14. public delegate void ExceptionArgumentDelegate(string message, string paramName);
  15. static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
  16. static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
  17. static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
  18. static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
  19. static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
  20. static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
  21. static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
  22. static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
  23. static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
  24. static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
  25. static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
  26. static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
  27. static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
  28. static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
  29. [DllImport("ipsec_lib", EntryPoint="SWIGRegisterExceptionCallbacks_ipsec_lib")]
  30. public static extern void SWIGRegisterExceptionCallbacks_ipsec_lib(
  31. ExceptionDelegate applicationDelegate,
  32. ExceptionDelegate arithmeticDelegate,
  33. ExceptionDelegate divideByZeroDelegate,
  34. ExceptionDelegate indexOutOfRangeDelegate,
  35. ExceptionDelegate invalidCastDelegate,
  36. ExceptionDelegate invalidOperationDelegate,
  37. ExceptionDelegate ioDelegate,
  38. ExceptionDelegate nullReferenceDelegate,
  39. ExceptionDelegate outOfMemoryDelegate,
  40. ExceptionDelegate overflowDelegate,
  41. ExceptionDelegate systemExceptionDelegate);
  42. [DllImport("ipsec_lib", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_ipsec_lib")]
  43. public static extern void SWIGRegisterExceptionCallbacksArgument_ipsec_lib(
  44. ExceptionArgumentDelegate argumentDelegate,
  45. ExceptionArgumentDelegate argumentNullDelegate,
  46. ExceptionArgumentDelegate argumentOutOfRangeDelegate);
  47. static void SetPendingApplicationException(string message) {
  48. SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve()));
  49. }
  50. static void SetPendingArithmeticException(string message) {
  51. SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve()));
  52. }
  53. static void SetPendingDivideByZeroException(string message) {
  54. SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
  55. }
  56. static void SetPendingIndexOutOfRangeException(string message) {
  57. SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
  58. }
  59. static void SetPendingInvalidCastException(string message) {
  60. SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve()));
  61. }
  62. static void SetPendingInvalidOperationException(string message) {
  63. SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
  64. }
  65. static void SetPendingIOException(string message) {
  66. SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve()));
  67. }
  68. static void SetPendingNullReferenceException(string message) {
  69. SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve()));
  70. }
  71. static void SetPendingOutOfMemoryException(string message) {
  72. SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
  73. }
  74. static void SetPendingOverflowException(string message) {
  75. SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve()));
  76. }
  77. static void SetPendingSystemException(string message) {
  78. SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve()));
  79. }
  80. static void SetPendingArgumentException(string message, string paramName) {
  81. SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
  82. }
  83. static void SetPendingArgumentNullException(string message, string paramName) {
  84. Exception e = SWIGPendingException.Retrieve();
  85. if (e != null) message = message + " Inner Exception: " + e.Message;
  86. SWIGPendingException.Set(new System.ArgumentNullException(paramName, message));
  87. }
  88. static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
  89. Exception e = SWIGPendingException.Retrieve();
  90. if (e != null) message = message + " Inner Exception: " + e.Message;
  91. SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message));
  92. }
  93. static SWIGExceptionHelper() {
  94. SWIGRegisterExceptionCallbacks_ipsec_lib(
  95. applicationDelegate,
  96. arithmeticDelegate,
  97. divideByZeroDelegate,
  98. indexOutOfRangeDelegate,
  99. invalidCastDelegate,
  100. invalidOperationDelegate,
  101. ioDelegate,
  102. nullReferenceDelegate,
  103. outOfMemoryDelegate,
  104. overflowDelegate,
  105. systemDelegate);
  106. SWIGRegisterExceptionCallbacksArgument_ipsec_lib(
  107. argumentDelegate,
  108. argumentNullDelegate,
  109. argumentOutOfRangeDelegate);
  110. }
  111. }
  112. protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
  113. public class SWIGPendingException {
  114. [ThreadStatic]
  115. private static Exception pendingException = null;
  116. private static int numExceptionsPending = 0;
  117. public static bool Pending {
  118. get {
  119. bool pending = false;
  120. if (numExceptionsPending > 0)
  121. if (pendingException != null)
  122. pending = true;
  123. return pending;
  124. }
  125. }
  126. public static void Set(Exception e) {
  127. if (pendingException != null)
  128. throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
  129. pendingException = e;
  130. lock(typeof(ipsec_libPINVOKE)) {
  131. numExceptionsPending++;
  132. }
  133. }
  134. public static Exception Retrieve() {
  135. Exception e = null;
  136. if (numExceptionsPending > 0) {
  137. if (pendingException != null) {
  138. e = pendingException;
  139. pendingException = null;
  140. lock(typeof(ipsec_libPINVOKE)) {
  141. numExceptionsPending--;
  142. }
  143. }
  144. }
  145. return e;
  146. }
  147. }
  148. protected class SWIGStringHelper {
  149. public delegate string SWIGStringDelegate(string message);
  150. static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
  151. [DllImport("ipsec_lib", EntryPoint="SWIGRegisterStringCallback_ipsec_lib")]
  152. public static extern void SWIGRegisterStringCallback_ipsec_lib(SWIGStringDelegate stringDelegate);
  153. static string CreateString(string cString) {
  154. return cString;
  155. }
  156. static SWIGStringHelper() {
  157. SWIGRegisterStringCallback_ipsec_lib(stringDelegate);
  158. }
  159. }
  160. static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
  161. static ipsec_libPINVOKE() {
  162. }
  163. [DllImport("ipsec_lib", EntryPoint="CSharp_new_IPSecCtx")]
  164. public static extern IntPtr new_IPSecCtx(int jarg1, bool jarg2, int jarg3, int jarg4, int jarg5, int jarg6);
  165. [DllImport("ipsec_lib", EntryPoint="CSharp_delete_IPSecCtx")]
  166. public static extern void delete_IPSecCtx(HandleRef jarg1);
  167. [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_start")]
  168. public static extern int IPSecCtx_start(HandleRef jarg1);
  169. [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_setLocal")]
  170. public static extern int IPSecCtx_setLocal(HandleRef jarg1, string jarg2, string jarg3, ushort jarg4, ushort jarg5);
  171. [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_setKeys")]
  172. public static extern int IPSecCtx_setKeys(HandleRef jarg1, IntPtr jarg2, IntPtr jarg3);
  173. [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_setRemote")]
  174. public static extern int IPSecCtx_setRemote(HandleRef jarg1, uint jarg2, uint jarg3, ushort jarg4, ushort jarg5, ulong jarg6);
  175. [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_stop")]
  176. public static extern int IPSecCtx_stop(HandleRef jarg1);
  177. [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiUC")]
  178. public static extern uint IPSecCtx_getSpiUC(HandleRef jarg1);
  179. [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiUS")]
  180. public static extern uint IPSecCtx_getSpiUS(HandleRef jarg1);
  181. [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiPC")]
  182. public static extern uint IPSecCtx_getSpiPC(HandleRef jarg1);
  183. [DllImport("ipsec_lib", EntryPoint="CSharp_IPSecCtx_getSpiPS")]
  184. public static extern uint IPSecCtx_getSpiPS(HandleRef jarg1);
  185. }
  186. }