From: Petr Benes Date: Fri, 11 Feb 2011 15:22:43 +0000 (+0100) Subject: forb: End of header index removed from stub. X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/forb.git/commitdiff_plain/3e4ecf403b4fccccb94a6ba289e59ef8e3f7d49c forb: End of header index removed from stub. It is now embedded into the request structure. Does not make so much mess in stubs. --- diff --git a/forb-idl/forb-idl-c-stubs.c b/forb-idl/forb-idl-c-stubs.c index aecf93a..cb4bd17 100644 --- a/forb-idl/forb-idl-c-stubs.c +++ b/forb-idl/forb-idl-c-stubs.c @@ -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"); diff --git a/src/iop.c b/src/iop.c index 6ba0ec3..39fabb4 100644 --- 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; diff --git a/src/iop.h b/src/iop.h index f22ff9d..07a2a22 100644 --- 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); diff --git a/src/request.h b/src/request.h index 03c59ac..be7a861 100644 --- a/src/request.h +++ b/src/request.h @@ -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; diff --git a/src/tests/executor_calls.c b/src/tests/executor_calls.c index 922754d..2238157 100644 --- a/src/tests/executor_calls.c +++ b/src/tests/executor_calls.c @@ -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;