bindings/ruby/rblm-connection.c
changeset 386 d4549fc19801
parent 376 d54d6310c136
child 387 39e105c72094
equal deleted inserted replaced
385:b27d2a2b37a1 386:d4549fc19801
     3 
     3 
     4 VALUE lm_cConnection;
     4 VALUE lm_cConnection;
     5 
     5 
     6 VALUE conn_set_server (VALUE self, VALUE server);
     6 VALUE conn_set_server (VALUE self, VALUE server);
     7 
     7 
     8 static LmConnection *
     8 LmConnection *
     9 rb_lm_connection_from_ruby_object (VALUE obj)
     9 rb_lm_connection_from_ruby_object (VALUE obj)
    10 {
    10 {
    11 	LmConnection *conn;
    11 	LmConnection *conn;
    12 
    12 
    13 	if (!rb_lm__is_kind_of (obj, lm_cConnection)) {
    13 	if (!rb_lm__is_kind_of (obj, lm_cConnection)) {
   204 	LmConnection *conn = rb_lm_connection_from_ruby_object (self);
   204 	LmConnection *conn = rb_lm_connection_from_ruby_object (self);
   205 
   205 
   206 	lm_connection_set_port (conn, NUM2UINT (port));
   206 	lm_connection_set_port (conn, NUM2UINT (port));
   207 
   207 
   208 	return Qnil;
   208 	return Qnil;
       
   209 }
       
   210 
       
   211 VALUE
       
   212 conn_send (VALUE self, VALUE msg)
       
   213 {
       
   214 	LmConnection *conn = rb_lm_connection_from_ruby_object (self);
       
   215 	LmMessage    *m = rb_lm_message_from_ruby_object (msg);
       
   216 
       
   217 	return GBOOL2RVAL (lm_connection_send (conn, m, NULL));
   209 }
   218 }
   210 
   219 
   211 VALUE
   220 VALUE
   212 conn_get_state (VALUE self)
   221 conn_get_state (VALUE self)
   213 {
   222 {
   245 	rb_define_method (lm_cConnection, "proxy", conn_get_proxy, 0);
   254 	rb_define_method (lm_cConnection, "proxy", conn_get_proxy, 0);
   246 	rb_define_method (lm_cConnection, "proxy=", conn_set_proxy, 1);
   255 	rb_define_method (lm_cConnection, "proxy=", conn_set_proxy, 1);
   247 	*/
   256 	*/
   248 
   257 
   249 	/* Use one send message and check if there is a block passed? */
   258 	/* Use one send message and check if there is a block passed? */
       
   259 	
       
   260 	rb_define_method (lm_cConnection, "send", conn_send, 1);
   250 	/*
   261 	/*
   251 	rb_define_method (lm_cConnection, "send", conn_send, 1);
       
   252 	rb_define_method (lm_cConnection, "send_with_reply", conn_send_with_reply, -1);
   262 	rb_define_method (lm_cConnection, "send_with_reply", conn_send_with_reply, -1);
   253 	rb_define_method (lm_cConnection, "send_raw", conn_send_raw, 1);
   263 	rb_define_method (lm_cConnection, "send_raw", conn_send_raw, 1);
   254 	*/
   264 	*/
   255 
   265 
   256 	rb_define_method (lm_cConnection, "state", conn_get_state, 0);
   266 	rb_define_method (lm_cConnection, "state", conn_get_state, 0);