]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/commitdiff
hack: Add fixed reference to wifi_agent to all FORBs
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 29 Mar 2011 09:49:15 +0000 (11:49 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 29 Mar 2011 09:49:15 +0000 (11:49 +0200)
This is only a temporary hack until I implement proper registration and
propagation of regeistered references over TCP transport protocol.

src/forb/src/forb.c
src/forb/src/proto_inet.c
src/fwp/fwp/mngr/Makefile.omk
src/fwp/fwp/mngr/fwp_mngr.c
src/fwp/fwp/mngr/wifi_agent.h [new file with mode: 0644]

index 309c6602e8f8b5a84b469be748058385e5b76e5e..98d73b5e7ac46f4dc70a5ba2f128ad6440fc5f69 100644 (file)
@@ -84,6 +84,7 @@
 #ifdef CONFIG_FCB
 #include <fcb.h>
 #include <fcb_contact_info.h>
+#include <wifi_agent.h>
 #endif
 #include <fcntl.h>
 
@@ -165,6 +166,16 @@ void hack_register_fcb(forb_orb orb, forb_port_t *port)
        }
        forb_register_reference(fcb, fres_contract_broker_reg_name);
        forb_object_release(fcb);
+
+       
+
+       forb_object wai = forb_object_new(orb, &WAI_SERVER_ID, 1);
+       if (!fcb) {
+               ul_logerr("Cannot allocate WAI reference\n");
+               return;
+       }
+       forb_register_reference(wai, "net.sourceforge.frsh-forb.wai");
+       forb_object_release(wai);
 }
 #else
 #define hack_register_fcb(orb)
index cae62dbbd7cc2234e67f5e450e3258867b2faca7..66cbd36cf9acdbf2ae634272fa5aaae81c57bc32 100644 (file)
@@ -468,10 +468,11 @@ size_t inet_addr2str(char *dest, size_t maxlen, const void *addr)
 
 #include <fcb.h>
 #include <fcb_contact_info.h>
+#include <wifi_agent.h>
 
 static void inet_register_cb(forb_port_t *port)
 {
-       inet_addr_t *ia;
+       inet_addr_t *ia, *ia2;
        
        ia = malloc(sizeof(*ia));
        if (!ia) return;
@@ -482,6 +483,15 @@ static void inet_register_cb(forb_port_t *port)
        ia->sin_addr.s_addr = inet_addr(fcb_addr);
        ia->sin_port = htons(FCB_TCP_PORT);
        forb_new_peer_discovered(port, NULL, FCB_SERVER_ID, ia, "");
+       
+       ia2 = malloc(sizeof(*ia2));
+       if (!ia2) return;
+       char *wai_addr = getenv("WAI_ADDR");
+       if (!wai_addr) wai_addr = "127.0.0.1";
+       ia2->sin_family = AF_INET;
+       ia2->sin_addr.s_addr = inet_addr(wai_addr);
+       ia2->sin_port = htons(WAI_TCP_PORT);
+       forb_new_peer_discovered(port, NULL, WAI_SERVER_ID, ia2, "");
 }
 #else
 #define inet_register_cb NULL
index 51a24be1c775d5bf48acf76e0aeef74e3cc06d3f..3b0f6b3bf10ccade73ac4026d2ab152423bf8f8d 100644 (file)
@@ -2,6 +2,6 @@ bin_PROGRAMS = frm_fwp
 frm_fwp_SOURCES = fwp_mngr.c fwp_admctrl.c
 frm_fwp_LIBS = frm forb contract fosa rt ulut fcb_client
 
-#include_HEADERS = res_fwp.h
+include_HEADERS = wifi_agent.h
 CFLAGS += -D_FWP_INTERNALS_
 lib_LOADLIBES+= frsh 
index c94328ae063c82f4907b01f912e9794f2203335e..5fd03a017bd80862a6e05ca46d774328df52cea4 100644 (file)
@@ -55,6 +55,7 @@
 #include <fwp_res.h>
 #include <stdio.h>
 #include "fwp_admctrl.h"
+#include <wifi_agent.h>
 
 #if 0
 static
@@ -122,7 +123,9 @@ int main(int argc, char *argv[])
 {
        forb_orb orb;
        int ret;
-       forb_init_attr_t attr = { .orb_id = "org.frescor.frm.fwp" };
+       forb_init_attr_t attr = { .orb_id = "org.frescor.frm.fwp",
+                                 .fixed_tcp_port = WAI_TCP_PORT,
+       };
        int  opt;
        bool opt_daemon = false;
        char *opt_pidfile = NULL;
diff --git a/src/fwp/fwp/mngr/wifi_agent.h b/src/fwp/fwp/mngr/wifi_agent.h
new file mode 100644 (file)
index 0000000..cc45e92
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef WIFI_AGENT_H
+#define WIFI_AGENT_H
+
+#define WAI_SERVER_ID (forb_server_id){ .uuid = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22 } }
+#define WAI_TCP_PORT 24943
+
+#endif