diff options
2065 files changed, 261053 insertions, 257120 deletions
@@ -2,3 +2,20 @@ Debug *.user *.suo *.ncb +/bindings/csharp/Release +/tinyDAV/Release +/tinySIGCOMP/Release +/tinyBFCP/Release +/tinyMSRP/Release +/tinyHTTP/Release +/tinyMEDIA/Release +/tinyNET/Release +/tinySAK/Release +/plugins/pluginWinMF/Release +/tinySIP/Release +/tinySMS/Release +/tinyIPSec/Release +/tinySDP/Release +/tinyRTP/Release +/tinyXCAP/Release +*.orig diff --git a/AStyle.sh b/AStyle.sh new file mode 100644 index 0000000..560791a --- /dev/null +++ b/AStyle.sh @@ -0,0 +1 @@ +./thirdparties/win32/tools/AStyle.exe --style=k/r --lineend=linux --mode=c --add-brackets --break-closing-brackets --recursive "*.c" "*.cxx" "*.h" "*.cc"
\ No newline at end of file diff --git a/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cxx b/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cxx index db6bf63..13c4cf5 100755 --- a/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cxx +++ b/Samples/C#/IPSec/ipsec_lib/IPSecCtx.cxx @@ -25,70 +25,69 @@ bool IPSecCtx::sInitialized = false; extern "C" const tipsec_plugin_def_t *plugin_win_ipsec_vista_plugin_def_t; IPSecCtx::IPSecCtx(tipsec_ipproto_t ipproto, - bool use_ipv6, - tipsec_mode_t mode, - tipsec_ealg_t ealg, - tipsec_alg_t alg, - tipsec_proto_t protocol) -: m_pCtx(NULL) + bool use_ipv6, + tipsec_mode_t mode, + tipsec_ealg_t ealg, + tipsec_alg_t alg, + tipsec_proto_t protocol) + : m_pCtx(NULL) { - tipsec_ctx_t* pCtx = NULL; - if (!IPSecCtx::sInitialized) - { - assert (tipsec_plugin_register_static(plugin_win_ipsec_vista_plugin_def_t) == 0); - IPSecCtx::sInitialized = true; - } - assert (tipsec_ctx_create(ipproto, use_ipv6, mode, ealg, alg, protocol, &m_pCtx) == 0 && m_pCtx != NULL); + tipsec_ctx_t* pCtx = NULL; + if (!IPSecCtx::sInitialized) { + assert (tipsec_plugin_register_static(plugin_win_ipsec_vista_plugin_def_t) == 0); + IPSecCtx::sInitialized = true; + } + assert (tipsec_ctx_create(ipproto, use_ipv6, mode, ealg, alg, protocol, &m_pCtx) == 0 && m_pCtx != NULL); } IPSecCtx::~IPSecCtx() { - TSK_OBJECT_SAFE_FREE(m_pCtx); + TSK_OBJECT_SAFE_FREE(m_pCtx); } tipsec_error_t IPSecCtx::start() { - return tipsec_ctx_start(m_pCtx); + return tipsec_ctx_start(m_pCtx); } tipsec_error_t IPSecCtx::setLocal(const char* addr_local, const char* addr_remote, tipsec_port_t port_uc, tipsec_port_t port_us) { - return tipsec_ctx_set_local(m_pCtx, addr_local, addr_remote, port_uc, port_us); + return tipsec_ctx_set_local(m_pCtx, addr_local, addr_remote, port_uc, port_us); } tipsec_error_t IPSecCtx::setKeys(const tipsec_key_t* ik, const tipsec_key_t* ck) { - return tipsec_ctx_set_keys(m_pCtx, ik, ck); + return tipsec_ctx_set_keys(m_pCtx, ik, ck); } tipsec_error_t IPSecCtx::setRemote(tipsec_spi_t spi_pc, tipsec_spi_t spi_ps, tipsec_port_t port_pc, tipsec_port_t port_ps, tipsec_lifetime_t lifetime) { - return tipsec_ctx_set_remote(m_pCtx, spi_pc, spi_ps, port_pc, port_ps, lifetime); + return tipsec_ctx_set_remote(m_pCtx, spi_pc, spi_ps, port_pc, port_ps, lifetime); } tipsec_error_t IPSecCtx::stop() { - return tipsec_ctx_stop(m_pCtx); + return tipsec_ctx_stop(m_pCtx); } tipsec_spi_t IPSecCtx::getSpiUC() { - return m_pCtx->spi_uc; + return m_pCtx->spi_uc; } tipsec_spi_t IPSecCtx::getSpiUS() { - return m_pCtx->spi_us; + return m_pCtx->spi_us; } tipsec_spi_t IPSecCtx::getSpiPC() { - return m_pCtx->spi_pc; + return m_pCtx->spi_pc; } tipsec_spi_t IPSecCtx::getSpiPS() { - return m_pCtx->spi_ps; + return m_pCtx->spi_ps; } diff --git a/Samples/C#/IPSec/ipsec_lib/IPSecCtx.h b/Samples/C#/IPSec/ipsec_lib/IPSecCtx.h index 0e7d0ef..7aebc35 100755 --- a/Samples/C#/IPSec/ipsec_lib/IPSecCtx.h +++ b/Samples/C#/IPSec/ipsec_lib/IPSecCtx.h @@ -24,27 +24,27 @@ class IPSecCtx { public: - IPSecCtx(tipsec_ipproto_t ipproto, - bool use_ipv6, - tipsec_mode_t mode, - tipsec_ealg_t ealg, - tipsec_alg_t alg, - tipsec_proto_t protocol); - virtual ~IPSecCtx(); - tipsec_error_t start(); - tipsec_error_t setLocal(const char* addr_local, const char* addr_remote, tipsec_port_t port_uc, tipsec_port_t port_us); - tipsec_error_t setKeys(const tipsec_key_t* ik, const tipsec_key_t* ck); - tipsec_error_t setRemote(tipsec_spi_t spi_pc, tipsec_spi_t spi_ps, tipsec_port_t port_pc, tipsec_port_t port_ps, tipsec_lifetime_t lifetime); - tipsec_error_t stop(); + IPSecCtx(tipsec_ipproto_t ipproto, + bool use_ipv6, + tipsec_mode_t mode, + tipsec_ealg_t ealg, + tipsec_alg_t alg, + tipsec_proto_t protocol); + virtual ~IPSecCtx(); + tipsec_error_t start(); + tipsec_error_t setLocal(const char* addr_local, const char* addr_remote, tipsec_port_t port_uc, tipsec_port_t port_us); + tipsec_error_t setKeys(const tipsec_key_t* ik, const tipsec_key_t* ck); + tipsec_error_t setRemote(tipsec_spi_t spi_pc, tipsec_spi_t spi_ps, tipsec_port_t port_pc, tipsec_port_t port_ps, tipsec_lifetime_t lifetime); + tipsec_error_t stop(); - tipsec_spi_t getSpiUC(); - tipsec_spi_t getSpiUS(); - tipsec_spi_t getSpiPC(); - tipsec_spi_t getSpiPS(); + tipsec_spi_t getSpiUC(); + tipsec_spi_t getSpiUS(); + tipsec_spi_t getSpiPC(); + tipsec_spi_t getSpiPS(); private: - static bool sInitialized; - tipsec_ctx_t* m_pCtx; + static bool sInitialized; + tipsec_ctx_t* m_pCtx; }; #endif /* IPSEC_CTX_H */ diff --git a/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.cxx b/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.cxx index 336643d..0e443a3 100755 --- a/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.cxx +++ b/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.cxx @@ -1,11 +1,11 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 2.0.9 - * - * This file is not intended to be easily readable and contains a number of + * + * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGCSHARP @@ -14,24 +14,43 @@ #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ -template<typename T> class SwigValueWrapper { - struct SwigMovePointer { - T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } - } pointer; - SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); - SwigValueWrapper(const SwigValueWrapper<T>& rhs); +template<typename T> class SwigValueWrapper +{ + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { + delete ptr; + } + SwigMovePointer& operator=(SwigMovePointer& rhs) { + T* oldptr = ptr; + ptr = 0; + delete oldptr; + ptr = rhs.ptr; + rhs.ptr = 0; + return *this; + } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); + SwigValueWrapper(const SwigValueWrapper<T>& rhs); public: - SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } - operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { + SwigMovePointer tmp(new T(t)); + pointer = tmp; + return *this; + } + operator T&() const { + return *pointer.ptr; + } + T *operator&() { + return pointer.ptr; + } }; -template <typename T> T SwigValueInit() { - return T(); +template <typename T> T SwigValueInit() +{ + return T(); } #endif @@ -66,28 +85,28 @@ template <typename T> T SwigValueInit() { #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) +# define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) +# define SWIGUNUSED __attribute__ ((__unused__)) # else -# define SWIGUNUSED +# define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif +# endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif @@ -130,7 +149,7 @@ template <typename T> T SwigValueInit() { # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL -# endif +# endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ @@ -150,116 +169,120 @@ template <typename T> T SwigValueInit() { #include <stdio.h> -/* Support for throwing C# exceptions from C/C++. There are two types: +/* Support for throwing C# exceptions from C/C++. There are two types: * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */ typedef enum { - SWIG_CSharpApplicationException, - SWIG_CSharpArithmeticException, - SWIG_CSharpDivideByZeroException, - SWIG_CSharpIndexOutOfRangeException, - SWIG_CSharpInvalidCastException, - SWIG_CSharpInvalidOperationException, - SWIG_CSharpIOException, - SWIG_CSharpNullReferenceException, - SWIG_CSharpOutOfMemoryException, - SWIG_CSharpOverflowException, - SWIG_CSharpSystemException + SWIG_CSharpApplicationException, + SWIG_CSharpArithmeticException, + SWIG_CSharpDivideByZeroException, + SWIG_CSharpIndexOutOfRangeException, + SWIG_CSharpInvalidCastException, + SWIG_CSharpInvalidOperationException, + SWIG_CSharpIOException, + SWIG_CSharpNullReferenceException, + SWIG_CSharpOutOfMemoryException, + SWIG_CSharpOverflowException, + SWIG_CSharpSystemException } SWIG_CSharpExceptionCodes; typedef enum { - SWIG_CSharpArgumentException, - SWIG_CSharpArgumentNullException, - SWIG_CSharpArgumentOutOfRangeException + SWIG_CSharpArgumentException, + SWIG_CSharpArgumentNullException, + SWIG_CSharpArgumentOutOfRangeException } SWIG_CSharpExceptionArgumentCodes; typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *); typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *); typedef struct { - SWIG_CSharpExceptionCodes code; - SWIG_CSharpExceptionCallback_t callback; + SWIG_CSharpExceptionCodes code; + SWIG_CSharpExceptionCallback_t callback; } SWIG_CSharpException_t; typedef struct { - SWIG_CSharpExceptionArgumentCodes code; - SWIG_CSharpExceptionArgumentCallback_t callback; + SWIG_CSharpExceptionArgumentCodes code; + SWIG_CSharpExceptionArgumentCallback_t callback; } SWIG_CSharpExceptionArgument_t; static SWIG_CSharpException_t SWIG_csharp_exceptions[] = { - { SWIG_CSharpApplicationException, NULL }, - { SWIG_CSharpArithmeticException, NULL }, - { SWIG_CSharpDivideByZeroException, NULL }, - { SWIG_CSharpIndexOutOfRangeException, NULL }, - { SWIG_CSharpInvalidCastException, NULL }, - { SWIG_CSharpInvalidOperationException, NULL }, - { SWIG_CSharpIOException, NULL }, - { SWIG_CSharpNullReferenceException, NULL }, - { SWIG_CSharpOutOfMemoryException, NULL }, - { SWIG_CSharpOverflowException, NULL }, - { SWIG_CSharpSystemException, NULL } + { SWIG_CSharpApplicationException, NULL }, + { SWIG_CSharpArithmeticException, NULL }, + { SWIG_CSharpDivideByZeroException, NULL }, + { SWIG_CSharpIndexOutOfRangeException, NULL }, + { SWIG_CSharpInvalidCastException, NULL }, + { SWIG_CSharpInvalidOperationException, NULL }, + { SWIG_CSharpIOException, NULL }, + { SWIG_CSharpNullReferenceException, NULL }, + { SWIG_CSharpOutOfMemoryException, NULL }, + { SWIG_CSharpOverflowException, NULL }, + { SWIG_CSharpSystemException, NULL } }; static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = { - { SWIG_CSharpArgumentException, NULL }, - { SWIG_CSharpArgumentNullException, NULL }, - { SWIG_CSharpArgumentOutOfRangeException, NULL } + { SWIG_CSharpArgumentException, NULL }, + { SWIG_CSharpArgumentNullException, NULL }, + { SWIG_CSharpArgumentOutOfRangeException, NULL } }; -static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) { - SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback; - if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) { - callback = SWIG_csharp_exceptions[code].callback; - } - callback(msg); +static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) +{ + SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback; + if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) { + callback = SWIG_csharp_exceptions[code].callback; + } + callback(msg); } -static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) { - SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback; - if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) { - callback = SWIG_csharp_exceptions_argument[code].callback; - } - callback(msg, param_name); +static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) +{ + SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback; + if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) { + callback = SWIG_csharp_exceptions_argument[code].callback; + } + callback(msg, param_name); } #ifdef __cplusplus -extern "C" +extern "C" #endif SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_ipsec_lib( - SWIG_CSharpExceptionCallback_t applicationCallback, - SWIG_CSharpExceptionCallback_t arithmeticCallback, - SWIG_CSharpExceptionCallback_t divideByZeroCallback, - SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback, - SWIG_CSharpExceptionCallback_t invalidCastCallback, - SWIG_CSharpExceptionCallback_t invalidOperationCallback, - SWIG_CSharpExceptionCallback_t ioCallback, - SWIG_CSharpExceptionCallback_t nullReferenceCallback, - SWIG_CSharpExceptionCallback_t outOfMemoryCallback, - SWIG_CSharpExceptionCallback_t overflowCallback, - SWIG_CSharpExceptionCallback_t systemCallback) { - SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback; - SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback; - SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback; - SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback; - SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback; - SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback; - SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback; - SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback; - SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback; - SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback; - SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback; + SWIG_CSharpExceptionCallback_t applicationCallback, + SWIG_CSharpExceptionCallback_t arithmeticCallback, + SWIG_CSharpExceptionCallback_t divideByZeroCallback, + SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback, + SWIG_CSharpExceptionCallback_t invalidCastCallback, + SWIG_CSharpExceptionCallback_t invalidOperationCallback, + SWIG_CSharpExceptionCallback_t ioCallback, + SWIG_CSharpExceptionCallback_t nullReferenceCallback, + SWIG_CSharpExceptionCallback_t outOfMemoryCallback, + SWIG_CSharpExceptionCallback_t overflowCallback, + SWIG_CSharpExceptionCallback_t systemCallback) +{ +SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback; +SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback; +SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback; +SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback; +SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback; +SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback; +SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback; +SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback; +SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback; +SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback; +SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback; } #ifdef __cplusplus -extern "C" +extern "C" #endif SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_ipsec_lib( - SWIG_CSharpExceptionArgumentCallback_t argumentCallback, - SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback, - SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) { - SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback; - SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback; - SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback; + SWIG_CSharpExceptionArgumentCallback_t argumentCallback, + SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback, + SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) +{ +SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback; +SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback; +SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback; } @@ -269,10 +292,11 @@ static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL; #ifdef __cplusplus -extern "C" +extern "C" #endif -SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ipsec_lib(SWIG_CSharpStringHelperCallback callback) { - SWIG_csharp_string_callback = callback; +SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ipsec_lib(SWIG_CSharpStringHelperCallback callback) +{ +SWIG_csharp_string_callback = callback; } @@ -283,7 +307,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ipsec_lib(SWIG_CSharpStri /* ----------------------------------------------------------------------------- * director.swg * - * This file contains support for director classes so that C# proxy + * This file contains support for director classes so that C# proxy * methods can be called from C++. * ----------------------------------------------------------------------------- */ @@ -294,34 +318,38 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ipsec_lib(SWIG_CSharpStri #endif #include <string> -namespace Swig { - /* Director base class - not currently used in C# directors */ - class Director { - }; +namespace Swig +{ +/* Director base class - not currently used in C# directors */ +class Director +{ +}; - /* Base class for director exceptions */ - class DirectorException { - protected: +/* Base class for director exceptions */ +class DirectorException +{ +protected: std::string swig_msg; - public: +public: DirectorException(const char* msg) : swig_msg(msg) { } DirectorException(const std::string &msg) : swig_msg(msg) { } const std::string& what() const { - return swig_msg; + return swig_msg; } virtual ~DirectorException() { } - }; +}; - /* Pure virtual method exception */ - class DirectorPureVirtualException : public Swig::DirectorException { - public: +/* Pure virtual method exception */ +class DirectorPureVirtualException : public Swig::DirectorException +{ +public: DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) { } - }; +}; } #endif /* __cplusplus */ @@ -346,163 +374,174 @@ namespace Swig { extern "C" { #endif -SWIGEXPORT void * SWIGSTDCALL CSharp_new_IPSecCtx(int jarg1, unsigned int jarg2, int jarg3, int jarg4, int jarg5, int jarg6) { - void * jresult ; - tipsec_ipproto_t arg1 ; - bool arg2 ; - tipsec_mode_t arg3 ; - tipsec_ealg_t arg4 ; - tipsec_alg_t arg5 ; - tipsec_proto_t arg6 ; - IPSecCtx *result = 0 ; - - arg1 = (tipsec_ipproto_t)jarg1; - arg2 = jarg2 ? true : false; - arg3 = (tipsec_mode_t)jarg3; - arg4 = (tipsec_ealg_t)jarg4; - arg5 = (tipsec_alg_t)jarg5; - arg6 = (tipsec_proto_t)jarg6; - result = (IPSecCtx *)new IPSecCtx(arg1,arg2,arg3,arg4,arg5,arg6); - jresult = (void *)result; - return jresult; +SWIGEXPORT void * SWIGSTDCALL CSharp_new_IPSecCtx(int jarg1, unsigned int jarg2, int jarg3, int jarg4, int jarg5, int jarg6) +{ + void * jresult ; + tipsec_ipproto_t arg1 ; + bool arg2 ; + tipsec_mode_t arg3 ; + tipsec_ealg_t arg4 ; + tipsec_alg_t arg5 ; + tipsec_proto_t arg6 ; + IPSecCtx *result = 0 ; + + arg1 = (tipsec_ipproto_t)jarg1; + arg2 = jarg2 ? true : false; + arg3 = (tipsec_mode_t)jarg3; + arg4 = (tipsec_ealg_t)jarg4; + arg5 = (tipsec_alg_t)jarg5; + arg6 = (tipsec_proto_t)jarg6; + result = (IPSecCtx *)new IPSecCtx(arg1,arg2,arg3,arg4,arg5,arg6); + jresult = (void *)result; + return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_delete_IPSecCtx(void * jarg1) { - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - - arg1 = (IPSecCtx *)jarg1; - delete arg1; +SWIGEXPORT void SWIGSTDCALL CSharp_delete_IPSecCtx(void * jarg1) +{ + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + + arg1 = (IPSecCtx *)jarg1; + delete arg1; } -SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_start(void * jarg1) { - int jresult ; - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - tipsec_error_t result; - - arg1 = (IPSecCtx *)jarg1; - result = (tipsec_error_t)(arg1)->start(); - jresult = result; - return jresult; +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_start(void * jarg1) +{ + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_error_t)(arg1)->start(); + jresult = result; + return jresult; } -SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setLocal(void * jarg1, char * jarg2, char * jarg3, unsigned short jarg4, unsigned short jarg5) { - int jresult ; - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - tipsec_port_t arg4 ; - tipsec_port_t arg5 ; - tipsec_error_t result; - - arg1 = (IPSecCtx *)jarg1; - arg2 = (char *)jarg2; - arg3 = (char *)jarg3; - arg4 = (tipsec_port_t)jarg4; - arg5 = (tipsec_port_t)jarg5; - result = (tipsec_error_t)(arg1)->setLocal((char const *)arg2,(char const *)arg3,arg4,arg5); - jresult = result; - return jresult; +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setLocal(void * jarg1, char * jarg2, char * jarg3, unsigned short jarg4, unsigned short jarg5) +{ + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + tipsec_port_t arg4 ; + tipsec_port_t arg5 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (tipsec_port_t)jarg4; + arg5 = (tipsec_port_t)jarg5; + result = (tipsec_error_t)(arg1)->setLocal((char const *)arg2,(char const *)arg3,arg4,arg5); + jresult = result; + return jresult; } -SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setKeys(void * jarg1, void * jarg2, void * jarg3) { - int jresult ; - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - tipsec_key_t *arg2 = (tipsec_key_t *) 0 ; - tipsec_key_t *arg3 = (tipsec_key_t *) 0 ; - tipsec_error_t result; - - arg1 = (IPSecCtx *)jarg1; - arg2 = jarg2; - arg3 = jarg3; - result = (tipsec_error_t)(arg1)->setKeys((tipsec_key_t const *)arg2,(tipsec_key_t const *)arg3); - jresult = result; - return jresult; +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setKeys(void * jarg1, void * jarg2, void * jarg3) +{ + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_key_t *arg2 = (tipsec_key_t *) 0 ; + tipsec_key_t *arg3 = (tipsec_key_t *) 0 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + arg2 = jarg2; + arg3 = jarg3; + result = (tipsec_error_t)(arg1)->setKeys((tipsec_key_t const *)arg2,(tipsec_key_t const *)arg3); + jresult = result; + return jresult; } -SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setRemote(void * jarg1, unsigned int jarg2, unsigned int jarg3, unsigned short jarg4, unsigned short jarg5, unsigned long long jarg6) { - int jresult ; - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - tipsec_spi_t arg2 ; - tipsec_spi_t arg3 ; - tipsec_port_t arg4 ; - tipsec_port_t arg5 ; - tipsec_lifetime_t arg6 ; - tipsec_error_t result; - - arg1 = (IPSecCtx *)jarg1; - arg2 = (tipsec_spi_t)jarg2; - arg3 = (tipsec_spi_t)jarg3; - arg4 = (tipsec_port_t)jarg4; - arg5 = (tipsec_port_t)jarg5; - arg6 = (tipsec_lifetime_t)jarg6; - result = (tipsec_error_t)(arg1)->setRemote(arg2,arg3,arg4,arg5,arg6); - jresult = result; - return jresult; +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setRemote(void * jarg1, unsigned int jarg2, unsigned int jarg3, unsigned short jarg4, unsigned short jarg5, unsigned long long jarg6) +{ + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t arg2 ; + tipsec_spi_t arg3 ; + tipsec_port_t arg4 ; + tipsec_port_t arg5 ; + tipsec_lifetime_t arg6 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + arg2 = (tipsec_spi_t)jarg2; + arg3 = (tipsec_spi_t)jarg3; + arg4 = (tipsec_port_t)jarg4; + arg5 = (tipsec_port_t)jarg5; + arg6 = (tipsec_lifetime_t)jarg6; + result = (tipsec_error_t)(arg1)->setRemote(arg2,arg3,arg4,arg5,arg6); + jresult = result; + return jresult; } -SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_stop(void * jarg1) { - int jresult ; - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - tipsec_error_t result; - - arg1 = (IPSecCtx *)jarg1; - result = (tipsec_error_t)(arg1)->stop(); - jresult = result; - return jresult; +SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_stop(void * jarg1) +{ + int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_error_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_error_t)(arg1)->stop(); + jresult = result; + return jresult; } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUC(void * jarg1) { - unsigned int jresult ; - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - tipsec_spi_t result; - - arg1 = (IPSecCtx *)jarg1; - result = (tipsec_spi_t)(arg1)->getSpiUC(); - jresult = result; - return jresult; +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUC(void * jarg1) +{ + unsigned int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_spi_t)(arg1)->getSpiUC(); + jresult = result; + return jresult; } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUS(void * jarg1) { - unsigned int jresult ; - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - tipsec_spi_t result; - - arg1 = (IPSecCtx *)jarg1; - result = (tipsec_spi_t)(arg1)->getSpiUS(); - jresult = result; - return jresult; +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUS(void * jarg1) +{ + unsigned int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_spi_t)(arg1)->getSpiUS(); + jresult = result; + return jresult; } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPC(void * jarg1) { - unsigned int jresult ; - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - tipsec_spi_t result; - - arg1 = (IPSecCtx *)jarg1; - result = (tipsec_spi_t)(arg1)->getSpiPC(); - jresult = result; - return jresult; +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPC(void * jarg1) +{ + unsigned int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_spi_t)(arg1)->getSpiPC(); + jresult = result; + return jresult; } -SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPS(void * jarg1) { - unsigned int jresult ; - IPSecCtx *arg1 = (IPSecCtx *) 0 ; - tipsec_spi_t result; - - arg1 = (IPSecCtx *)jarg1; - result = (tipsec_spi_t)(arg1)->getSpiPS(); - jresult = result; - return jresult; +SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPS(void * jarg1) +{ + unsigned int jresult ; + IPSecCtx *arg1 = (IPSecCtx *) 0 ; + tipsec_spi_t result; + + arg1 = (IPSecCtx *)jarg1; + result = (tipsec_spi_t)(arg1)->getSpiPS(); + jresult = result; + return jresult; } diff --git a/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.h b/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.h index 49aa0fe..30b3b0e 100755 --- a/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.h +++ b/Samples/C#/IPSec/ipsec_lib/ipsecWRAP.h @@ -1,11 +1,11 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 2.0.9 - * - * This file is not intended to be easily readable and contains a number of + * + * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. * ----------------------------------------------------------------------------- */ #ifndef SWIG_ipsec_lib_WRAP_H_ diff --git a/Samples/C++/REGISTER/test/targetver.h b/Samples/C++/REGISTER/test/targetver.h index 6fe8eb7..5697f1a 100755 --- a/Samples/C++/REGISTER/test/targetver.h +++ b/Samples/C++/REGISTER/test/targetver.h @@ -1,8 +1,8 @@ #pragma once // The following macros define the minimum required platform. The minimum required platform -// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run -// your application. The macros work by enabling all features available on platform versions up to and +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and // including the version specified. // Modify the following defines if you have to target a platform prior to the ones specified below. diff --git a/android-utils/api.cxx b/android-utils/api.cxx index d9573c4..68cf59a 100755 --- a/android-utils/api.cxx +++ b/android-utils/api.cxx @@ -8,5 +8,5 @@ uint64_t AndroidUtils::getCpuFamily() uint64_t AndroidUtils::getCpuFeatures() { - return (uint64_t)android_getCpuFeatures(); + return (uint64_t)android_getCpuFeatures(); }
\ No newline at end of file diff --git a/android-utils/api.h b/android-utils/api.h index 0b9dc54..e8c4f12 100755 --- a/android-utils/api.h +++ b/android-utils/api.h @@ -3,30 +3,28 @@ #include <stdint.h> -typedef enum CpuFamily_e -{ - UNKNOWN = 0, - ARM, - X86 +typedef enum CpuFamily_e { + UNKNOWN = 0, + ARM, + X86 } CpuFamily_t; -typedef enum CpuFeatures_e -{ - ARMv7 = 1, - VFPv3 = 2, - NEON = 4 +typedef enum CpuFeatures_e { + ARMv7 = 1, + VFPv3 = 2, + NEON = 4 } CpuFeatures_t; class AndroidUtils { public: - AndroidUtils(){}; - virtual ~AndroidUtils(){}; + AndroidUtils() {}; + virtual ~AndroidUtils() {}; - static uint64_t getCpuFamily(); - static uint64_t getCpuFeatures(); + static uint64_t getCpuFamily(); + static uint64_t getCpuFeatures(); }; #endif /* ANDROID_UTILS_API_H */ diff --git a/android-utils/cpu-features.c b/android-utils/cpu-features.c index 70f5545..09db061 100755 --- a/android-utils/cpu-features.c +++ b/android-utils/cpu-features.c @@ -85,13 +85,13 @@ static __inline__ void x86_cpuid(int func, int values[4]) /* We need to preserve ebx since we're compiling PIC code */ /* this means we can't use "=b" for the second output register */ __asm__ __volatile__ ( \ - "push %%ebx\n" - "cpuid\n" \ - "mov %1, %%ebx\n" - "pop %%ebx\n" - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "a" (func) \ - ); + "push %%ebx\n" + "cpuid\n" \ + "mov %1, %%ebx\n" + "pop %%ebx\n" + : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ + : "a" (func) \ + ); values[0] = a; values[1] = b; values[2] = c; @@ -110,12 +110,14 @@ read_file(const char* pathname, char* buffer, size_t buffsize) int fd, len; fd = open(pathname, O_RDONLY); - if (fd < 0) + if (fd < 0) { return -1; + } do { len = read(fd, buffer, buffsize); - } while (len < 0 && errno == EINTR); + } + while (len < 0 && errno == EINTR); close(fd); @@ -143,11 +145,13 @@ extract_cpuinfo_field(char* buffer, int buflen, const char* field) bufend = buffer + buflen; for (;;) { p = memmem(p, bufend-p, field, fieldlen); - if (p == NULL) + if (p == NULL) { goto EXIT; + } - if (p == buffer || p[-1] == '\n') + if (p == buffer || p[-1] == '\n') { break; + } p += fieldlen; } @@ -155,20 +159,23 @@ extract_cpuinfo_field(char* buffer, int buflen, const char* field) /* Skip to the first column followed by a space */ p += fieldlen; p = memchr(p, ':', bufend-p); - if (p == NULL || p[1] != ' ') + if (p == NULL || p[1] != ' ') { goto EXIT; + } /* Find the end of the line */ p += 2; q = memchr(p, '\n', bufend-p); - if (q == NULL) + if (q == NULL) { q = bufend; + } /* Copy the line into a heap-allocated buffer */ len = q-p; result = malloc(len+1); - if (result == NULL) + if (result == NULL) { goto EXIT; + } memcpy(result, p, len); result[len] = '\0'; @@ -190,23 +197,27 @@ has_list_item(const char* list, const char* item) const char* p = list; int itemlen = strlen(item); - if (list == NULL) + if (list == NULL) { return 0; + } while (*p) { const char* q; /* skip spaces */ - while (*p == ' ' || *p == '\t') + while (*p == ' ' || *p == '\t') { p++; + } /* find end of current list item */ q = p; - while (*q && *q != ' ' && *q != '\t') + while (*q && *q != ' ' && *q != '\t') { q++; + } - if (itemlen == q-p && !memcmp(p, item, itemlen)) + if (itemlen == q-p && !memcmp(p, item, itemlen)) { return 1; + } /* skip to next item */ p = q; @@ -231,13 +242,15 @@ parse_decimal(const char* input, const char* limit, int* result) int val = 0; while (p < limit) { int d = (*p - '0'); - if ((unsigned)d >= 10U) + if ((unsigned)d >= 10U) { break; + } val = val*10 + d; p++; } - if (p == input) + if (p == input) { return NULL; + } *result = val; return p; @@ -254,24 +267,28 @@ typedef struct { } CpuList; static __inline__ void -cpulist_init(CpuList* list) { +cpulist_init(CpuList* list) +{ list->mask = 0; } static __inline__ void -cpulist_and(CpuList* list1, CpuList* list2) { +cpulist_and(CpuList* list1, CpuList* list2) +{ list1->mask &= list2->mask; } static __inline__ void -cpulist_set(CpuList* list, int index) { +cpulist_set(CpuList* list, int index) +{ if ((unsigned)index < 32) { list->mask |= (uint32_t)(1U << index); } } static __inline__ int -cpulist_count(CpuList* list) { +cpulist_count(CpuList* list) +{ return __builtin_popcount(list->mask); } @@ -295,8 +312,7 @@ cpulist_parse(CpuList* list, const char* line, int line_len) /* NOTE: the input line coming from sysfs typically contains a * trailing newline, so take care of it in the code below */ - while (p < end && *p != '\n') - { + while (p < end && *p != '\n') { int val, start_value, end_value; /* Find the end of current item, and put it into 'q' */ @@ -307,8 +323,9 @@ cpulist_parse(CpuList* list, const char* line, int line_len) /* Get first value */ p = parse_decimal(p, q, &start_value); - if (p == NULL) + if (p == NULL) { goto BAD_FORMAT; + } end_value = start_value; @@ -317,8 +334,9 @@ cpulist_parse(CpuList* list, const char* line, int line_len) */ if (p < q && *p == '-') { p = parse_decimal(p+1, q, &end_value); - if (p == NULL) + if (p == NULL) { goto BAD_FORMAT; + } } /* Set bits CPU list bits */ @@ -328,8 +346,9 @@ cpulist_parse(CpuList* list, const char* line, int line_len) /* Jump to next item */ p = q; - if (p < end) + if (p < end) { p++; + } } BAD_FORMAT: @@ -391,7 +410,7 @@ android_cpuInit(void) D("cpuinfo_len is (%d):\n%.*s\n", cpuinfo_len, cpuinfo_len >= 0 ? cpuinfo_len : 0, cpuinfo); - if (cpuinfo_len < 0) /* should not happen */ { + if (cpuinfo_len < 0) { /* should not happen */ return; } @@ -478,11 +497,13 @@ android_cpuInit(void) D("found cpuFeatures = '%s'\n", cpuFeatures); - if (has_list_item(cpuFeatures, "vfpv3")) + if (has_list_item(cpuFeatures, "vfpv3")) { g_cpuFeatures |= ANDROID_CPU_ARM_FEATURE_VFPv3; + } - else if (has_list_item(cpuFeatures, "vfpv3d16")) + else if (has_list_item(cpuFeatures, "vfpv3d16")) { g_cpuFeatures |= ANDROID_CPU_ARM_FEATURE_VFPv3; + } if (has_list_item(cpuFeatures, "neon")) { /* Note: Certain kernels only report neon but not vfpv3 @@ -503,7 +524,7 @@ android_cpuInit(void) int regs[4]; -/* According to http://en.wikipedia.org/wiki/CPUID */ + /* According to http://en.wikipedia.org/wiki/CPUID */ #define VENDOR_INTEL_b 0x756e6547 #define VENDOR_INTEL_c 0x6c65746e #define VENDOR_INTEL_d 0x49656e69 diff --git a/android-utils/utils_wrap.cxx b/android-utils/utils_wrap.cxx index dd0f9b1..9a43bda 100755 --- a/android-utils/utils_wrap.cxx +++ b/android-utils/utils_wrap.cxx @@ -1,11 +1,11 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 2.0.4 - * - * This file is not intended to be easily readable and contains a number of + * + * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGJAVA @@ -14,24 +14,43 @@ #ifdef __cplusplus /* SwigValueWrapper is described in swig.swg */ -template<typename T> class SwigValueWrapper { - struct SwigMovePointer { - T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } - } pointer; - SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); - SwigValueWrapper(const SwigValueWrapper<T>& rhs); +template<typename T> class SwigValueWrapper +{ + struct SwigMovePointer { + T *ptr; + SwigMovePointer(T *p) : ptr(p) { } + ~SwigMovePointer() { + delete ptr; + } + SwigMovePointer& operator=(SwigMovePointer& rhs) { + T* oldptr = ptr; + ptr = 0; + delete oldptr; + ptr = rhs.ptr; + rhs.ptr = 0; + return *this; + } + } pointer; + SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); + SwigValueWrapper(const SwigValueWrapper<T>& rhs); public: - SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } - operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } + SwigValueWrapper() : pointer(0) { } + SwigValueWrapper& operator=(const T& t) { + SwigMovePointer tmp(new T(t)); + pointer = tmp; + return *this; + } + operator T&() const { + return *pointer.ptr; + } + T *operator&() { + return pointer.ptr; + } }; -template <typename T> T SwigValueInit() { - return T(); +template <typename T> T SwigValueInit() +{ + return T(); } #endif @@ -66,28 +85,28 @@ template <typename T> T SwigValueInit() { #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) +# define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) +# define SWIGUNUSED __attribute__ ((__unused__)) # else -# define SWIGUNUSED +# define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif +# endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif @@ -130,7 +149,7 @@ template <typename T> T SwigValueInit() { # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL -# endif +# endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ @@ -147,7 +166,7 @@ template <typename T> T SwigValueInit() { /* Fix for jlong on some versions of gcc on Windows */ #if defined(__GNUC__) && !defined(__INTEL_COMPILER) - typedef long long __int64; +typedef long long __int64; #endif /* Fix for jlong on 64-bit x86 Solaris */ @@ -164,46 +183,49 @@ template <typename T> T SwigValueInit() { /* Support for throwing Java exceptions */ typedef enum { - SWIG_JavaOutOfMemoryError = 1, - SWIG_JavaIOException, - SWIG_JavaRuntimeException, - SWIG_JavaIndexOutOfBoundsException, - SWIG_JavaArithmeticException, - SWIG_JavaIllegalArgumentException, - SWIG_JavaNullPointerException, - SWIG_JavaDirectorPureVirtual, - SWIG_JavaUnknownError + SWIG_JavaOutOfMemoryError = 1, + SWIG_JavaIOException, + SWIG_JavaRuntimeException, + SWIG_JavaIndexOutOfBoundsException, + SWIG_JavaArithmeticException, + SWIG_JavaIllegalArgumentException, + SWIG_JavaNullPointerException, + SWIG_JavaDirectorPureVirtual, + SWIG_JavaUnknownError } SWIG_JavaExceptionCodes; typedef struct { - SWIG_JavaExceptionCodes code; - const char *java_exception; + SWIG_JavaExceptionCodes code; + const char *java_exception; } SWIG_JavaExceptions_t; -static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) { - jclass excep; - static const SWIG_JavaExceptions_t java_exceptions[] = { - { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, - { SWIG_JavaIOException, "java/io/IOException" }, - { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, - { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, - { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, - { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, - { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, - { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, - { SWIG_JavaUnknownError, "java/lang/UnknownError" }, - { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } - }; - const SWIG_JavaExceptions_t *except_ptr = java_exceptions; - - while (except_ptr->code != code && except_ptr->code) - except_ptr++; - - jenv->ExceptionClear(); - excep = jenv->FindClass(except_ptr->java_exception); - if (excep) - jenv->ThrowNew(excep, msg); +static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) +{ + jclass excep; + static const SWIG_JavaExceptions_t java_exceptions[] = { + { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, + { SWIG_JavaIOException, "java/io/IOException" }, + { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, + { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, + { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, + { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, + { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, + { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, + { SWIG_JavaUnknownError, "java/lang/UnknownError" }, + { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } + }; + const SWIG_JavaExceptions_t *except_ptr = java_exceptions; + + while (except_ptr->code != code && except_ptr->code) { + except_ptr++; + } + + jenv->ExceptionClear(); + excep = jenv->FindClass(except_ptr->java_exception); + if (excep) { + jenv->ThrowNew(excep, msg); + } } @@ -224,127 +246,139 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC #include <iostream> #endif -namespace Swig { - /* Java object wrapper */ - class JObjectWrapper { - public: +namespace Swig +{ +/* Java object wrapper */ +class JObjectWrapper +{ +public: JObjectWrapper() : jthis_(NULL), weak_global_(true) { } ~JObjectWrapper() { - jthis_ = NULL; - weak_global_ = true; + jthis_ = NULL; + weak_global_ = true; } bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global) { - if (!jthis_) { - weak_global_ = weak_global; - if (jobj) - jthis_ = ((weak_global_ || !mem_own) ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj)); + if (!jthis_) { + weak_global_ = weak_global; + if (jobj) { + jthis_ = ((weak_global_ || !mem_own) ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj)); + } #if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl; + std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl; #endif - return true; - } else { + return true; + } + else { #if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl; + std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl; #endif - return false; - } + return false; + } } jobject get(JNIEnv *jenv) const { #if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::get("; - if (jthis_) - std::cout << jthis_; - else - std::cout << "null"; - std::cout << ") -> return new local ref" << std::endl; + std::cout << "JObjectWrapper::get("; + if (jthis_) { + std::cout << jthis_; + } + else { + std::cout << "null"; + } + std::cout << ") -> return new local ref" << std::endl; #endif - return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_); + return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_); } void release(JNIEnv *jenv) { #if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "JObjectWrapper::release(" << jthis_ << "): " << (weak_global_ ? "weak global ref" : "global ref") << std::endl; + std::cout << "JObjectWrapper::release(" << jthis_ << "): " << (weak_global_ ? "weak global ref" : "global ref") << std::endl; #endif - if (jthis_) { - if (weak_global_) { - if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) - jenv->DeleteWeakGlobalRef((jweak)jthis_); - } else - jenv->DeleteGlobalRef(jthis_); - } - - jthis_ = NULL; - weak_global_ = true; + if (jthis_) { + if (weak_global_) { + if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) { + jenv->DeleteWeakGlobalRef((jweak)jthis_); + } + } + else { + jenv->DeleteGlobalRef(jthis_); + } + } + + jthis_ = NULL; + weak_global_ = true; } jobject peek() { - return jthis_; + return jthis_; } /* Java proxy releases ownership of C++ object, C++ object is now responsible for destruction (creates NewGlobalRef to pin Java proxy) */ void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { - if (take_or_release) { /* Java takes ownership of C++ object's lifetime. */ - if (!weak_global_) { - jenv->DeleteGlobalRef(jthis_); - jthis_ = jenv->NewWeakGlobalRef(jself); - weak_global_ = true; + if (take_or_release) { /* Java takes ownership of C++ object's lifetime. */ + if (!weak_global_) { + jenv->DeleteGlobalRef(jthis_); + jthis_ = jenv->NewWeakGlobalRef(jself); + weak_global_ = true; + } } - } else { /* Java releases ownership of C++ object's lifetime */ - if (weak_global_) { - jenv->DeleteWeakGlobalRef((jweak)jthis_); - jthis_ = jenv->NewGlobalRef(jself); - weak_global_ = false; + else { /* Java releases ownership of C++ object's lifetime */ + if (weak_global_) { + jenv->DeleteWeakGlobalRef((jweak)jthis_); + jthis_ = jenv->NewGlobalRef(jself); + weak_global_ = false; + } } - } } - private: +private: /* pointer to Java object */ jobject jthis_; /* Local or global reference flag */ bool weak_global_; - }; +}; - /* director base class */ - class Director { +/* director base class */ +class Director +{ /* pointer to Java virtual machine */ JavaVM *swig_jvm_; - protected: +protected: #if defined (_MSC_VER) && (_MSC_VER<1300) class JNIEnvWrapper; friend class JNIEnvWrapper; #endif /* Utility class for managing the JNI environment */ - class JNIEnvWrapper { - const Director *director_; - JNIEnv *jenv_; + class JNIEnvWrapper + { + const Director *director_; + JNIEnv *jenv_; public: - JNIEnvWrapper(const Director *director) : director_(director), jenv_(0) { + JNIEnvWrapper(const Director *director) : director_(director), jenv_(0) { #if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON) - // Attach a daemon thread to the JVM. Useful when the JVM should not wait for - // the thread to exit upon shutdown. Only for jdk-1.4 and later. - director_->swig_jvm_->AttachCurrentThreadAsDaemon((JNIEnv **) &jenv_, NULL); + // Attach a daemon thread to the JVM. Useful when the JVM should not wait for + // the thread to exit upon shutdown. Only for jdk-1.4 and later. + director_->swig_jvm_->AttachCurrentThreadAsDaemon((JNIEnv **) &jenv_, NULL); #else - director_->swig_jvm_->AttachCurrentThread((JNIEnv **) &jenv_, NULL); + director_->swig_jvm_->AttachCurrentThread((JNIEnv **) &jenv_, NULL); #endif - } - ~JNIEnvWrapper() { + } + ~JNIEnvWrapper() { #if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) - // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. - // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. - director_->swig_jvm_->DetachCurrentThread(); + // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. + // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. + director_->swig_jvm_->DetachCurrentThread(); #endif - } - JNIEnv *getJNIEnv() const { - return jenv_; - } + } + JNIEnv *getJNIEnv() const { + return jenv_; + } }; /* Java object wrapper */ @@ -352,48 +386,48 @@ namespace Swig { /* Disconnect director from Java object */ void swig_disconnect_director_self(const char *disconn_method) { - JNIEnvWrapper jnienv(this) ; - JNIEnv *jenv = jnienv.getJNIEnv() ; - jobject jobj = swig_self_.peek(); + JNIEnvWrapper jnienv(this) ; + JNIEnv *jenv = jnienv.getJNIEnv() ; + jobject jobj = swig_self_.peek(); #if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl; + std::cout << "Swig::Director::disconnect_director_self(" << jobj << ")" << std::endl; #endif - if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) { - jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V"); - if (disconn_meth) { + if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) { + jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method, "()V"); + if (disconn_meth) { #if defined(DEBUG_DIRECTOR_OWNED) - std::cout << "Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl; + std::cout << "Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl; #endif - jenv->CallVoidMethod(jobj, disconn_meth); + jenv->CallVoidMethod(jobj, disconn_meth); + } } - } } - public: +public: Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() { - /* Acquire the Java VM pointer */ - jenv->GetJavaVM(&swig_jvm_); + /* Acquire the Java VM pointer */ + jenv->GetJavaVM(&swig_jvm_); } virtual ~Director() { - JNIEnvWrapper jnienv(this) ; - JNIEnv *jenv = jnienv.getJNIEnv() ; - swig_self_.release(jenv); + JNIEnvWrapper jnienv(this) ; + JNIEnv *jenv = jnienv.getJNIEnv() ; + swig_self_.release(jenv); } bool swig_set_self(JNIEnv *jenv, jobject jself, bool mem_own, bool weak_global) { - return swig_self_.set(jenv, jself, mem_own, weak_global); + return swig_self_.set(jenv, jself, mem_own, weak_global); } jobject swig_get_self(JNIEnv *jenv) const { - return swig_self_.get(jenv); + return swig_self_.get(jenv); } // Change C++ object's ownership, relative to Java void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) { - swig_self_.java_change_ownership(jenv, jself, take_or_release); + swig_self_.java_change_ownership(jenv, jself, take_or_release); } - }; +}; } #endif /* __cplusplus */ @@ -418,81 +452,85 @@ namespace Swig { extern "C" { #endif -SWIGEXPORT jlong JNICALL Java_org_doubango_utils_utilsJNI_new_1AndroidUtils(JNIEnv *jenv, jclass jcls) { - jlong jresult = 0 ; - AndroidUtils *result = 0 ; - - (void)jenv; - (void)jcls; - result = (AndroidUtils *)new AndroidUtils(); - *(AndroidUtils **)&jresult = result; - return jresult; +SWIGEXPORT jlong JNICALL Java_org_doubango_utils_utilsJNI_new_1AndroidUtils(JNIEnv *jenv, jclass jcls) +{ + jlong jresult = 0 ; + AndroidUtils *result = 0 ; + + (void)jenv; + (void)jcls; + result = (AndroidUtils *)new AndroidUtils(); + *(AndroidUtils **)&jresult = result; + return jresult; } -SWIGEXPORT void JNICALL Java_org_doubango_utils_utilsJNI_delete_1AndroidUtils(JNIEnv *jenv, jclass jcls, jlong jarg1) { - AndroidUtils *arg1 = (AndroidUtils *) 0 ; - - (void)jenv; - (void)jcls; - arg1 = *(AndroidUtils **)&jarg1; - delete arg1; +SWIGEXPORT void JNICALL Java_org_doubango_utils_utilsJNI_delete_1AndroidUtils(JNIEnv *jenv, jclass jcls, jlong jarg1) +{ + AndroidUtils *arg1 = (AndroidUtils *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(AndroidUtils **)&jarg1; + delete arg1; } -SWIGEXPORT jobject JNICALL Java_org_doubango_utils_utilsJNI_AndroidUtils_1getCpuFamily(JNIEnv *jenv, jclass jcls) { - jobject jresult = 0 ; - uint64_t result; - - (void)jenv; - (void)jcls; - result = (uint64_t)AndroidUtils::getCpuFamily(); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); +SWIGEXPORT jobject JNICALL Java_org_doubango_utils_utilsJNI_AndroidUtils_1getCpuFamily(JNIEnv *jenv, jclass jcls) +{ + jobject jresult = 0 ; + uint64_t result; + + (void)jenv; + (void)jcls; + result = (uint64_t)AndroidUtils::getCpuFamily(); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jresult = bigint; } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jresult = bigint; - } - return jresult; + return jresult; } -SWIGEXPORT jobject JNICALL Java_org_doubango_utils_utilsJNI_AndroidUtils_1getCpuFeatures(JNIEnv *jenv, jclass jcls) { - jobject jresult = 0 ; - uint64_t result; - - (void)jenv; - (void)jcls; - result = (uint64_t)AndroidUtils::getCpuFeatures(); - { - jbyteArray ba = jenv->NewByteArray(9); - jbyte* bae = jenv->GetByteArrayElements(ba, 0); - jclass clazz = jenv->FindClass("java/math/BigInteger"); - jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V"); - jobject bigint; - int i; - - bae[0] = 0; - for(i=1; i<9; i++ ) { - bae[i] = (jbyte)(result>>8*(8-i)); +SWIGEXPORT jobject JNICALL Java_org_doubango_utils_utilsJNI_AndroidUtils_1getCpuFeatures(JNIEnv *jenv, jclass jcls) +{ + jobject jresult = 0 ; + uint64_t result; + + (void)jenv; + (void)jcls; + result = (uint64_t)AndroidUtils::getCpuFeatures(); + { + jbyteArray ba = jenv->NewByteArray(9); + jbyte* bae = jenv->GetByteArrayElements(ba, 0); + jclass clazz = jenv->FindClass("java/math/BigInteger"); + jmethodID mid = jenv->GetMethodID(clazz, "<init>", "([B)V"); + jobject bigint; + int i; + + bae[0] = 0; + for(i=1; i<9; i++ ) { + bae[i] = (jbyte)(result>>8*(8-i)); + } + + jenv->ReleaseByteArrayElements(ba, bae, 0); + bigint = jenv->NewObject(clazz, mid, ba); + jresult = bigint; } - - jenv->ReleaseByteArrayElements(ba, bae, 0); - bigint = jenv->NewObject(clazz, mid, ba); - jresult = bigint; - } - return jresult; + return jresult; } diff --git a/android-utils/utils_wrap.h b/android-utils/utils_wrap.h index 9cc67f4..028f9a7 100755 --- a/android-utils/utils_wrap.h +++ b/android-utils/utils_wrap.h @@ -1,11 +1,11 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 2.0.4 - * - * This file is not intended to be easily readable and contains a number of + * + * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. * ----------------------------------------------------------------------------- */ #ifndef SWIG_utils_WRAP_H_ diff --git a/bindings/_common/ActionConfig.cxx b/bindings/_common/ActionConfig.cxx index 0c1f9a4..35628ed 100755 --- a/bindings/_common/ActionConfig.cxx +++ b/bindings/_common/ActionConfig.cxx @@ -2,19 +2,19 @@ * Copyright (C) 2010-2011 Mamadou Diop. * * Contact: Mamadou Diop <diopmamadou(at)doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ @@ -23,66 +23,66 @@ ActionConfig::ActionConfig() { - m_pHandle = tsip_action_create(tsip_atype_config, - TSIP_ACTION_SET_NULL()); + m_pHandle = tsip_action_create(tsip_atype_config, + TSIP_ACTION_SET_NULL()); } ActionConfig::~ActionConfig() { - TSK_OBJECT_SAFE_FREE(m_pHandle); + TSK_OBJECT_SAFE_FREE(m_pHandle); } bool ActionConfig::addHeader(const char* name, const char* value) { - return (tsip_action_set(m_pHandle, - TSIP_ACTION_SET_HEADER(name, value), - TSIP_ACTION_SET_NULL()) == 0); + return (tsip_action_set(m_pHandle, + TSIP_ACTION_SET_HEADER(name, value), + TSIP_ACTION_SET_NULL()) == 0); } bool ActionConfig::addPayload(const void* payload, unsigned len) { - return (tsip_action_set(m_pHandle, - TSIP_ACTION_SET_PAYLOAD(payload, len), - TSIP_ACTION_SET_NULL()) == 0); + return (tsip_action_set(m_pHandle, + TSIP_ACTION_SET_PAYLOAD(payload, l |