]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
forb: End of header index removed from stub.
authorPetr Benes <benesp16@fel.cvut.cz>
Fri, 11 Feb 2011 15:22:43 +0000 (16:22 +0100)
committerPetr Benes <benesp16@fel.cvut.cz>
Fri, 11 Feb 2011 15:22:43 +0000 (16:22 +0100)
It is now embedded into the request structure. Does not make
so much mess in stubs.

forb-idl/forb-idl-c-stubs.c
src/iop.c
src/iop.h
src/request.h
src/tests/executor_calls.c

index aecf93a63e1002eeddd0e57984ddd60702c82a34..cb4bd17d4812be766d2044c2d31337ba44922d13 100644 (file)
@@ -65,11 +65,10 @@ cs_output_stub (IDL_tree     tree,
        
        fprintf(of, "  } else {\n");
        fprintf(of, "    /* remote object */\n"
-                   "    forb_request_t req;\n"
-                   "    unsigned index; //buffer position of parameters\n");
+                   "    forb_request_t req;\n");
        fprintf(of, "    ex_on_fail(forb_request_init(&req, _obj, \"%s\", FORB_METHOD_INDEX(%s)) == 0, FORB_EX_INTERNAL);\n",
                iface_id, opname);
-       fprintf(of, "    forb_iop_prepare_request(&req, &index, ev);\n");
+       fprintf(of, "    forb_iop_prepare_request(&req, ev);\n");
        fprintf(of, "    if (forb_exception_occurred(ev)) goto exception;\n");
        for (sub = IDL_OP_DCL (tree).parameter_dcls; sub; sub = IDL_LIST (sub).next) {
                IDL_tree        parm = IDL_LIST (sub).data;
@@ -86,7 +85,7 @@ cs_output_stub (IDL_tree     tree,
                          n == 0 ? "&":"", name);
                }
        }
-       fprintf(of, "    forb_request_send(&req, index, ev);\n");
+       fprintf(of, "    forb_request_send(&req, ev);\n");
        fprintf(of, "    if (forb_exception_occurred(ev)) goto exception;\n");
        fprintf(of, "    forb_request_wait_for_reply(&req);\n");
        fprintf(of, "    if (forb_exception_occurred(ev)) goto exception;\n");
index 6ba0ec3107796471f9272e20c36d43201acdb8d3..39fabb49afde43fce384bf47e845569a78257a4b 100644 (file)
--- a/src/iop.c
+++ b/src/iop.c
@@ -91,7 +91,6 @@ forb_iop_prepend_message_header(FORB_CDR_Codec *codec, forb_iop_message_type mt)
 
 CORBA_boolean
 forb_iop_prepare_request(forb_request_t *req,
-                        unsigned *index,
                         CORBA_Environment *env)
 {
        CORBA_boolean ret;
@@ -111,7 +110,7 @@ forb_iop_prepare_request(forb_request_t *req,
                          forb_server_id_to_string(str, &req->obj->server, sizeof(str)),
                          rh.iface, rh.method_index);
        }
-       *index = req->cdr_request.wptr;
+       req->end_of_header_index = req->cdr_request.wptr;
        return ret;
 }
 
@@ -725,7 +724,7 @@ void *forb_iop_discovery_thread(void *arg)
  * @param env Environment for returning exceptions
  */
 void
-forb_request_send(forb_request_t *req, unsigned index, CORBA_Environment *env)
+forb_request_send(forb_request_t *req, CORBA_Environment *env)
 {
        CORBA_boolean ret;
        forb_peer_t *peer;
@@ -760,7 +759,7 @@ forb_request_send(forb_request_t *req, unsigned index, CORBA_Environment *env)
                exec_req->obj = forb_object_duplicate(req->obj);
                exec_req->method_index = req->method_ind;
                exec_req->interface = req->interface;
-               req->cdr_request.rptr = index;
+               req->cdr_request.rptr = req->end_of_header_index;
                exec_req->codec = req->cdr_request;
                req->cdr_request.release_buffer = CORBA_FALSE;
                exec_req->request_id = req->request_id;
index f22ff9d41ed2549db0fdef0d9dc6d5a80ed6dd94..07a2a221bc12a7496851281e6ad8c4598f7a238e 100644 (file)
--- a/src/iop.h
+++ b/src/iop.h
@@ -67,7 +67,6 @@ forb_iop_prepend_message_header(FORB_CDR_Codec *codec, forb_iop_message_type mt)
 
 CORBA_boolean
 forb_iop_prepare_request(forb_request_t *req,
-                        unsigned *index,
                         CORBA_Environment *env);
 
 bool
@@ -90,7 +89,7 @@ forb_iop_discovery_thread(void *arg);
 
 /* TODO: rename to forb_iop_send_request */
 void
-forb_request_send(forb_request_t *req, unsigned index, CORBA_Environment *env);
+forb_request_send(forb_request_t *req, CORBA_Environment *env);
 
 int
 forb_iop_send_hello_to(forb_peer_t *peer);
index 03c59ac1ac1cb7e7d036be2224974569a4f4cf7e..be7a8615954f3ffaca10174d1f8d0a82124917ee 100644 (file)
@@ -85,6 +85,7 @@ struct forb_request {
        struct forb_env *env;   /**< Where to store exception returned in reply */
        forb_syncobj_t reply_ready; /**< Synchronization object for waiting for reply */
        forb_syncobj_t *reply_processed; /**< Synchronization object for receiver thread to wait for stub. */
+       unsigned end_of_header_index; /**< Index indicating the end of header of a codec buffer. */
 };
 
 typedef struct forb_request forb_request_t;
index 922754d283a793f7930de5767cc7c92176a7f09d..223815709428fa9798534bf6db3d4194311de8a5 100644 (file)
@@ -34,14 +34,13 @@ CORBA_long myinterface_add(myinterface _obj, const CORBA_long a, const CORBA_lon
     _forb_retval = _myinterface_impl(_obj)->add(_obj, a, b, ev);
   } else {
     /* remote object - the same as before */
-    unsigned index;
     forb_request_t req;
     ex_on_fail(forb_request_init(&req, _obj, "myinterface", FORB_METHOD_INDEX(myinterface_add)) == 0, FORB_EX_INTERNAL);
-    forb_iop_prepare_request(&req, &index, ev);
+    forb_iop_prepare_request(&req, ev);
     if (forb_exception_occurred(ev)) goto exception;
     ex_on_fail(CORBA_long_serialize(&req.cdr_request, &a), FORB_EX_IMP_LIMIT);
     ex_on_fail(CORBA_long_serialize(&req.cdr_request, &b), FORB_EX_IMP_LIMIT);
-    forb_request_send(&req, index, ev);
+    forb_request_send(&req, ev);
     if (forb_exception_occurred(ev)) goto exception;
     forb_request_wait_for_reply(&req);
     if (forb_exception_occurred(ev)) goto exception;