diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2015-02-17 15:49:00 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2015-02-17 15:49:00 -0330 |
commit | bfb35f122ecb429cf9d869f0331b0899f7b18fe8 (patch) | |
tree | f72951c29ecd08d9f34b0c0da47e3056959444ad /rb/src | |
parent | Fixed (ICE-5740) - IcePatch2 has issues with 'large' files. (diff) | |
download | ice-bfb35f122ecb429cf9d869f0331b0899f7b18fe8.tar.bz2 ice-bfb35f122ecb429cf9d869f0331b0899f7b18fe8.tar.xz ice-bfb35f122ecb429cf9d869f0331b0899f7b18fe8.zip |
ICE-6313 Add Python/Ruby/PHP support for WSEndpointInfo / WSConnectionInfo
Diffstat (limited to 'rb/src')
-rw-r--r-- | rb/src/IceRuby/Connection.cpp | 52 | ||||
-rw-r--r-- | rb/src/IceRuby/Endpoint.cpp | 21 |
2 files changed, 62 insertions, 11 deletions
diff --git a/rb/src/IceRuby/Connection.cpp b/rb/src/IceRuby/Connection.cpp index 93f31c0868d..be856f508e2 100644 --- a/rb/src/IceRuby/Connection.cpp +++ b/rb/src/IceRuby/Connection.cpp @@ -22,6 +22,7 @@ static VALUE _connectionInfoClass; static VALUE _ipConnectionInfoClass; static VALUE _tcpConnectionInfoClass; static VALUE _udpConnectionInfoClass; +static VALUE _wsConnectionInfoClass; // ********************************************************************** // Connection @@ -295,6 +296,25 @@ IceRuby::createConnectionInfo(const Ice::ConnectionInfoPtr& p) rb_ivar_set(info, rb_intern("@mcastAddress"), createString(udp->mcastAddress)); rb_ivar_set(info, rb_intern("@mcastPort"), INT2FIX(udp->mcastPort)); } + else if(Ice::WSConnectionInfoPtr::dynamicCast(p)) + { + info = Data_Wrap_Struct(_wsConnectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); + + Ice::WSConnectionInfoPtr ws = Ice::WSConnectionInfoPtr::dynamicCast(p); + rb_ivar_set(info, rb_intern("@localAddress"), createString(ws->localAddress)); + rb_ivar_set(info, rb_intern("@localPort"), INT2FIX(ws->localPort)); + rb_ivar_set(info, rb_intern("@remoteAddress"), createString(ws->remoteAddress)); + rb_ivar_set(info, rb_intern("@remotePort"), INT2FIX(ws->remotePort)); + + volatile VALUE result = callRuby(rb_hash_new); + for(Ice::HeaderDict::const_iterator q = ws->headers.begin(); q != ws->headers.end(); ++q) + { + volatile VALUE key = createString(q->first); + volatile VALUE value = createString(q->second); + callRuby(rb_hash_aset, result, key, value); + } + rb_ivar_set(info, rb_intern("@headers"), result); + } else if(Ice::IPConnectionInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_ipConnectionInfoClass, 0, IceRuby_ConnectionInfo_free, new Ice::ConnectionInfoPtr(p)); @@ -345,10 +365,10 @@ IceRuby::initConnection(VALUE iceModule) _connectionInfoClass = rb_define_class_under(iceModule, "ConnectionInfo", rb_cObject); // - // Instance members. + // Instance members. // - rb_define_attr(_connectionInfoClass, "incoming", 1, 0); - rb_define_attr(_connectionInfoClass, "adapterName", 1, 0); + rb_define_attr(_connectionInfoClass, "incoming", 1, 0); + rb_define_attr(_connectionInfoClass, "adapterName", 1, 0); // // IPConnectionInfo @@ -356,12 +376,12 @@ IceRuby::initConnection(VALUE iceModule) _ipConnectionInfoClass = rb_define_class_under(iceModule, "IPConnectionInfo", _connectionInfoClass); // - // Instance members. + // Instance members. // - rb_define_attr(_ipConnectionInfoClass, "localAddress", 1, 0); - rb_define_attr(_ipConnectionInfoClass, "localPort", 1, 0); - rb_define_attr(_ipConnectionInfoClass, "remoteAddress", 1, 0); - rb_define_attr(_ipConnectionInfoClass, "remotePort", 1, 0); + rb_define_attr(_ipConnectionInfoClass, "localAddress", 1, 0); + rb_define_attr(_ipConnectionInfoClass, "localPort", 1, 0); + rb_define_attr(_ipConnectionInfoClass, "remoteAddress", 1, 0); + rb_define_attr(_ipConnectionInfoClass, "remotePort", 1, 0); // // TCPConnectionInfo @@ -374,8 +394,18 @@ IceRuby::initConnection(VALUE iceModule) _udpConnectionInfoClass = rb_define_class_under(iceModule, "UDPConnectionInfo", _ipConnectionInfoClass); // - // Instance members. + // Instance members. + // + rb_define_attr(_udpConnectionInfoClass, "mcastAddress", 1, 0); + rb_define_attr(_udpConnectionInfoClass, "mcastPort", 1, 0); + + // + // WSConnectionInfo + // + _wsConnectionInfoClass = rb_define_class_under(iceModule, "WSConnectionInfo", _ipConnectionInfoClass); + + // + // Instance members. // - rb_define_attr(_udpConnectionInfoClass, "mcastAddress", 1, 0); - rb_define_attr(_udpConnectionInfoClass, "mcastPort", 1, 0); + //rb_define_attr(_wsConnectionInfoClass, "headers", 1, 0); } diff --git a/rb/src/IceRuby/Endpoint.cpp b/rb/src/IceRuby/Endpoint.cpp index e2a31f0242e..c44585c5db8 100644 --- a/rb/src/IceRuby/Endpoint.cpp +++ b/rb/src/IceRuby/Endpoint.cpp @@ -20,6 +20,7 @@ static VALUE _endpointInfoClass; static VALUE _ipEndpointInfoClass; static VALUE _tcpEndpointInfoClass; static VALUE _udpEndpointInfoClass; +static VALUE _wsEndpointInfoClass; static VALUE _opaqueEndpointInfoClass; // ********************************************************************** @@ -149,6 +150,16 @@ IceRuby::createEndpointInfo(const Ice::EndpointInfoPtr& p) rb_ivar_set(info, rb_intern("@mcastInterface"), createString(udp->mcastInterface)); rb_ivar_set(info, rb_intern("@mcastTtl"), INT2FIX(udp->mcastTtl)); } + else if(Ice::WSEndpointInfoPtr::dynamicCast(p)) + { + info = Data_Wrap_Struct(_wsEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); + + Ice::WSEndpointInfoPtr ws = Ice::WSEndpointInfoPtr::dynamicCast(p); + rb_ivar_set(info, rb_intern("@host"), createString(ws->host)); + rb_ivar_set(info, rb_intern("@port"), INT2FIX(ws->port)); + rb_ivar_set(info, rb_intern("@sourceAddress"), createString(ws->sourceAddress)); + rb_ivar_set(info, rb_intern("@resource"), createString(ws->resource)); + } else if(Ice::OpaqueEndpointInfoPtr::dynamicCast(p)) { info = Data_Wrap_Struct(_opaqueEndpointInfoClass, 0, IceRuby_EndpointInfo_free, new Ice::EndpointInfoPtr(p)); @@ -293,6 +304,16 @@ IceRuby::initEndpoint(VALUE iceModule) rb_define_attr(_udpEndpointInfoClass, "mcastTtl", 1, 0); // + // WSEndpointInfo + // + _wsEndpointInfoClass = rb_define_class_under(iceModule, "WSEndpointInfo", _ipEndpointInfoClass); + + // + // Instance members. + // + rb_define_attr(_wsEndpointInfoClass, "resource", 1, 0); + + // // OpaqueEndpointInfo // _opaqueEndpointInfoClass = rb_define_class_under(iceModule, "OpaqueEndpointInfo", _endpointInfoClass); |