ipsecWRAP.cxx 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 2.0.9
  4. *
  5. * This file is not intended to be easily readable and contains a number of
  6. * coding conventions designed to improve portability and efficiency. Do not make
  7. * changes to this file unless you know what you are doing--modify the SWIG
  8. * interface file instead.
  9. * ----------------------------------------------------------------------------- */
  10. #define SWIGCSHARP
  11. #define SWIG_DIRECTORS
  12. #ifdef __cplusplus
  13. /* SwigValueWrapper is described in swig.swg */
  14. template<typename T> class SwigValueWrapper
  15. {
  16. struct SwigMovePointer {
  17. T *ptr;
  18. SwigMovePointer(T *p) : ptr(p) { }
  19. ~SwigMovePointer() {
  20. delete ptr;
  21. }
  22. SwigMovePointer& operator=(SwigMovePointer& rhs) {
  23. T* oldptr = ptr;
  24. ptr = 0;
  25. delete oldptr;
  26. ptr = rhs.ptr;
  27. rhs.ptr = 0;
  28. return *this;
  29. }
  30. } pointer;
  31. SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
  32. SwigValueWrapper(const SwigValueWrapper<T>& rhs);
  33. public:
  34. SwigValueWrapper() : pointer(0) { }
  35. SwigValueWrapper& operator=(const T& t) {
  36. SwigMovePointer tmp(new T(t));
  37. pointer = tmp;
  38. return *this;
  39. }
  40. operator T&() const {
  41. return *pointer.ptr;
  42. }
  43. T *operator&() {
  44. return pointer.ptr;
  45. }
  46. };
  47. template <typename T> T SwigValueInit()
  48. {
  49. return T();
  50. }
  51. #endif
  52. /* -----------------------------------------------------------------------------
  53. * This section contains generic SWIG labels for method/variable
  54. * declarations/attributes, and other compiler dependent labels.
  55. * ----------------------------------------------------------------------------- */
  56. /* template workaround for compilers that cannot correctly implement the C++ standard */
  57. #ifndef SWIGTEMPLATEDISAMBIGUATOR
  58. # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
  59. # define SWIGTEMPLATEDISAMBIGUATOR template
  60. # elif defined(__HP_aCC)
  61. /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
  62. /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
  63. # define SWIGTEMPLATEDISAMBIGUATOR template
  64. # else
  65. # define SWIGTEMPLATEDISAMBIGUATOR
  66. # endif
  67. #endif
  68. /* inline attribute */
  69. #ifndef SWIGINLINE
  70. # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
  71. # define SWIGINLINE inline
  72. # else
  73. # define SWIGINLINE
  74. # endif
  75. #endif
  76. /* attribute recognised by some compilers to avoid 'unused' warnings */
  77. #ifndef SWIGUNUSED
  78. # if defined(__GNUC__)
  79. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  80. # define SWIGUNUSED __attribute__ ((__unused__))
  81. # else
  82. # define SWIGUNUSED
  83. # endif
  84. # elif defined(__ICC)
  85. # define SWIGUNUSED __attribute__ ((__unused__))
  86. # else
  87. # define SWIGUNUSED
  88. # endif
  89. #endif
  90. #ifndef SWIG_MSC_UNSUPPRESS_4505
  91. # if defined(_MSC_VER)
  92. # pragma warning(disable : 4505) /* unreferenced local function has been removed */
  93. # endif
  94. #endif
  95. #ifndef SWIGUNUSEDPARM
  96. # ifdef __cplusplus
  97. # define SWIGUNUSEDPARM(p)
  98. # else
  99. # define SWIGUNUSEDPARM(p) p SWIGUNUSED
  100. # endif
  101. #endif
  102. /* internal SWIG method */
  103. #ifndef SWIGINTERN
  104. # define SWIGINTERN static SWIGUNUSED
  105. #endif
  106. /* internal inline SWIG method */
  107. #ifndef SWIGINTERNINLINE
  108. # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
  109. #endif
  110. /* exporting methods */
  111. #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
  112. # ifndef GCC_HASCLASSVISIBILITY
  113. # define GCC_HASCLASSVISIBILITY
  114. # endif
  115. #endif
  116. #ifndef SWIGEXPORT
  117. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  118. # if defined(STATIC_LINKED)
  119. # define SWIGEXPORT
  120. # else
  121. # define SWIGEXPORT __declspec(dllexport)
  122. # endif
  123. # else
  124. # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
  125. # define SWIGEXPORT __attribute__ ((visibility("default")))
  126. # else
  127. # define SWIGEXPORT
  128. # endif
  129. # endif
  130. #endif
  131. /* calling conventions for Windows */
  132. #ifndef SWIGSTDCALL
  133. # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
  134. # define SWIGSTDCALL __stdcall
  135. # else
  136. # define SWIGSTDCALL
  137. # endif
  138. #endif
  139. /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
  140. #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
  141. # define _CRT_SECURE_NO_DEPRECATE
  142. #endif
  143. /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
  144. #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
  145. # define _SCL_SECURE_NO_DEPRECATE
  146. #endif
  147. #include <stdlib.h>
  148. #include <string.h>
  149. #include <stdio.h>
  150. /* Support for throwing C# exceptions from C/C++. There are two types:
  151. * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
  152. typedef enum {
  153. SWIG_CSharpApplicationException,
  154. SWIG_CSharpArithmeticException,
  155. SWIG_CSharpDivideByZeroException,
  156. SWIG_CSharpIndexOutOfRangeException,
  157. SWIG_CSharpInvalidCastException,
  158. SWIG_CSharpInvalidOperationException,
  159. SWIG_CSharpIOException,
  160. SWIG_CSharpNullReferenceException,
  161. SWIG_CSharpOutOfMemoryException,
  162. SWIG_CSharpOverflowException,
  163. SWIG_CSharpSystemException
  164. } SWIG_CSharpExceptionCodes;
  165. typedef enum {
  166. SWIG_CSharpArgumentException,
  167. SWIG_CSharpArgumentNullException,
  168. SWIG_CSharpArgumentOutOfRangeException
  169. } SWIG_CSharpExceptionArgumentCodes;
  170. typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *);
  171. typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *);
  172. typedef struct {
  173. SWIG_CSharpExceptionCodes code;
  174. SWIG_CSharpExceptionCallback_t callback;
  175. } SWIG_CSharpException_t;
  176. typedef struct {
  177. SWIG_CSharpExceptionArgumentCodes code;
  178. SWIG_CSharpExceptionArgumentCallback_t callback;
  179. } SWIG_CSharpExceptionArgument_t;
  180. static SWIG_CSharpException_t SWIG_csharp_exceptions[] = {
  181. { SWIG_CSharpApplicationException, NULL },
  182. { SWIG_CSharpArithmeticException, NULL },
  183. { SWIG_CSharpDivideByZeroException, NULL },
  184. { SWIG_CSharpIndexOutOfRangeException, NULL },
  185. { SWIG_CSharpInvalidCastException, NULL },
  186. { SWIG_CSharpInvalidOperationException, NULL },
  187. { SWIG_CSharpIOException, NULL },
  188. { SWIG_CSharpNullReferenceException, NULL },
  189. { SWIG_CSharpOutOfMemoryException, NULL },
  190. { SWIG_CSharpOverflowException, NULL },
  191. { SWIG_CSharpSystemException, NULL }
  192. };
  193. static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = {
  194. { SWIG_CSharpArgumentException, NULL },
  195. { SWIG_CSharpArgumentNullException, NULL },
  196. { SWIG_CSharpArgumentOutOfRangeException, NULL }
  197. };
  198. static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg)
  199. {
  200. SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback;
  201. if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) {
  202. callback = SWIG_csharp_exceptions[code].callback;
  203. }
  204. callback(msg);
  205. }
  206. static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name)
  207. {
  208. SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback;
  209. if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
  210. callback = SWIG_csharp_exceptions_argument[code].callback;
  211. }
  212. callback(msg, param_name);
  213. }
  214. #ifdef __cplusplus
  215. extern "C"
  216. #endif
  217. SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_ipsec_lib(
  218. SWIG_CSharpExceptionCallback_t applicationCallback,
  219. SWIG_CSharpExceptionCallback_t arithmeticCallback,
  220. SWIG_CSharpExceptionCallback_t divideByZeroCallback,
  221. SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback,
  222. SWIG_CSharpExceptionCallback_t invalidCastCallback,
  223. SWIG_CSharpExceptionCallback_t invalidOperationCallback,
  224. SWIG_CSharpExceptionCallback_t ioCallback,
  225. SWIG_CSharpExceptionCallback_t nullReferenceCallback,
  226. SWIG_CSharpExceptionCallback_t outOfMemoryCallback,
  227. SWIG_CSharpExceptionCallback_t overflowCallback,
  228. SWIG_CSharpExceptionCallback_t systemCallback)
  229. {
  230. SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
  231. SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
  232. SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
  233. SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
  234. SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
  235. SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
  236. SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
  237. SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
  238. SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
  239. SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
  240. SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
  241. }
  242. #ifdef __cplusplus
  243. extern "C"
  244. #endif
  245. SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_ipsec_lib(
  246. SWIG_CSharpExceptionArgumentCallback_t argumentCallback,
  247. SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback,
  248. SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback)
  249. {
  250. SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback;
  251. SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback;
  252. SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback;
  253. }
  254. /* Callback for returning strings to C# without leaking memory */
  255. typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
  256. static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL;
  257. #ifdef __cplusplus
  258. extern "C"
  259. #endif
  260. SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ipsec_lib(SWIG_CSharpStringHelperCallback callback)
  261. {
  262. SWIG_csharp_string_callback = callback;
  263. }
  264. /* Contract support */
  265. #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
  266. /* -----------------------------------------------------------------------------
  267. * director.swg
  268. *
  269. * This file contains support for director classes so that C# proxy
  270. * methods can be called from C++.
  271. * ----------------------------------------------------------------------------- */
  272. #ifdef __cplusplus
  273. #if defined(DEBUG_DIRECTOR_OWNED)
  274. #include <iostream>
  275. #endif
  276. #include <string>
  277. namespace Swig
  278. {
  279. /* Director base class - not currently used in C# directors */
  280. class Director
  281. {
  282. };
  283. /* Base class for director exceptions */
  284. class DirectorException
  285. {
  286. protected:
  287. std::string swig_msg;
  288. public:
  289. DirectorException(const char* msg) : swig_msg(msg) {
  290. }
  291. DirectorException(const std::string &msg) : swig_msg(msg) {
  292. }
  293. const std::string& what() const {
  294. return swig_msg;
  295. }
  296. virtual ~DirectorException() {
  297. }
  298. };
  299. /* Pure virtual method exception */
  300. class DirectorPureVirtualException : public Swig::DirectorException
  301. {
  302. public:
  303. DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) {
  304. }
  305. };
  306. }
  307. #endif /* __cplusplus */
  308. #include <stdint.h> // Use the C99 official header
  309. #include "IPSecCtx.h"
  310. /* ---------------------------------------------------
  311. * C++ director class methods
  312. * --------------------------------------------------- */
  313. #include "ipsecWRAP.h"
  314. #ifdef __cplusplus
  315. extern "C" {
  316. #endif
  317. SWIGEXPORT void * SWIGSTDCALL CSharp_new_IPSecCtx(int jarg1, unsigned int jarg2, int jarg3, int jarg4, int jarg5, int jarg6)
  318. {
  319. void * jresult ;
  320. tipsec_ipproto_t arg1 ;
  321. bool arg2 ;
  322. tipsec_mode_t arg3 ;
  323. tipsec_ealg_t arg4 ;
  324. tipsec_alg_t arg5 ;
  325. tipsec_proto_t arg6 ;
  326. IPSecCtx *result = 0 ;
  327. arg1 = (tipsec_ipproto_t)jarg1;
  328. arg2 = jarg2 ? true : false;
  329. arg3 = (tipsec_mode_t)jarg3;
  330. arg4 = (tipsec_ealg_t)jarg4;
  331. arg5 = (tipsec_alg_t)jarg5;
  332. arg6 = (tipsec_proto_t)jarg6;
  333. result = (IPSecCtx *)new IPSecCtx(arg1,arg2,arg3,arg4,arg5,arg6);
  334. jresult = (void *)result;
  335. return jresult;
  336. }
  337. SWIGEXPORT void SWIGSTDCALL CSharp_delete_IPSecCtx(void * jarg1)
  338. {
  339. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  340. arg1 = (IPSecCtx *)jarg1;
  341. delete arg1;
  342. }
  343. SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_start(void * jarg1)
  344. {
  345. int jresult ;
  346. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  347. tipsec_error_t result;
  348. arg1 = (IPSecCtx *)jarg1;
  349. result = (tipsec_error_t)(arg1)->start();
  350. jresult = result;
  351. return jresult;
  352. }
  353. SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setLocal(void * jarg1, char * jarg2, char * jarg3, unsigned short jarg4, unsigned short jarg5)
  354. {
  355. int jresult ;
  356. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  357. char *arg2 = (char *) 0 ;
  358. char *arg3 = (char *) 0 ;
  359. tipsec_port_t arg4 ;
  360. tipsec_port_t arg5 ;
  361. tipsec_error_t result;
  362. arg1 = (IPSecCtx *)jarg1;
  363. arg2 = (char *)jarg2;
  364. arg3 = (char *)jarg3;
  365. arg4 = (tipsec_port_t)jarg4;
  366. arg5 = (tipsec_port_t)jarg5;
  367. result = (tipsec_error_t)(arg1)->setLocal((char const *)arg2,(char const *)arg3,arg4,arg5);
  368. jresult = result;
  369. return jresult;
  370. }
  371. SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setKeys(void * jarg1, void * jarg2, void * jarg3)
  372. {
  373. int jresult ;
  374. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  375. tipsec_key_t *arg2 = (tipsec_key_t *) 0 ;
  376. tipsec_key_t *arg3 = (tipsec_key_t *) 0 ;
  377. tipsec_error_t result;
  378. arg1 = (IPSecCtx *)jarg1;
  379. arg2 = jarg2;
  380. arg3 = jarg3;
  381. result = (tipsec_error_t)(arg1)->setKeys((tipsec_key_t const *)arg2,(tipsec_key_t const *)arg3);
  382. jresult = result;
  383. return jresult;
  384. }
  385. SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setRemote(void * jarg1, unsigned int jarg2, unsigned int jarg3, unsigned short jarg4, unsigned short jarg5, unsigned long long jarg6)
  386. {
  387. int jresult ;
  388. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  389. tipsec_spi_t arg2 ;
  390. tipsec_spi_t arg3 ;
  391. tipsec_port_t arg4 ;
  392. tipsec_port_t arg5 ;
  393. tipsec_lifetime_t arg6 ;
  394. tipsec_error_t result;
  395. arg1 = (IPSecCtx *)jarg1;
  396. arg2 = (tipsec_spi_t)jarg2;
  397. arg3 = (tipsec_spi_t)jarg3;
  398. arg4 = (tipsec_port_t)jarg4;
  399. arg5 = (tipsec_port_t)jarg5;
  400. arg6 = (tipsec_lifetime_t)jarg6;
  401. result = (tipsec_error_t)(arg1)->setRemote(arg2,arg3,arg4,arg5,arg6);
  402. jresult = result;
  403. return jresult;
  404. }
  405. SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_stop(void * jarg1)
  406. {
  407. int jresult ;
  408. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  409. tipsec_error_t result;
  410. arg1 = (IPSecCtx *)jarg1;
  411. result = (tipsec_error_t)(arg1)->stop();
  412. jresult = result;
  413. return jresult;
  414. }
  415. SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUC(void * jarg1)
  416. {
  417. unsigned int jresult ;
  418. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  419. tipsec_spi_t result;
  420. arg1 = (IPSecCtx *)jarg1;
  421. result = (tipsec_spi_t)(arg1)->getSpiUC();
  422. jresult = result;
  423. return jresult;
  424. }
  425. SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUS(void * jarg1)
  426. {
  427. unsigned int jresult ;
  428. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  429. tipsec_spi_t result;
  430. arg1 = (IPSecCtx *)jarg1;
  431. result = (tipsec_spi_t)(arg1)->getSpiUS();
  432. jresult = result;
  433. return jresult;
  434. }
  435. SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPC(void * jarg1)
  436. {
  437. unsigned int jresult ;
  438. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  439. tipsec_spi_t result;
  440. arg1 = (IPSecCtx *)jarg1;
  441. result = (tipsec_spi_t)(arg1)->getSpiPC();
  442. jresult = result;
  443. return jresult;
  444. }
  445. SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPS(void * jarg1)
  446. {
  447. unsigned int jresult ;
  448. IPSecCtx *arg1 = (IPSecCtx *) 0 ;
  449. tipsec_spi_t result;
  450. arg1 = (IPSecCtx *)jarg1;
  451. result = (tipsec_spi_t)(arg1)->getSpiPS();
  452. jresult = result;
  453. return jresult;
  454. }
  455. #ifdef __cplusplus
  456. }
  457. #endif