diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2015-05-05 15:52:01 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2015-05-05 15:52:01 -0230 |
commit | b61582b1c6b16be4339aa0bded3ad8f542a01df9 (patch) | |
tree | 2040386a942217e2412e48c1e56465817ecac3d5 /ruby/src/IceRuby/Endpoint.cpp | |
parent | Missing export declarations (diff) | |
download | ice-b61582b1c6b16be4339aa0bded3ad8f542a01df9.tar.bz2 ice-b61582b1c6b16be4339aa0bded3ad8f542a01df9.tar.xz ice-b61582b1c6b16be4339aa0bded3ad8f542a01df9.zip |
ICE-6471 Add support for IceSSL endpoint/connection info to Python/Ruby/PHP
Diffstat (limited to 'ruby/src/IceRuby/Endpoint.cpp')
-rw-r--r-- | ruby/src/IceRuby/Endpoint.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/ruby/src/IceRuby/Endpoint.cpp b/ruby/src/IceRuby/Endpoint.cpp index c6f8d8565e3..cad2ba3ba44 100644 --- a/ruby/src/IceRuby/Endpoint.cpp +++ b/ruby/src/IceRuby/Endpoint.cpp @@ -10,6 +10,7 @@ #include <Endpoint.h> #include <Util.h> #include <Ice/Object.h> +#include <IceSSL/EndpointInfo.h> using namespace std; using namespace IceRuby; @@ -22,6 +23,8 @@ static VALUE _tcpEndpointInfoClass; static VALUE _udpEndpointInfoClass; static VALUE _wsEndpointInfoClass; static VALUE _opaqueEndpointInfoClass; +static VALUE _sslEndpointInfoClass; +static VALUE _wssEndpointInfoClass; // ********************************************************************** // Endpoint @@ -170,6 +173,25 @@ IceRuby::createEndpointInfo(const Ice::EndpointInfoPtr& p) rb_ivar_set(info, rb_intern("@rawBytes"), v); rb_ivar_set(info, rb_intern("@rawEncoding"), createEncodingVersion(opaque->rawEncoding)); } + else if(IceSSL::WSSEndpointInfoPtr::dynamicCast(p)) + { + info = Data_Wrap_Struct(_wssEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); + + IceSSL::WSSEndpointInfoPtr wss = IceSSL::WSSEndpointInfoPtr::dynamicCast(p); + rb_ivar_set(info, rb_intern("@host"), createString(wss->host)); + rb_ivar_set(info, rb_intern("@port"), INT2FIX(wss->port)); + rb_ivar_set(info, rb_intern("@sourceAddress"), createString(wss->sourceAddress)); + rb_ivar_set(info, rb_intern("@resource"), createString(wss->resource)); + } + else if(IceSSL::EndpointInfoPtr::dynamicCast(p)) + { + info = Data_Wrap_Struct(_sslEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); + + IceSSL::EndpointInfoPtr ssl = IceSSL::EndpointInfoPtr::dynamicCast(p); + rb_ivar_set(info, rb_intern("@host"), createString(ssl->host)); + rb_ivar_set(info, rb_intern("@port"), INT2FIX(ssl->port)); + rb_ivar_set(info, rb_intern("@sourceAddress"), createString(ssl->sourceAddress)); + } else if(Ice::IPEndpointInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_ipEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); @@ -183,6 +205,7 @@ IceRuby::createEndpointInfo(const Ice::EndpointInfoPtr& p) { info = Data_Wrap_Struct(_endpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); } + rb_ivar_set(info, rb_intern("@timeout"), INT2FIX(p->timeout)); rb_ivar_set(info, rb_intern("@compress"), p->compress ? Qtrue : Qfalse); return info; @@ -306,7 +329,7 @@ IceRuby::initEndpoint(VALUE iceModule) // // WSEndpointInfo // - _wsEndpointInfoClass = rb_define_class_under(iceModule, "WSEndpointInfo", _ipEndpointInfoClass); + _wsEndpointInfoClass = rb_define_class_under(iceModule, "WSEndpointInfo", _tcpEndpointInfoClass); // // Instance members. @@ -323,6 +346,21 @@ IceRuby::initEndpoint(VALUE iceModule) // rb_define_attr(_opaqueEndpointInfoClass, "rawBytes", 1, 0); rb_define_attr(_opaqueEndpointInfoClass, "rawEncoding", 1, 0); + + // + // SSLEndpointInfo + // + _sslEndpointInfoClass = rb_define_class_under(iceModule, "SSLEndpointInfo", _ipEndpointInfoClass); + + // + // WSSEndpointInfo + // + _wssEndpointInfoClass = rb_define_class_under(iceModule, "WSSEndpointInfo", _sslEndpointInfoClass); + + // + // Instance members. + // + rb_define_attr(_wssEndpointInfoClass, "resource", 1, 0); } bool |