--- a/bindings/ruby/rblm-connection.c Thu Apr 10 17:33:43 2008 +0200
+++ b/bindings/ruby/rblm-connection.c Thu Apr 10 18:59:55 2008 +0200
@@ -209,6 +209,44 @@
}
VALUE
+conn_get_ssl (VALUE self)
+{
+ LmConnection *conn = rb_lm_connection_from_ruby_object (self);
+
+ return LMSSL2RVAL (lm_connection_get_ssl (conn));
+}
+
+VALUE
+conn_set_ssl (VALUE self, VALUE ssl_rval)
+{
+ LmConnection *conn = rb_lm_connection_from_ruby_object (self);
+ LmSSL *ssl = rb_lm_ssl_from_ruby_object (ssl_rval);
+
+ lm_connection_set_ssl (conn, ssl);
+
+ return Qnil;
+}
+
+VALUE
+conn_get_proxy (VALUE self)
+{
+ LmConnection *conn = rb_lm_connection_from_ruby_object (self);
+
+ return LMPROXY2RVAL (lm_connection_get_proxy (conn));
+}
+
+VALUE
+conn_set_proxy (VALUE self, VALUE proxy_rval)
+{
+ LmConnection *conn = rb_lm_connection_from_ruby_object (self);
+ LmProxy *proxy = rb_lm_proxy_from_ruby_object (proxy_rval);
+
+ lm_connection_set_proxy (conn, proxy);
+
+ return Qnil;
+}
+
+VALUE
conn_send (VALUE self, VALUE msg)
{
LmConnection *conn = rb_lm_connection_from_ruby_object (self);
@@ -248,12 +286,10 @@
rb_define_method (lm_cConnection, "port", conn_get_port, 0);
rb_define_method (lm_cConnection, "port=", conn_set_port, 1);
- /*
rb_define_method (lm_cConnection, "ssl", conn_get_ssl, 0);
rb_define_method (lm_cConnection, "ssl=", conn_set_ssl, 1);
rb_define_method (lm_cConnection, "proxy", conn_get_proxy, 0);
rb_define_method (lm_cConnection, "proxy=", conn_set_proxy, 1);
- */
/* Use one send message and check if there is a block passed? */
--- a/bindings/ruby/rblm-constants.c Thu Apr 10 17:33:43 2008 +0200
+++ b/bindings/ruby/rblm-constants.c Thu Apr 10 18:59:55 2008 +0200
@@ -132,7 +132,7 @@
response = FIX2INT (obj);
if (response < LM_SSL_RESPONSE_CONTINUE ||
- response < LM_SSL_RESPONSE_STOP) {
+ response > LM_SSL_RESPONSE_STOP) {
rb_raise (rb_eArgError,
"invalid LmSSLResponse: %d (expected %d <= LmSSLResponse <= %d)",
response,
--- a/bindings/ruby/rblm-private.h Thu Apr 10 17:33:43 2008 +0200
+++ b/bindings/ruby/rblm-private.h Thu Apr 10 18:59:55 2008 +0200
@@ -10,10 +10,14 @@
#define RVAL2GBOOL(x) RTEST(x)
#define LMMESSAGENODE2RVAL(x) (rb_lm_message_node_to_ruby_object(x))
+#define LMSSL2RVAL(x) (rb_lm_ssl_to_ruby_object(x))
+#define LMPROXY2RVAL(x) (rb_lm_proxy_to_ruby_object(x))
gboolean rb_lm__is_kind_of (VALUE object, VALUE klass);
VALUE rb_lm_message_node_to_ruby_object (LmMessageNode *node);
+VALUE rb_lm_ssl_to_ruby_object (LmSSL *ssl);
+VALUE rb_lm_proxy_to_ruby_object (LmProxy *proxy);
LmConnection * rb_lm_connection_from_ruby_object (VALUE obj);
LmMessage * rb_lm_message_from_ruby_object (VALUE obj);
--- a/bindings/ruby/rblm-proxy.c Thu Apr 10 17:33:43 2008 +0200
+++ b/bindings/ruby/rblm-proxy.c Thu Apr 10 18:59:55 2008 +0200
@@ -23,6 +23,17 @@
}
VALUE
+rb_lm_proxy_to_ruby_object (LmProxy *proxy)
+{
+ if (proxy) {
+ lm_proxy_ref (proxy);
+ return Data_Wrap_Struct (lm_cProxy, NULL,
+ proxy_free, proxy);
+ } else {
+ return Qnil;
+ }
+}
+VALUE
proxy_allocate (VALUE klass)
{
return Data_Wrap_Struct (klass, NULL, proxy_free, NULL);
--- a/bindings/ruby/rblm-ssl.c Thu Apr 10 17:33:43 2008 +0200
+++ b/bindings/ruby/rblm-ssl.c Thu Apr 10 18:59:55 2008 +0200
@@ -24,6 +24,18 @@
}
VALUE
+rb_lm_ssl_to_ruby_object (LmSSL *ssl)
+{
+ if (ssl) {
+ lm_ssl_ref (ssl);
+ return Data_Wrap_Struct (lm_cSSL, NULL,
+ ssl_free, ssl);
+ } else {
+ return Qnil;
+ }
+}
+
+VALUE
ssl_allocate (VALUE klass)
{
return Data_Wrap_Struct (klass, NULL, ssl_free, NULL);