]> rtime.felk.cvut.cz Git - frescor/forb.git/blobdiff - src/forb.c
Automatic registration of FCB's reference
[frescor/forb.git] / src / forb.c
index ca720e3df5b2bd44b508eb656db613f2eb349573..dc55cbcfa431f3bdf37235246ecf3df12e18927b 100644 (file)
 #ifdef CONFIG_FORB_PROTO_INET_DEFAULT
 #include <forb/proto_inet.h>
 #endif
-
+#ifdef CONFIG_FCB
+#include <fcb.h>
+#include <fcb_contact_info.h>
+#endif
 
 #ifdef DEBUG
 #define UL_LOGL_DEF UL_LOGL_DEB
@@ -148,6 +151,23 @@ forb_execution_thread(void *arg)
        return NULL;
 }
 
+#ifdef CONFIG_FCB
+void hack_register_fcb(forb_orb orb, forb_port_t *port)
+{
+       forb_object fcb = forb_object_new(orb, &FCB_SERVER_ID, 1);
+       if (!fcb) {
+               ul_logerr("Cannot allocate FCB reference\n");
+               return;
+       }
+       forb_register_reference(fcb, fres_contract_broker_reg_name);
+       forb_object_release(fcb);
+}
+#else
+#define hack_register_fcb(orb)
+#endif
+
+
+
 forb_orb
 forb_init(int *argc, char **argv[], const struct forb_init_attr *attr)
 {
@@ -253,6 +273,7 @@ forb_init(int *argc, char **argv[], const struct forb_init_attr *attr)
                free(port);
                goto err2;
        inet_ok:;
+               hack_register_fcb(orb, port);
        }
 #endif
        return orb;