]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
Automatic registration of FCB's reference
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 26 May 2009 14:54:36 +0000 (16:54 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 26 May 2009 15:07:40 +0000 (17:07 +0200)
This is enabled only if FORB is compiled with FRSH_FORB and
INET protocol is default. We can do this because FCB has now fixed ID.

src/Makefile.omk
src/forb.c

index b023fbf4e84cca4a4e776f37acc24a5b5f555497..9461a70aa83e75986c59a38a7fbab50f4544e149 100644 (file)
@@ -54,7 +54,8 @@ default_CONFIG = CONFIG_FORB_PROTO_UNIX=y \
 config_include_HEADERS = forb/config.h
 config_DEFINES = CONFIG_FORB_PROTO_UNIX \
                 CONFIG_FORB_RECV_BUF_SIZE \
-                CONFIG_FORB_PROTO_INET_DEFAULT
+                CONFIG_FORB_PROTO_INET_DEFAULT \
+                CONFIG_FCB     # To see whether we are compiled with FRSH_FORB
 
 include-pass_HOOKS = log_domains.inc #request_gavl.inc
 
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;