diff --git a/src/TCCIPsec.cc b/src/TCCIPsec.cc index 5c8255bdcafa32cb6232cb6d51c75fea2a0ca462..cd2ab252e5981cc7486e17aedde3dd14aa739067 100644 --- a/src/TCCIPsec.cc +++ b/src/TCCIPsec.cc @@ -121,7 +121,7 @@ class PfKey } public: - PfKey () throw ( Error ) { + PfKey () { if (sd < 0){ sd = socket ( PF_KEY, SOCK_RAW, PF_KEY_V2 ); if ( sd < 0 ) { @@ -137,7 +137,7 @@ public: ~PfKey () { /*close ( sd );*/ } unsigned int getSeq () { return TCCIPsec_PfKey_seq; } - int receive ( ) throw ( Error ) { + int receive ( ) { for (;;) { int r = recv ( sd, rdBuf, sizeof ( rdBuf ), MSG_DONTWAIT ); // #ED note: MSG_WAITALL seem to return EINVAL (Invalid Argument) if ( r < 0 ) { @@ -165,7 +165,7 @@ public: } } - void send ( const void * data, size_t len ) throw ( Error ) { + void send ( const void * data, size_t len ) { while ( len > 0 ) { dump ( "TCCIPsec: PfKey::send: ", data, len ); int r = ::send ( sd, data, len, MSG_DONTWAIT ); @@ -184,7 +184,7 @@ public: } } - void checkAnswer () throw ( Error ) { + void checkAnswer () { int r = 0; for ( int i = 1;; ++i ) { r = receive ( ); @@ -242,7 +242,7 @@ int setAddressPart ( void * buf, unsigned short type, const char * address, int prefixLen = c__TCCIPsec__prefixAll, int proto = TCCIPsec__TranspProto::anyTranspProto, int port = c__TCCIPsec__anyPort - ) throw ( Error ) + ) { sockaddr_in sockAddr; memset ( & sockAddr, 0, sizeof ( sockAddr ) ); @@ -279,19 +279,18 @@ int setAddressPart ( void * buf, unsigned short type, const char * address, return len64 * 8 ; } -int castKey ( const TCCIPsec__Key & keyIn, char * key) throw ( Error ) +int castKey ( const TCCIPsec__Key & keyIn, char * key) { int len = 0; switch ( keyIn.get_selection() ) { case TCCIPsec__Key::ALT_hex:{ - unsigned char *hexkey = (unsigned char*)(const unsigned char*)hex2oct(keyIn.hex()); len = keyIn.hex().lengthof()/2; - memcpy(key, hexkey, len); + memcpy(key, (const unsigned char*)hex2oct(keyIn.hex()), len); break; } case TCCIPsec__Key::ALT_text: - key = (char*)(const char*) ( keyIn.text() ); len = keyIn.text().lengthof (); + memcpy(key, (const char*)(keyIn.text()), len); break; default: throw Error ( TCCIPsec__Result::parameterInvalid ); @@ -316,7 +315,7 @@ void f__IPsec__setParityBits(unsigned char *data, int l){ } } -inline unsigned short ipSecModeToIPMode ( const TCCIPsec__IPsecMode & ipSecMode ) throw ( Error ) { +inline unsigned short ipSecModeToIPMode ( const TCCIPsec__IPsecMode & ipSecMode ) { switch ( (int) ipSecMode ) { case TCCIPsec__IPsecMode::anyMode: return IPSEC_MODE_ANY; case TCCIPsec__IPsecMode::transport: return IPSEC_MODE_TRANSPORT; @@ -644,7 +643,7 @@ TCCIPsec__Result f__IPsec__SADB__flush () #if defined USE_KAME_IPSEC -inline unsigned short ipSecProtoToIPProto ( const TCCIPsec__Protocol & ipSecProto ) throw ( Error ) { +inline unsigned short ipSecProtoToIPProto ( const TCCIPsec__Protocol & ipSecProto ) { switch ( (int) ipSecProto ) { case TCCIPsec__Protocol::esp: return IPPROTO_ESP; case TCCIPsec__Protocol::ah: return IPPROTO_AH; @@ -654,7 +653,7 @@ inline unsigned short ipSecProtoToIPProto ( const TCCIPsec__Protocol & ipSecProt } inline unsigned char ipSecRuleLevelToLevel ( const TCCIPsec__RuleLevel & ipSecRuleLevel, - int * id ) throw ( Error ) { + int * id ) { switch ( ipSecRuleLevel.get_selection () ) { case TCCIPsec__RuleLevel::ALT_defaultLevel: return IPSEC_LEVEL_DEFAULT; case TCCIPsec__RuleLevel::ALT_use: return IPSEC_LEVEL_USE;