]> rtime.felk.cvut.cz Git - frescor/frsh.git/commitdiff
The test distributed extended for the contract negotiation. Added frsh_distributed...
authorMartin <molnam1@fel.cvut.cz>
Fri, 31 Oct 2008 14:04:08 +0000 (15:04 +0100)
committerMartin <molnam1@fel.cvut.cz>
Fri, 31 Oct 2008 14:04:08 +0000 (15:04 +0100)
frsh_api/Makefile.omk
frsh_api/frsh_core.c
frsh_api/frsh_distributed.c
frsh_api/tests/Makefile.omk
frsh_api/tests/distributed.c

index 56d41007dae4df1299ac7eb01aed7d327dd879d0..2aee9ae08a30b54e1544c2f02a588af31c6b9a0c 100644 (file)
@@ -2,13 +2,14 @@ SUBDIRS = tests
 
 shared_LIBRARIES = frsh
 frsh_SOURCES = frsh_contract.c frsh_distributed.c frsh_core.c frsh_error.c
-include_HEADERS = frsh_opaque_types.h
+include_HEADERS = frsh_opaque_types.h frsh_forb.h
 frsh_LIBS = fna fcb_client forb contract frs ulut fosa $(scheduler-libs-y)
 
 config_include_HEADERS = frsh_resources.h
 frsh_resources_DEFINES = CONFIG_RESOURCE_DUMMY CONFIG_FWP
 
 scheduler-libs-$(CONFIG_RESOURCE_DUMMY) := frs_dummy
+scheduler-libs-$(CONFIG_FWP) := frsh_fwp
 
 
 
index 00dc27a4ab294cb2674e43b09dbe544b5f2d2cba..a191de28388ffd15e01550b330bdb147e069a1f8 100644 (file)
@@ -3,6 +3,7 @@
 #include <forb.h>
 #include "frsh_forb.h"
 #include <frsh_resources.h>
+#include <stdio.h>
 
 #ifdef CONFIG_RESOURCE_DUMMY
 #include <res_dummy.h>
@@ -38,11 +39,17 @@ int frsh_init()
        if (ret) goto err;
        
 #ifdef CONFIG_RESOURCE_DUMMY
+#if 0  
        ret = frs_dummy_init(frsh_forb_global.orb, frsh_forb_global.fcb,
                             &frsh_forb_global.sch_executor);
        if (ret) goto err;
 #endif
+#endif
 
+//#if FRSH_DISTRIBUTED_MODULE_SUPPORTED
+       ret = frsh_distributed_init();
+       if (ret) goto err;
+//#endif
        /* Run resource schedulers */
        fosa_thread_create(&frsh_forb_global.sch_executor_thread, NULL,
                           sch_executor_thread, NULL);
index 0fb570484d62590f6ca8668b2986766a720fd8c0..a7904f57ac22b61498ca7b65d49afba59c1ce691 100644 (file)
@@ -360,7 +360,6 @@ int frsh_send_endpoint_bind
         (frsh_vres_id_t      vres,
          frsh_send_endpoint_t  endpoint)
 {
-    printf("Check\n");
     if (check_valid_send_endpoint(endpoint) < 0) {
            return FRSH_ERR_BAD_ARGUMENT;
     }
index ccd57f8fa044b5c1e31f0779aff139ecb263d8ba..6a7b0a6ab357b473a288e8d76668e94c676eead9 100644 (file)
@@ -6,5 +6,5 @@ lib_LOADLIBES += pthread rt frsh
 ifeq ($(CONFIG_FWP),y)
 test_PROGRAMS += distributed
 distributed_SOURCES+= distributed.c
-lib_LOADLIBES += fwp fna
+lib_LOADLIBES += pthread rt fwp fna frsh
 endif
index ac68d9447e245818f11dc99ac22ff38dba50ac4e..9b46934af5985ad2da46734cd51886337242ef34 100644 (file)
@@ -32,8 +32,10 @@ void* sender()
        frsh_send_endpoint_t sepoint;
        frsh_vres_id_t vres;
        frsh_send_endpoint_protocol_info_t send_pinfo;
+       frsh_contract_t contract;
+       frsh_rel_time_t budget, period;
        char msg1[10];
-       int count;
+       int count, ret;
        /*struct timespec  sendtime;*/
        
        send_pinfo.body = NULL;         
@@ -43,13 +45,30 @@ void* sender()
        }
        
        /* Contract negotiation */
+       ret = frsh_contract_init(&contract);
+       if (ret) PERROR_AND_EXIT(ret, "frsh_contract_init");
+               
+       budget = fosa_msec_to_rel_time(100);
+       period = fosa_msec_to_rel_time(1000);
+       ret = frsh_contract_set_basic_params(&contract,
+                                            &budget,
+                                            &period,
+                                            FRSH_WT_BOUNDED,
+                                            FRSH_CT_REGULAR);
+       if (ret) PERROR_AND_EXIT(ret, "frsh_contract_set_basic_params");
+       ret = frsh_contract_set_resource_and_label(&contract,FRSH_RT_NETWORK,
+                                                       FRSH_NETPF_FWP,
+                                                       "fwp_cont1");
+       if (ret) PERROR_AND_EXIT(ret, "frsh_contract_set_resource_and_label");
+
+       ret = frsh_contract_negotiate(&contract, &vres);
+       if (ret) PERROR_AND_EXIT(ret, "frsh_contract_negotiate");
        
        printf("Send endpoint created\n");
        frsh_send_endpoint_bind(vres, sepoint);
        printf("Send endpoint bounded\n");
        
        sleep(2);
-       //for (count = 0; count < NUM; count++) {       
        //fwp_set_rt_prio(90);
        
        count = 0;
@@ -114,11 +133,15 @@ int main()
 {
        pthread_attr_t  thattr;
        pthread_t       thread;
+       int ret;
 
        printf("Start\n");
-       if (frsh_distributed_init()) {
+       ret = frsh_init();
+       if (ret) PERROR_AND_EXIT(ret, "frsh_init");
+       
+       /*if (frsh_distributed_init()) {
                fprintf(stderr,"FRSH distributed modul initialization failed.\n");
-       }
+       }*/
        
        pthread_attr_init(&thattr);
        pthread_create(&thread, &thattr, sender, NULL);