]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/commitdiff
frm_fwp: Added fcb forb interface to wifi_agent_server function
authorTuka Martin <tukamart@fel.cvut.cz>
Sun, 1 Apr 2012 22:28:01 +0000 (00:28 +0200)
committerTuka Martin <tukamart@fel.cvut.cz>
Sun, 1 Apr 2012 22:28:01 +0000 (00:28 +0200)
Interface is needed due to spare capacity redistribution, if
conditions of network will change

src/frsh/fres/cbroker/Makefile.omk
src/fwp/fwp/mngr/wifi_agent.c

index 55015f51d33775e5841f2daed6e040a30b4c07cf..f9028f4160f652b33d0ba2243ffa7ea1e7d970e9 100644 (file)
@@ -7,7 +7,7 @@ fcb_LIBS = contract fosa forb pthread rt ulut frm_client fra_client
 fcb_LIBS += frsh               # For frsh_strerror
 fcb_SERVER_IDL = fcb.idl
 
-lib_LIBRARIES += fcb_client 
+shared_LIBRARIES += fcb_client 
 fcb_client_CLIENT_IDL = fcb.idl
 
 include_GEN_HEADERS += fcb.h
index 4fd489a85e27f1ff661bba565a48b357498286fb..aab7262d59559096053fba3f4b5b555be68f0357 100644 (file)
@@ -19,6 +19,7 @@
 #include "wifi_agent_idl.h"
 #include "fwp_admctrl.h"
 #include "wifi_agent.h"
+#include "fcb.h"
 
 UL_LOG_CUST(ulogd_fwp_wifi_agent_server);
 ul_log_domain_t ulogd_fwp_wifi_agent_server = {UL_LOGL_MSG, "fwp_wifi_agent_server"};
@@ -55,6 +56,16 @@ CORBA_long wifi_agent_idl_add(wifi_agent_idl _obj, const CORBA_long rate, const
        fwp_sta_t *sta;
        fwp_sta_t *new_to_add;
 
+       forb_orb fcb_orb;
+        fres_contract_broker fcb;
+       //TODO: initialize restype & resid
+       //const frsh_resource_type_t restype;
+       //const frsh_resource_id_t resid;
+       //CORBA_Environment env;
+       
+       fcb_orb = forb_init(NULL, NULL, NULL); /* FORB initialization */
+       fcb = forb_resolve_reference(fcb_orb, fres_contract_broker_reg_name);
+               
        /*fill the linked list here*/
        ul_list_for_each(sta_list, &frm_fwp_state->sta_list, sta){
                /*client was sending info before*/
@@ -63,6 +74,8 @@ CORBA_long wifi_agent_idl_add(wifi_agent_idl _obj, const CORBA_long rate, const
                        pthread_mutex_lock( &frm_fwp_state->mutex );
                        sta->rate = rate;
                        pthread_mutex_unlock( &frm_fwp_state->mutex );
+                       //TODO: check if it's working
+                       //fres_contract_broker_redistribute_spare_capacity(fcb, restype, resid, &env);
                        return 0;
                }
        }