You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by fi...@apache.org on 2011/07/21 18:10:41 UTC

svn commit: r1149250 - in /incubator/etch/branches/singlestack/binding-c: compiler/src/main/resources/org/apache/etch/bindings/c/compiler/ runtime/c/include/ runtime/c/src/main/support/

Author: fitzner
Date: Thu Jul 21 16:10:35 2011
New Revision: 1149250

URL: http://svn.apache.org/viewvc?rev=1149250&view=rev
Log:
ETCH-157 binding-c: extend send()/sendex() for etch_who

Needed to provide the recipient address when sending signals from server to clients. Previously this wasn't necessary, because server instances were only connected with one client and the address of the client could be stored in the Connection instance.

Patch is from Aleksandar Kanchev <ka...@itestra.com>

Modified:
    incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_c.vm
    incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_h.vm
    incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_h.vm
    incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_server_c.vm
    incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_remote.h
    incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_svcobj_masks.h
    incubator/etch/branches/singlestack/binding-c/runtime/c/src/main/support/etch_remote.c

Modified: incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_c.vm
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_c.vm?rev=1149250&r1=1149249&r2=1149250&view=diff
==============================================================================
--- incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_c.vm (original)
+++ incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_c.vm Thu Jul 21 16:10:35 2011
@@ -405,6 +405,7 @@ $sb
  * @param thisx this.
  * @param x etch_int32* caller relinquishes.
  * @param y etch_int32* caller relinquishes.
+ * @param whoto recipient, caller owns it.
  * @return mailbox to receive async result. caller owns it. it may be null.
  * @remarks note that we use the putc version of message.put(), wherein we pass
  * a *reference* to the value object's pointer, and message.putc() nulls out  
@@ -419,7 +420,7 @@ $sb
 #foreach( $p in $n.iterator() )
 #set ( $sb = "$sb, $helper.getTypeName($p.type()) $p.name()")
 #end
-#set ($sb = "$sb)")
+#set ($sb = "$sb, etch_who* whoto)")
 $sb
 {
     $helper.getRemoteName($intf, $suffix)* remote = ($helper.getRemoteName($intf, $suffix)*)thisx;
@@ -439,7 +440,7 @@ $sb
 #end
 
         /* fyi msg memory is relinquished here regardless of result */ 
-        _resultobj = remote->remote_base->sendex (remote->remote_base, _msg);
+        _resultobj = remote->remote_base->sendex (remote->remote_base, _msg, whoto);
         _msg = NULL;
 
     } while(0);
@@ -485,7 +486,7 @@ $sb
 #foreach( $p in $n.iterator() )
 #set ( $sb = "$sb, $p.name()")
 #end
-#set ($sb = "$sb);")
+#set ($sb = "$sb, NULL);")
     $sb
 
     return _resultobj;

Modified: incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_h.vm?rev=1149250&r1=1149249&r2=1149250&view=diff
==============================================================================
--- incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_h.vm (original)
+++ incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_client_h.vm Thu Jul 21 16:10:35 2011
@@ -50,7 +50,7 @@ extern unsigned short CLASSID_$helper.ge
 #foreach( $p in $n.iterator() )
 #set ( $sb = "$sb, $helper.getTypeName($p.type()) $p.name()")
 #end
-#set ($sb = "$sb)")
+#set ($sb = "$sb, etch_who* whoto)")
 $sb;
 $helper.getPointerTypeName($n.type()) $helper.getRemoteName($intf, "")_end_client_$n.name() (void* thisAsVoid, i_mailbox* ibox);
 #set ($sb = "$helper.getPointerTypeName($n.type()) $helper.getRemoteName($intf, '')_client_$n.name()(void* thisAsVoid")

Modified: incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_h.vm?rev=1149250&r1=1149249&r2=1149250&view=diff
==============================================================================
--- incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_h.vm (original)
+++ incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_h.vm Thu Jul 21 16:10:35 2011
@@ -56,8 +56,8 @@ typedef struct $helper.getRemoteName($in
     unsigned short unused;      /* alignment */
 
     etch_message* (*new_message) (void*, etch_type*);
-    int   (*send)   (void*, etch_message*);
-    void* (*sendex) (void*, etch_message*);
+    int   (*send)   (void*, etch_message*, etch_who*);
+    void* (*sendex) (void*, etch_message*, etch_who*);
     etch_delivsvc_begincall begin_call;  /* i_mailbox** out */
     etch_delvisvc_endcall   end_call;    /* etch_object** out */
 

Modified: incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_server_c.vm
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_server_c.vm?rev=1149250&r1=1149249&r2=1149250&view=diff
==============================================================================
--- incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_server_c.vm (original)
+++ incubator/etch/branches/singlestack/binding-c/compiler/src/main/resources/org/apache/etch/bindings/c/compiler/remote_server_c.vm Thu Jul 21 16:10:35 2011
@@ -394,6 +394,7 @@ $sb
  * @param thisx this.
  * @param x etch_int32* caller relinquishes.
  * @param y etch_int32* caller relinquishes.
+ * @param whoto recipient, caller owns it.
  * @return mailbox to receive async result. caller owns it. it may be null.
  * @remarks note that we use the putc version of message.put(), wherein we pass
  * a *reference* to the value object's pointer, and message.putc() nulls out  
@@ -434,7 +435,7 @@ $sb
 
         /* fyi msg memory is relinquished here regardless of result */ 
         /* fyi msg memory is relinquished here regardless of result */ 
-        _resultobj = thisx->remote_base->sendex (thisx->remote_base, _msg);
+        _resultobj = thisx->remote_base->sendex (thisx->remote_base, _msg, NULL);
         _msg = NULL;
 
     } while(0);

Modified: incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_remote.h
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_remote.h?rev=1149250&r1=1149249&r2=1149250&view=diff
==============================================================================
--- incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_remote.h (original)
+++ incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_remote.h Thu Jul 21 16:10:35 2011
@@ -50,8 +50,8 @@ int etchremote_transport_control (void* 
 int etchremote_transport_notify  (void* data, etch_event* evt);
 etch_object* etchremote_transport_query (void* data, etch_query* query);
 etch_message* etchremote_new_message (void* data, etch_type* message_type);
-int etchremote_send (void* data, etch_message* msg);
-void* etchremote_sendex (void* data, etch_message* msg);
+int etchremote_send (void* data, etch_message* msg, etch_who* whoto);
+void* etchremote_sendex (void* data, etch_message* msg, etch_who* whoto);
 int etchremote_begincall (void* data, etch_message* msg, void** out);
 int etchremote_endcall (void* data, i_mailbox* mbox, etch_type* response_type, void** out);
 

Modified: incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_svcobj_masks.h
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_svcobj_masks.h?rev=1149250&r1=1149249&r2=1149250&view=diff
==============================================================================
--- incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_svcobj_masks.h (original)
+++ incubator/etch/branches/singlestack/binding-c/runtime/c/include/etch_svcobj_masks.h Thu Jul 21 16:10:35 2011
@@ -137,8 +137,8 @@ typedef struct xxxx_remote
     unsigned short unused;      /* alignment */
 
     etch_message* (*new_message) (void*, etch_type*);
-    int   (*send)   (void*, etch_message*);
-    void* (*sendex) (void*, etch_message*);
+    int   (*send)   (void*, etch_message*, etch_who*);
+    void* (*sendex) (void*, etch_message*, etch_who*);
     etch_delivsvc_begincall begin_call;  /* i_mailbox** out */
     etch_delvisvc_endcall   end_call;    /* etch_object** out */
 

Modified: incubator/etch/branches/singlestack/binding-c/runtime/c/src/main/support/etch_remote.c
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/binding-c/runtime/c/src/main/support/etch_remote.c?rev=1149250&r1=1149249&r2=1149250&view=diff
==============================================================================
--- incubator/etch/branches/singlestack/binding-c/runtime/c/src/main/support/etch_remote.c (original)
+++ incubator/etch/branches/singlestack/binding-c/runtime/c/src/main/support/etch_remote.c Thu Jul 21 16:10:35 2011
@@ -72,15 +72,16 @@ etch_message* etchremote_new_message (vo
  * sends message to recipient without waiting for a response.
  * @param thisx this remote object.
  * @param msg message, caller relinquishes.
+ * @param whoto message receiver.
  * @return 0 success, -1 failure.
  */
-int etchremote_send (void* data, etch_message* msg)
+int etchremote_send (void* data, etch_message* msg, etch_who* whoto)
 {
     xxxx_remote* thisx = (xxxx_remote*)data;
     int result = 0;
     ETCH_ASSERT(is_etch_remote(thisx));
     
-    result = thisx->dsvc->itm->transport_message(thisx->dsvc, NULL, msg);
+    result = thisx->dsvc->itm->transport_message(thisx->dsvc, whoto, msg);
 
     if (0 != result)
         ETCH_LOG(LOG_CATEGORY, ETCH_LOG_ERROR, "remote server send failed for msg %x\n", msg);
@@ -94,14 +95,15 @@ int etchremote_send (void* data, etch_me
  * sends message to recipient without waiting for a response.
  * @param thisx this remote object.
  * @param msg message, caller relinquishes.
+ * @param whoto message receiver.
  * @return NULL or exception
  */
-void* etchremote_sendex (void* data, etch_message* msg)
+void* etchremote_sendex (void* data, etch_message* msg, etch_who* whoto)
 {
     xxxx_remote* thisx = (xxxx_remote*)data;
     etch_object* resultobj = NULL;
 
-    if (0 != etchremote_send (thisx, msg)){
+    if (0 != etchremote_send (thisx, msg, whoto)){
         etch_object_destroy(resultobj);
         resultobj = (etch_object*)new_etch_exception_from_errorcode(ETCH_EIO);