+++ /dev/null
-include ../../config.mk
-include ../../rules.mk
-CFLAGS += -I$(FNA_PATH)/src_rtep/ -I$(PLATFORM_PATH)/drivers/rt-ep/
-LDFLAGS += -L$(FNA_PATH)/lib -lrtepfna -L$(PLATFORM_PATH)/drivers/rt-ep -lrtep \
- -L$(FRSH_PATH)/lib -lfrsh -L$(FOSA_PATH)/lib -lfosa_$(PLATFORM) -lm -lfna
-
-export:
- @cp $(PLATFORM_PATH)/mprogram .
- @cp mprogram /home/dsl/export/mprogram_right
- @cp mprogram /home/dsl/export/mprogram_left
- @cp mprogram /home/dsl/export/mprogram_middle
-
-create_emulator_imgs:
- @cp base_disk.img master.img
- @cp base_disk.img slave.img
- @cp base_disk.img other_slave.img
-
-qemu_1:
- @cp $(PLATFORM_PATH)/mprogram .
- @mv slave.img disk.img
- @./mkvirtualdisk
- @mv disk.img slave.img
- qemu -hda slave.img &
-
-qemu_2:
- @cp $(PLATFORM_PATH)/mprogram .
- @mv slave.img disk.img
- @./mkvirtualdisk
- @mv disk.img slave.img
- @mv master.img disk.img
- @./mkvirtualdisk
- @mv disk.img master.img
- qemu -hda slave.img -net nic,macaddr=00:0E:0C:5B:1D:BD,model=rtl8139 -net socket,mcast=230.0.0.1:1234 &
-# qemu -hda slave.img -net nic,macaddr=00:02:44:35:66:5B,model=rtl8139 -net socket,mcast=230.0.0.1:1234 &
- @sleep 2
- qemu -hda master.img -net nic,macaddr=00:0E:0C:5B:1E:28,model=rtl8139 -net socket,mcast=230.0.0.1:1234
-# qemu -hda master.img -net nic,macaddr=00:02:44:3B:6A:BE,model=rtl8139 -net socket,mcast=230.0.0.1:1234
-
-qemu_3:
- @cp $(PLATFORM_PATH)/mprogram .
- @mv master.img disk.img
- @./mkvirtualdisk
- @mv disk.img master.img
- @mv slave.img disk.img
- @./mkvirtualdisk
- @mv disk.img slave.img
- @mv other_slave.img disk.img
- @./mkvirtualdisk
- @mv disk.img other_slave.img
- qemu -hda master.img -net nic,macaddr=00:0E:0C:5B:1E:28,model=rtl8139 -net socket,mcast=230.0.0.1:1234 &
- qemu -hda slave.img -net nic,macaddr=00:0E:0C:5B:1D:BD,model=rtl8139 -net socket,mcast=230.0.0.1:1234 &
- qemu -hda other_slave.img -net nic,macaddr=00:02:44:3C:08:21,model=rtl8139 -net socket,mcast=230.0.0.1:1234 &
-
-clean_images:
- @exec echo -e "\n>> Cleaning up IMAGES:";
- @rm -fv master.img
- @rm -fv slave.img
- @rm -fv other_slave.img
- @exec echo " [OK]"
\ No newline at end of file
+++ /dev/null
-losetup -o32256 /dev/loop/0 disk.img &&
-mount -o loop /dev/loop0 mnt &&
-cp -f mprogram mnt/mprogram &&
-umount mnt &&
-losetup -d /dev/loop/0
+++ /dev/null
-//----------------------------------------------------------------------
-// Copyright (C) 2006 - 2007 by the FRESCOR consortium:
-//
-// Universidad de Cantabria, SPAIN
-// University of York, UK
-// Scuola Superiore Sant'Anna, ITALY
-// Kaiserslautern University, GERMANY
-// Univ. Politecnica Valencia, SPAIN
-// Czech Technical University in Prague, CZECH REPUBLIC
-// ENEA SWEDEN
-// Thales Communication S.A. FRANCE
-// Visual Tools S.A. SPAIN
-// Rapita Systems Ltd UK
-// Evidence ITALY
-//
-// See http://www.frescor.org
-//
-// The FRESCOR project (FP6/2005/IST/5-034026) is funded
-// in part by the European Union Sixth Framework Programme
-// The European Union is not liable of any use that may be
-// made of this code.
-//
-//
-// based on previous work (FSF) done in the FIRST project
-//
-// Copyright (C) 2005 Mälardalen University, SWEDEN
-// Scuola Superiore S.Anna, ITALY
-// Universidad de Cantabria, SPAIN
-// University of York, UK
-//
-// This file is part of FNA (Frescor Network Adaptation)
-//
-// FNA is free software; you can redistribute it and/or modify it
-// under terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option) any
-// later version. FNA is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details. You should have received a
-// copy of the GNU General Public License along with FNA; see file
-// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
-// Cambridge, MA 02139, USA.
-//
-// As a special exception, including FNA header files in a file,
-// instantiating FNA generics or templates, or linking other files
-// with FNA objects to produce an executable application, does not
-// by itself cause the resulting executable application to be covered
-// by the GNU General Public License. This exception does not
-// however invalidate any other reasons why the executable file might be
-// covered by the GNU Public License.
-// -----------------------------------------------------------------------
-
-/*
- * test_c_rtep_fna.c
- *
- * Goal:
- *
- * The goal of this program is to test the RTEP implementation of the functions
- * defined at fna.h without passing through the FRSH interface.
- *
- * Algorithm:
- *
- * We have two nodes, a sender and a receiver. The sender negotiates a contract,
- * send info to the receiver, then renegotiates the contract and finally it
- * cancels the contract.
- *
- */
-
-#include <assert.h> // for assert
-#include <stdio.h> // for printf
-#include <time.h> // for timespec
-
-#include "frsh_core.h" // for frsh_contract_set_xxx
-#include "frsh_core_types.h" // for FRSH_RESOURCE_ID_DEFAULT
-#include "frsh_distributed_types.h" // for frsh_network_address_t, frsh_stream_id_t
-
-#include "fna.h" // for fna_vres_id_t
-#include "frsh_fna.h" // for frsh_rtep_*
-#include "rtep_fna.h" // for rtep_fna_operations
-
-#include "rtep.h" // for rtep_station_id_t, rtep_channel_t
-
-int main ()
-{
- int err;
- rtep_station_id_t me, normal_station, multicast_station;
- frsh_network_address_t frsh_address;
- char multicast_name[] = "broadcast";
- size_t max_size, max_multicast_size, budget_bytes, nbytes;
- struct timespec budget_timespec, period_max;
- frsh_contract_t frsh_contract;
- fna_vres_id_t vres;
- fna_endpoint_data_t endpoint;
- const int MSG_BUFFER_MX = 10;
- char msg_buffer[MSG_BUFFER_MX];
- int msg_size;
- int msg_counter;
-
- printf("--------------------------------------------------\n");
- printf("1.- fna_init\n");
- printf("--------------------------------------------------\n");
- err = rtep_fna_operations.fna_init(FRSH_RESOURCE_ID_DEFAULT);
- assert(err == 0);
-
- printf("--------------------------------------------------\n");
- printf("2.- fna_network_get_max_message_size\n");
- printf("--------------------------------------------------\n");
- // get broadcast address for FRESCOR
- multicast_station = rtep_get_station_id_by_name
- ((uint8_t *)multicast_name, sizeof(multicast_name)-1);
-
- err = frsh_rtep_map_network_address
- (FRSH_RESOURCE_ID_DEFAULT, multicast_station, &frsh_address);
- assert (err == 0);
-
- // maximum size per message for a broadcast address
- err=rtep_fna_operations.fna_network_get_max_message_size
- (FRSH_RESOURCE_ID_DEFAULT, frsh_address, &max_multicast_size);
- printf("Max multicast message size: %d\n", max_multicast_size);
- assert (err == 0);
- assert (max_multicast_size == MULTICAST_MTU);
-
- // now the same with a normal address (i.e: 2)
- normal_station = 2;
- err=frsh_rtep_map_network_address
- (FRSH_RESOURCE_ID_DEFAULT, normal_station, &frsh_address);
- assert (err == 0);
-
- // maximum size per message for a normal address
- err=rtep_fna_operations.fna_network_get_max_message_size
- (FRSH_RESOURCE_ID_DEFAULT, frsh_address, &max_size);
- printf("Max message size: %d\n", max_size);
- assert (err == 0);
- assert (max_size == MAX_RTEP_MTU);
-
- printf("--------------------------------------------------\n");
- printf("3.- fna_network_budget_to_bytes\n");
- printf("--------------------------------------------------\n");
- nbytes = 1700;
- err=rtep_fna_operations.fna_network_bytes_to_budget
- (FRSH_RESOURCE_ID_DEFAULT, nbytes, &budget_timespec);
- assert (err == 0);
-
- err=rtep_fna_operations.fna_network_budget_to_bytes
- (FRSH_RESOURCE_ID_DEFAULT, &budget_timespec, &budget_bytes);
- assert (err == 0);
- printf("%d user bytes -> %d budget bytes\n", nbytes, budget_bytes);
-
- printf("--------------------------------------------------\n");
- printf("4.- fna_network_get_min_effective_budget\n");
- printf("--------------------------------------------------\n");
- err=rtep_fna_operations.fna_network_get_min_eff_budget
- (FRSH_RESOURCE_ID_DEFAULT, &budget_timespec);
- assert (err == 0);
-
- err=rtep_fna_operations.fna_network_budget_to_bytes
- (FRSH_RESOURCE_ID_DEFAULT, &budget_timespec, &budget_bytes);
- assert (err == 0);
- printf("Minimum effective budget: %d\n", budget_bytes);
-
- // send or receive
- me = rtep_get_station_id();
-
- if (me == 1) {
-
- printf("--------------------------------------------------\n");
- printf("5.- fna_contract_negotiate\n");
- printf("--------------------------------------------------\n");
-
- period_max.tv_sec = 3;
- period_max.tv_nsec = 0;
-
- // Create the contract
- frsh_contract.workload = FRSH_WT_INDETERMINATE;
- frsh_contract.granularity = FRSH_DEFAULT_GRANULARITY;
- frsh_contract.weight = FRSH_DEFAULT_WEIGHT;
- frsh_contract.importance = FRSH_DEFAULT_IMPORTANCE;
- frsh_contract.resource_id = FRSH_RESOURCE_ID_DEFAULT;
- frsh_contract.resource_type = FRSH_RT_NETWORK;
-
- frsh_contract.budget_min = budget_timespec;
- frsh_contract.period_max = period_max;
- frsh_contract.d_equals_t = true;
- frsh_contract.preemption_level = 4;
-
- // Negotiate the contract
- err = rtep_fna_operations.fna_contract_negotiate
- (FRSH_RESOURCE_ID_DEFAULT, &frsh_contract, &vres);
- assert (err == 0);
- printf("Contract accepted\n");
-
- // Bind the vres to an endpoint
- endpoint.endpoint_type = FRSH_SEND_ENDPOINT_TYPE;
- endpoint.vres = vres;
- endpoint.is_bound = true;
- endpoint.destination = 2; // only for send_endpoints
- endpoint.resource_id = FRSH_RESOURCE_ID_DEFAULT;
- endpoint.stream_id = 7;
-
- msg_counter = 0;
-
- while(1) {
- sleep(4);
- printf("sending message\n");
-
- msg_counter = msg_counter + 1;
- msg_size = snprintf(msg_buffer, MSG_BUFFER_MX-1, "MSG %d", msg_counter);
-
- err = rtep_fna_operations.fna_send_async
- (&endpoint, msg_buffer, msg_size);
- assert (err == 0);
- }
- } else {
- size_t received_bytes;
- frsh_network_address_t from;
-
- endpoint.endpoint_type = FRSH_RECEIVE_ENDPOINT_TYPE;
- endpoint.is_bound = false;
- endpoint.resource_id = FRSH_RESOURCE_ID_DEFAULT;
- endpoint.stream_id = 7;
-
- while(1) {
- printf("blocking to receive\n");
- err = rtep_fna_operations.fna_receive_sync
- (&endpoint, msg_buffer, MSG_BUFFER_MX, &received_bytes, &from);
- assert (err == 0);
-
- msg_buffer[received_bytes] = '\0';
-
- printf("msg received: %s\n", msg_buffer);
- }
- }
-
- return 0;
-}
+++ /dev/null
-//----------------------------------------------------------------------
-// Copyright (C) 2006 - 2007 by the FRESCOR consortium:
-//
-// Universidad de Cantabria, SPAIN
-// University of York, UK
-// Scuola Superiore Sant'Anna, ITALY
-// Kaiserslautern University, GERMANY
-// Univ. Politecnica Valencia, SPAIN
-// Czech Technical University in Prague, CZECH REPUBLIC
-// ENEA SWEDEN
-// Thales Communication S.A. FRANCE
-// Visual Tools S.A. SPAIN
-// Rapita Systems Ltd UK
-// Evidence ITALY
-//
-// See http://www.frescor.org
-//
-// The FRESCOR project (FP6/2005/IST/5-034026) is funded
-// in part by the European Union Sixth Framework Programme
-// The European Union is not liable of any use that may be
-// made of this code.
-//
-//
-// based on previous work (FSF) done in the FIRST project
-//
-// Copyright (C) 2005 Mälardalen University, SWEDEN
-// Scuola Superiore S.Anna, ITALY
-// Universidad de Cantabria, SPAIN
-// University of York, UK
-//
-// This file is part of FNA (Frescor Network Adaptation)
-//
-// FNA is free software; you can redistribute it and/or modify it
-// under terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option) any
-// later version. FNA is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details. You should have received a
-// copy of the GNU General Public License along with FNA; see file
-// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
-// Cambridge, MA 02139, USA.
-//
-// As a special exception, including FNA header files in a file,
-// instantiating FNA generics or templates, or linking other files
-// with FNA objects to produce an executable application, does not
-// by itself cause the resulting executable application to be covered
-// by the GNU General Public License. This exception does not
-// however invalidate any other reasons why the executable file might be
-// covered by the GNU Public License.
-// -----------------------------------------------------------------------
-
-/*
- * test_c_rtep_fna.c
- *
- * Goal:
- *
- * The goal of this program is to test the RTEP implementation of the functions
- * defined at fna.h without passing through the FRSH interface.
- *
- * Algorithm:
- *
- * We have two nodes, a sender and a receiver. The sender negotiates a contract,
- * send info to the receiver, then renegotiates the contract and finally it
- * cancels the contract.
- *
- */
-
-#include <assert.h> // for assert
-#include <stdio.h> // for printf
-#include <time.h> // for timespec
-
-#include "frsh_core.h" // for frsh_contract_set_xxx
-#include "frsh_core_types.h" // for FRSH_RESOURCE_ID_DEFAULT
-#include "frsh_distributed_types.h" // for frsh_network_address_t, frsh_stream_id_t
-
-#include "fna.h" // for fna_vres_id_t
-#include "frsh_fna.h" // for frsh_rtep_*
-#include "rtep_fna.h" // for rtep_fna_operations
-
-#include "rtep.h" // for rtep_station_id_t, rtep_channel_t
-
-int main ()
-{
- int err;
- rtep_station_id_t me, normal_station, multicast_station;
- frsh_network_address_t frsh_address;
- char multicast_name[] = "broadcast";
- size_t max_size, max_multicast_size, budget_bytes, nbytes;
- struct timespec budget_timespec, period_max;
- frsh_contract_t frsh_contract;
- fna_vres_id_t vres;
- fna_endpoint_data_t endpoint;
- const int MSG_BUFFER_MX = 10;
- char msg_buffer[MSG_BUFFER_MX];
- int msg_size;
- int msg_counter;
-
- printf("--------------------------------------------------\n");
- printf("1.- fna_init\n");
- printf("--------------------------------------------------\n");
- err = frsh_init();
-// err = rtep_fna_operations.fna_init(FRSH_RESOURCE_ID_DEFAULT);
- assert(err == 0);
-
- printf("--------------------------------------------------\n");
- printf("2.- fna_network_get_max_message_size\n");
- printf("--------------------------------------------------\n");
- // get broadcast address for FRESCOR
- multicast_station = rtep_get_station_id_by_name
- ((uint8_t *)multicast_name, sizeof(multicast_name)-1);
-
- err = frsh_rtep_map_network_address
- (FRSH_RESOURCE_ID_DEFAULT, multicast_station, &frsh_address);
- assert (err == 0);
-
- // maximum size per message for a broadcast address
- err=rtep_fna_operations.fna_network_get_max_message_size
- (FRSH_RESOURCE_ID_DEFAULT, frsh_address, &max_multicast_size);
- printf("Max multicast message size: %d\n", max_multicast_size);
- assert (err == 0);
- assert (max_multicast_size == MULTICAST_MTU);
-
- // now the same with a normal address (i.e: 2)
- normal_station = 2;
- err=frsh_rtep_map_network_address
- (FRSH_RESOURCE_ID_DEFAULT, normal_station, &frsh_address);
- assert (err == 0);
-
- // maximum size per message for a normal address
- err=rtep_fna_operations.fna_network_get_max_message_size
- (FRSH_RESOURCE_ID_DEFAULT, frsh_address, &max_size);
- printf("Max message size: %d\n", max_size);
- assert (err == 0);
- assert (max_size == MAX_RTEP_MTU);
-
- printf("--------------------------------------------------\n");
- printf("3.- fna_network_budget_to_bytes\n");
- printf("--------------------------------------------------\n");
- nbytes = 1700;
- err=rtep_fna_operations.fna_network_bytes_to_budget
- (FRSH_RESOURCE_ID_DEFAULT, nbytes, &budget_timespec);
- assert (err == 0);
-
- err=rtep_fna_operations.fna_network_budget_to_bytes
- (FRSH_RESOURCE_ID_DEFAULT, &budget_timespec, &budget_bytes);
- assert (err == 0);
- printf("%d user bytes -> %d budget bytes\n", nbytes, budget_bytes);
-
- printf("--------------------------------------------------\n");
- printf("4.- fna_network_get_min_effective_budget\n");
- printf("--------------------------------------------------\n");
- err=rtep_fna_operations.fna_network_get_min_eff_budget
- (FRSH_RESOURCE_ID_DEFAULT, &budget_timespec);
- assert (err == 0);
-
- err=rtep_fna_operations.fna_network_budget_to_bytes
- (FRSH_RESOURCE_ID_DEFAULT, &budget_timespec, &budget_bytes);
- assert (err == 0);
- printf("Minimum effective budget: %d\n", budget_bytes);
-
- // send or receive
- me = rtep_get_station_id();
-
- if (me == 1) {
-
- printf("--------------------------------------------------\n");
- printf("5.- fna_contract_negotiate\n");
- printf("--------------------------------------------------\n");
-
- period_max.tv_sec = 3;
- period_max.tv_nsec = 0;
-
- // Create the contract
- frsh_contract.workload = FRSH_WT_INDETERMINATE;
- frsh_contract.granularity = FRSH_DEFAULT_GRANULARITY;
- frsh_contract.weight = FRSH_DEFAULT_WEIGHT;
- frsh_contract.importance = FRSH_DEFAULT_IMPORTANCE;
- frsh_contract.resource_id = FRSH_RESOURCE_ID_DEFAULT;
- frsh_contract.resource_type = FRSH_RT_NETWORK;
-
- frsh_contract.budget_min = budget_timespec;
- frsh_contract.period_max = period_max;
- frsh_contract.d_equals_t = true;
- frsh_contract.preemption_level = 4;
-
- // Negotiate the contract
- err = rtep_fna_operations.fna_contract_negotiate
- (FRSH_RESOURCE_ID_DEFAULT, &frsh_contract, &vres);
- assert (err == 0);
- printf("Contract accepted\n");
-
- // Bind the vres to an endpoint
- endpoint.endpoint_type = FRSH_SEND_ENDPOINT_TYPE;
- endpoint.vres = vres;
- endpoint.is_bound = true;
- endpoint.destination = 2; // only for send_endpoints
- endpoint.resource_id = FRSH_RESOURCE_ID_DEFAULT;
- endpoint.stream_id = 7;
-
- msg_counter = 0;
-
- while(1) {
- sleep(4);
- printf("sending message\n");
-
- msg_counter = msg_counter + 1;
- msg_size = snprintf(msg_buffer, MSG_BUFFER_MX-1, "MSG %d", msg_counter);
-
- err = rtep_fna_operations.fna_send_async
- (&endpoint, msg_buffer, msg_size);
- assert (err == 0);
- }
- } else {
- size_t received_bytes;
- frsh_network_address_t from;
-
- endpoint.endpoint_type = FRSH_RECEIVE_ENDPOINT_TYPE;
- endpoint.is_bound = false;
- endpoint.resource_id = FRSH_RESOURCE_ID_DEFAULT;
- endpoint.stream_id = 7;
-
- while(1) {
- printf("blocking to receive\n");
- err = rtep_fna_operations.fna_receive_sync
- (&endpoint, msg_buffer, MSG_BUFFER_MX, &received_bytes, &from);
- assert (err == 0);
-
- msg_buffer[received_bytes] = '\0';
-
- printf("msg received: %s\n", msg_buffer);
- }
- }
-
- return 0;
-}
+++ /dev/null
-//----------------------------------------------------------------------
-// Copyright (C) 2006 - 2007 by the FRESCOR consortium:
-//
-// Universidad de Cantabria, SPAIN
-// University of York, UK
-// Scuola Superiore Sant'Anna, ITALY
-// Kaiserslautern University, GERMANY
-// Univ. Politecnica Valencia, SPAIN
-// Czech Technical University in Prague, CZECH REPUBLIC
-// ENEA SWEDEN
-// Thales Communication S.A. FRANCE
-// Visual Tools S.A. SPAIN
-// Rapita Systems Ltd UK
-// Evidence ITALY
-//
-// See http://www.frescor.org
-//
-// The FRESCOR project (FP6/2005/IST/5-034026) is funded
-// in part by the European Union Sixth Framework Programme
-// The European Union is not liable of any use that may be
-// made of this code.
-//
-//
-// based on previous work (FSF) done in the FIRST project
-//
-// Copyright (C) 2005 Mälardalen University, SWEDEN
-// Scuola Superiore S.Anna, ITALY
-// Universidad de Cantabria, SPAIN
-// University of York, UK
-//
-// This file is part of FNA (Frescor Network Adaptation)
-//
-// FNA is free software; you can redistribute it and/or modify it
-// under terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option) any
-// later version. FNA is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details. You should have received a
-// copy of the GNU General Public License along with FNA; see file
-// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
-// Cambridge, MA 02139, USA.
-//
-// As a special exception, including FNA header files in a file,
-// instantiating FNA generics or templates, or linking other files
-// with FNA objects to produce an executable application, does not
-// by itself cause the resulting executable application to be covered
-// by the GNU General Public License. This exception does not
-// however invalidate any other reasons why the executable file might be
-// covered by the GNU Public License.
-// -----------------------------------------------------------------------
-
-/*
- * test_c_rtep_frsh_fna.c
- *
- * Goal:
- *
- * The goal of this program is to test the RTEP functions defined at frsh_fna.h
- * which is the public part of frsh_fna.h. The interface of this public part
- * is dependent of the underlying network protocol. We are not trying here to
- * make a very intense test but a simple and basic one to check the correct
- * behaviour of the functions.
- *
- * Algorithm:
- *
- * First we check the conversions between frsh and rtep addresses and streams.
- * Then, we check the renegotiation functions for the period of the internal
- * negotiation messages. And finally, we check the renegotiation functions for
- * the internal service thread.
- *
- */
-
-#include <assert.h> // for assert
-#include <stdio.h> // for printf
-#include <stdbool.h> // for bool
-
-#include "frsh_core_types.h" // for FRSH_RESOURCE_ID_DEFAULT
-#include "frsh_distributed_types.h" // frsh_network_address_t, frsh_stream_id_t
-
-#include "rtep_fna.h" // for rtep_fna_operations.fna_init
-#include "rtep.h" // for rtep_station_id_t, rtep_channel_t
-
-#include "frsh_fna.h" // for frsh_rtep_*
-
-int main ()
-{
- int err;
- rtep_station_id_t rtep_station = 3;
- frsh_network_address_t frsh_address;
- rtep_channel_t in_stream = 7;
- frsh_stream_id_t out_stream;
- struct timespec neg_period = {2,0};
- struct timespec get_period = {0,0};
-// struct timespec rtep_serv_thread_budget = {1,0};
-// struct timespec rtep_serv_thread_period = {5,0};
-// bool serv_thread_renegotiation_accepted = false;
-// struct timespec current_serv_thread_budget = {0,0};
-// struct timespec current_serv_thread_period = {0,0};
-
- printf("1.- fna_init\n");
- err=rtep_fna_operations.fna_init(FRSH_RESOURCE_ID_DEFAULT);
- assert(err == 0);
-
- printf("2.- frsh_rtep_map_network_address\n");
- err=frsh_rtep_map_network_address
- (FRSH_RESOURCE_ID_DEFAULT, rtep_station, &frsh_address);
- assert(err == 0);
- printf("rtep_address:%d -> frsh_address:%d\n", rtep_station, frsh_address);
- assert(rtep_station == frsh_address);
-
- printf("3.- frsh_rtep_map_stream_id\n");
- err=frsh_rtep_map_stream_id
- (FRSH_RESOURCE_ID_DEFAULT, in_stream, &out_stream);
- assert(err == 0);
- printf("rtep_channel:%d -> frsh_stream:%d\n", in_stream, out_stream);
- assert(in_stream == out_stream);
-
- printf("4.- frsh_rtep_negotiation_messages_vres_renegotiate period\n");
- err=frsh_rtep_negotiation_messages_vres_get_period
- (FRSH_RESOURCE_ID_DEFAULT, &get_period);
- assert(err == 0);
- printf("period before renegotiation: sec=%d nsec=%d\n",
- get_period.tv_sec, get_period.tv_nsec);
-
- err=frsh_rtep_negotiation_messages_vres_renegotiate
- (FRSH_RESOURCE_ID_DEFAULT, &neg_period);
- if (err == 0) {
- printf("renegotiation accepted (period negotiated: sec=%d nsec=%d)\n",
- neg_period.tv_sec, neg_period.tv_nsec);
- } else {
- printf("renegotiation not accepted\n");
- }
- assert (err == 0);
-
- err=frsh_rtep_negotiation_messages_vres_get_period
- (FRSH_RESOURCE_ID_DEFAULT, &get_period);
- assert(err == 0);
- printf("period after renegotiation: sec=%d nsec=%d\n",
- get_period.tv_sec, get_period.tv_nsec);
-
-// TODO: uncomment step 5 when internal thread has a frescor contract
-// printf("5.- frsh_rtep_service_thread_vres_renegotiate\n");
-//
-// err=frsh_rtep_service_thread_vres_get_budget_and_period
-// (FRSH_RESOURCE_ID_DEFAULT,
-// ¤t_serv_thread_budget,
-// ¤t_serv_thread_period);
-// assert(err == 0);
-// printf("service thread budget (before renegotiation): sec=%d nsec=%d\n",
-// current_serv_thread_budget.tv_sec,
-// current_serv_thread_budget.tv_nsec);
-// printf("service thread period (before renegotiation): sec=%d nsec=%d\n",
-// current_serv_thread_period.tv_sec,
-// current_serv_thread_period.tv_nsec);
-//
-// err=frsh_rtep_service_thread_vres_renegotiate
-// (FRSH_RESOURCE_ID_DEFAULT,
-// &rtep_serv_thread_budget,
-// &rtep_serv_thread_period,
-// &serv_thread_renegotiation_accepted);
-// assert(err == 0);
-//
-// if (serv_thread_renegotiation_accepted) {
-// printf("service_thread renegotiation accepted\n");
-// } else {
-// printf("service_thread renegotiation not accepted\n");
-// }
-// assert (err == 0);
-//
-// err=frsh_rtep_service_thread_vres_get_budget_and_period
-// (FRSH_RESOURCE_ID_DEFAULT,
-// ¤t_serv_thread_budget,
-// ¤t_serv_thread_period);
-// assert(err == 0);
-// printf("service thread budget (after renegotiation): sec=%d nsec=%d\n",
-// current_serv_thread_budget.tv_sec,
-// current_serv_thread_budget.tv_nsec);
-// printf("service thread period (after renegotiation): sec=%d nsec=%d\n",
-// current_serv_thread_period.tv_sec,
-// current_serv_thread_period.tv_nsec);
-
- printf("\nEND of the TEST\n");
- return 0;
-}