--- /dev/null
+/*
+ * This file was generated by forb-idl but now it is a test
+ */
+
+#include <string.h>
+#include <forb/forb-internal.h>
+#include <forb/request.h>
+#include <forb/iop.h>
+#include <forb/cdr.h>
+#include <forb/object.h>
+
+#include "myinterface.h"
+
+#define ex_on_fail(command, ex) if (!(command)) do { ev->major = (ex); goto exception; } while(0)
+#define FORB_REQEST_HDR_SIZE (forb_iop_MESSAGE_HEADER_SIZE + forb_iop_REQUEST_HEADER_SIZE)
+
+#define _myinterface_impl(obj) ((struct forb_myinterface_impl*)(obj)->implementation)
+
+CORBA_long myinterface_add(myinterface _obj, const CORBA_long a, const CORBA_long b, CORBA_Environment *ev)
+{
+ CORBA_long _forb_retval;
+ executor *exec_current;
+ if (ev) ev->major = FORB_EX_NONE;
+ /* local object */
+ if (forb_object_is_local(_obj)) {
+ if (!_obj->interface ||
+ strncmp(_obj->interface->name, "myinterface", 11) != 0) {
+ ev->major = FORB_EX_BAD_OPERATION;
+ return _forb_retval;
+ }
+ if (!forb_get_current_executor(exec_current) && (forb_object_get_executor(_obj) == exec_current))
+ /* direct invocation */
+ _forb_retval = _myinterface_impl(_obj)->add(_obj, a, b, ev);
+ } else {
+ /* TODO inter-thread invocation*/
+ }
+ } else {
+ /* remote object - the same as before */
+ forb_request_t req;
+ ex_on_fail(forb_request_init(&req, _obj) == 0, FORB_EX_INTERNAL);
+ forb_iop_prepare_request(&req, "myinterface", FORB_METHOD_INDEX(myinterface_add), 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, ev);
+ if (forb_exception_occurred(ev)) goto exception;
+ forb_request_wait_for_reply(&req);
+ if (forb_exception_occurred(ev)) goto exception;
+ CORBA_long_deserialize(req.cdr_reply, &_forb_retval);
+ forb_request_signal_processed(&req);
+exception:
+ forb_request_destroy(&req);
+ }
+ return _forb_retval;
+}
+
--- /dev/null
+/**************************************************************************/
+/* ---------------------------------------------------------------------- */
+/* Copyright (C) 2006 - 2008 FRESCOR consortium partners: */
+/* */
+/* Universidad de Cantabria, SPAIN */
+/* University of York, UK */
+/* Scuola Superiore Sant'Anna, ITALY */
+/* Kaiserslautern University, GERMANY */
+/* Univ. Politécnica Valencia, SPAIN */
+/* Czech Technical University in Prague, CZECH REPUBLIC */
+/* ENEA SWEDEN */
+/* Thales Communication S.A. FRANCE */
+/* Visual Tools S.A. SPAIN */
+/* Rapita Systems Ltd UK */
+/* Evidence ITALY */
+/* */
+/* See http://www.frescor.org for a link to partners' websites */
+/* */
+/* FRESCOR project (FP6/2005/IST/5-034026) is funded */
+/* in part by the European Union Sixth Framework Programme */
+/* The European Union is not liable of any use that may be */
+/* made of this code. */
+/* */
+/* */
+/* This file is part of FORB (Frescor Object Request Broker) */
+/* */
+/* FORB is free software; you can redistribute it and/or modify it */
+/* under terms of the GNU General Public License as published by the */
+/* Free Software Foundation; either version 2, or (at your option) any */
+/* later version. FORB is distributed in the hope that it will be */
+/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
+/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
+/* General Public License for more details. You should have received a */
+/* copy of the GNU General Public License along with FORB; see file */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
+/* Cambridge, MA 02139, USA. */
+/* */
+/* As a special exception, including FORB header files in a file, */
+/* instantiating FORB generics or templates, or linking other files */
+/* with FORB objects to produce an executable application, does not */
+/* by itself cause the resulting executable application to be covered */
+/* by the GNU General Public License. This exception does not */
+/* however invalidate any other reasons why the executable file might be */
+/* covered by the GNU Public License. */
+/**************************************************************************/
+
+/**
+ * @file discovery.c
+ * @author Petr Benes <benesp16@fel.cvut.cz>
+ * @date Sun Oct 12 19:05:27 2008
+ *
+ * @brief Test for running executor identification.
+ *
+ */
+
+#include <stdbool.h>
+#include <forb.h>
+#include <forb/object.h>
+#include <forb/forb-internal.h>
+#include <forb/config.h>
+#include <unistd.h>
+#include "../proto.h"
+#include "../discovery.h"
+#include <error.h>
+#include <fosa.h>
+#include <stdio.h>
+
+#if !CONFIG_FORB_PROTO_UNIX && !CONFIG_FORB_PROTO_INET_DEFAULT
+#error This test should only work if there is some local protocol enabled.
+#endif
+
+int main(int argc, char *argv[])
+{
+ forb_orb orb;
+ forb_executor_t *executor;
+ //forb_executor_t *my_executor;
+
+ orb = forb_init(&argc, &argv, NULL);
+ if (!orb) {
+ error(1, errno, "Test: Orb was not created\n");
+ }
+ else {
+ printf("Test: Orb initialized\n");
+ }
+
+ // ------------------------------------------------------
+ if (forb_get_current_executor(&executor)) {
+ printf("Test: Error while getting current executor\n");
+ if (executor == NULL)
+ printf("Test: Executor: NULL\n");
+ }
+ else
+ printf("Test: Executor: %p\n", executor);
+
+ printf("Test: ORB executor: %p\n", orb->executor);
+
+ forb_executor_run(orb->executor);
+
+ return 0;
+}