SUBDIRS = tests
shared_LIBRARIES = frsh
-frsh_SOURCES = frsh_contract.c frsh_vres.c frsh_synchobj.c frsh_core.c \
- frsh_spare_capacity.c frsh_error.c frsh_thread.c frsh_sharedobj.c frsh_power.c frsh_feedback.c
+frsh_SOURCES = frsh_contract.c frsh_vres.c frsh_synchobj.c frsh_core.c \
+ frsh_spare_capacity.c frsh_error.c frsh_thread.c \
+ frsh_sharedobj.c frsh_power.c frsh_feedback.c \
+ frsh_transaction.c
include_HEADERS = frsh_opaque_types.h frsh_forb.h
frsh_LIBS = fcb_client forb contract synchobj sharedobj fra ulut fosa $(allocator-libs-y) $(platform-libs-y)
--- /dev/null
+/**************************************************************************/
+/* Copyright (C) 2010 Czech Technical University in Prague */
+/* */
+/* This file is part of FRSH (FRescor ScHeduler) */
+/* */
+/* FRSH 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. FRSH 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 FRSH; see file */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
+/* Cambridge, MA 02139, USA. */
+/* */
+/* As a special exception, including FRSH header files in a file, */
+/* instantiating FRSH generics or templates, or linking other files */
+/* with FRSH 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. */
+/**************************************************************************/
+
+/**
+ * @file frsh_transaction.c
+ * @author Michal Sojka <sojkam1@fel.cvut.cz>
+ *
+ * @brief Implementation of FRSH transaction negotiation.
+ */
+
+#include <frsh.h>
+#include <frsh_transaction.h>
+
+
+int
+frsh_transaction_negotiate(frsh_transaction_t *trans)
+{
+ return FRSH_ERR_NOT_IMPLEMENTED;
+}
+
WVTEST_MAIN("transaction negotiation")
{
+ frsh_contract_t contract[3];
+ const frsh_resource_id_t id[3] = { 255, 0, 1 };
+ frsh_contract_label_t label[3];
+ frsh_rel_time_t budget, period;
+ int i;
+ fres_transaction_t *t;
+
WVFRSH(frsh_init());
WVFRSH(fra_dummy_init_and_activate_id(0));
WVFRSH(fra_dummy_init_and_activate_id(1));
+
+ WVPASS(t = fres_transaction_new());
+
+ for (i = 0; i < 3; i++) {
+ WVFRSH(frsh_contract_init(&contract[i]));
+ sprintf(label[i], "contract%d", i);
+ WVFRSH(frsh_contract_set_resource_and_label(
+ &contract[i],
+ DUMMY_RESOURCE_TYPE, id[i],
+ label[i]));
+
+ budget = fosa_msec_to_rel_time(10);
+ period = fosa_msec_to_rel_time(100);
+ WVFRSH(frsh_contract_set_basic_params(&contract[i],
+ &budget,
+ &period,
+ FRSH_WT_BOUNDED,
+ FRSH_CT_REGULAR));
+
+ WVPASS(fres_transaction_add_contract(t, contract[i]) > 0);
+ }
+ WVFRSH(frsh_transaction_negotiate(t));
frsh_destroy();
}