]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
Added forb_get_req_source()
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 21 Oct 2008 07:17:49 +0000 (09:17 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 21 Oct 2008 07:17:49 +0000 (09:17 +0200)
src/Makefile.omk
src/exec_req.c
src/forb.c
src/forb.h
src/object.h
src/object_type.h

index d9d49feb5dfdfaf22673844c3def9c89a34e3ff3..fa6b407f5a56726cf306a0663e154133283920e3 100644 (file)
@@ -24,6 +24,7 @@ renamed_include_HEADERS += \
        $(call to_forb_subdir, cdr.h) \
        $(call to_forb_subdir, cdr_codec.h) \
        $(call to_forb_subdir, executor.h) \
+       $(call to_forb_subdir, exec_req.h) \
        $(call to_forb_subdir, forb-internal.h) \
        $(call to_forb_subdir, iop.h) \
        $(call to_forb_subdir, object.h) \
index d5f6d963ddf270afc1dfd2b78bfd6fce7b429d43..f6cc16f558956f5254c2ea0b185249bc74c20840 100644 (file)
@@ -83,9 +83,12 @@ void forb_exec_req_process(forb_exec_req_t *exec_req)
 
        env.major = FORB_EX_NONE;
 
-       skeletons = exec_req->obj->interface->skeletons;
+       /* Allow the implementation to know about request details
+        * (e.g. source). */
+       exec_req->obj->exec_req = exec_req;
 
        /* Invoke the skeleton */
+       skeletons = exec_req->obj->interface->skeletons;
        skeletons[exec_req->method_index](&exec_req->codec,
                                         &reply_codec,
                                         exec_req->obj,
index 4853dd6c9472090ce5cc0f48c030b612606a55e9..b37986ed6a1a04b97fab31afb38ed48da8517ffd 100644 (file)
@@ -596,3 +596,24 @@ forb_strerror(CORBA_Environment *env)
 #undef ex
        return "Invalid error number";
 }
+
+/** 
+ * Return server id of the requesting application.
+ *
+ * This function should be only called from within interface
+ * implementation,
+ * 
+ * @param[in] obj Object being requested
+ * @param[out] req_source Server ID of the requesting application
+ */
+void
+forb_get_req_source(const forb_object obj, forb_server_id *req_source)
+{
+       if (req_source) {
+               if (obj && obj->exec_req) {
+                       *req_source = obj->exec_req->source;
+               } else {
+                       memset(req_source, 0, sizeof(*req_source));
+               }
+       }
+}
index 50f370e91aef764b2804e3dfb7a8df45a755768f..0824bb1123f037cca4391fb144a76fa00cc95e93 100644 (file)
@@ -206,7 +206,7 @@ void
 forb_get_server_id(const forb_object obj, forb_server_id *dest);
 
 void
-forb_get_req_source(struct forb_env *env, forb_server_id *req_source);
+forb_get_req_source(const forb_object obj, forb_server_id *req_source);
 
 const char *
 forb_strerror(CORBA_Environment *env);
index 1b0f733cc567d09e7505e4ff244d6ef9e3799826..dc5af81cf107b1527a3a5bc71105a4894126b5ba 100644 (file)
@@ -63,6 +63,7 @@
 #include <forb/refcnt.h>
 #include <forb/basic_types.h>
 #include <forb/executor.h>
+#include <forb/exec_req.h>
 
 /**
  * Object reference structure.
@@ -114,6 +115,17 @@ struct forb_object {
         * are executed in. */
        forb_executor_t *executor;
 
+       /**
+        * Pointer to the execute request in case of remote
+        * invocation.
+        *
+        * @warning If the object can be called both localy and
+        * remotely this field may contain wrong value as the local
+        * and remote requests can be executed in parallel, in
+        * different threads. This will be fixed after even local
+        * invocations will be executed through executors. */
+       forb_exec_req_t *exec_req;
+
        gavl_node_t node;       /**< Node for forb->objects tree */
        /*@}*/
 };
index faa0a6028e720b2259d8f2542727f3a8ba6f60d5..10ec0862a51448edba51028e86922ff69d463ec1 100644 (file)
@@ -59,6 +59,7 @@
 
 #include <forb/basic_types.h>
 #include <stdlib.h>
+#include <forb/types.h>
 
 struct forb_object;