1 /**************************************************************************/
2 /* Copyright (C) 2010 Czech Technical University in Prague */
4 /* This file is part of FRSH (FRescor ScHeduler) */
6 /* FRSH is free software; you can redistribute it and/or modify it */
7 /* under terms of the GNU General Public License as published by the */
8 /* Free Software Foundation; either version 2, or (at your option) any */
9 /* later version. FRSH is distributed in the hope that it will be */
10 /* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
11 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
12 /* General Public License for more details. You should have received a */
13 /* copy of the GNU General Public License along with FRSH; see file */
14 /* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
15 /* Cambridge, MA 02139, USA. */
17 /* As a special exception, including FRSH header files in a file, */
18 /* instantiating FRSH generics or templates, or linking other files */
19 /* with FRSH objects to produce an executable application, does not */
20 /* by itself cause the resulting executable application to be covered */
21 /* by the GNU General Public License. This exception does not */
22 /* however invalidate any other reasons why the executable file might be */
23 /* covered by the GNU Public License. */
24 /**************************************************************************/
27 * @file frsh_transaction.c
28 * @author Michal Sojka <sojkam1@fel.cvut.cz>
30 * @brief Implementation of FRSH transaction negotiation.
34 #include <frsh_transaction.h>
35 #include <fres_transaction.h>
37 #include "frsh_forb.h"
40 frsh_transaction_init(frsh_transaction_t *transaction,
45 ret = FRSH_ERR_BAD_ARGUMENT;
48 *transaction = fres_transaction_new();
49 (*transaction)->name = name;
55 frsh_transaction_destroy(frsh_transaction_t *transaction)
57 fres_transaction_destroy(*transaction);
61 frsh_transaction_add_contract(frsh_transaction_t *transaction,
62 frsh_contract_t *contract,
66 if (!transaction || !*transaction ||
67 !contract || !*contract ||
69 ret = FRSH_ERR_BAD_ARGUMENT;
73 ret = fres_transaction_add_contract(*transaction, *contract);
83 frsh_transaction_negotiate(frsh_transaction_t *trans)
87 if (!trans || !*trans) {
88 ret = FRSH_ERR_BAD_ARGUMENT;
91 ret = fres_contract_broker_negotiate_transaction(
92 frsh_forb_global.fcb, *trans, &env);
93 if (forb_exception_occurred(&env)) {
94 ret = fres_forbex2err(&env);
102 frsh_transaction_cancel(frsh_transaction_t *trans)
104 return FRSH_ERR_NOT_IMPLEMENTED;
108 frsh_transaction_wait_for_name(frsh_transaction_t *transaction,
111 return FRSH_ERR_NOT_IMPLEMENTED;
115 frsh_transaction_alloc_vres(frsh_transaction_t *t,
117 frsh_vres_id_t *vres)
119 return FRSH_ERR_NOT_IMPLEMENTED;