1 ////////////////////////////////////////////////////////////////////////////
2 // ---------------------------------------------------------------------- //
3 // Copyright (C) 2006 - 2008 FRESCOR consortium partners: //
5 // Universidad de Cantabria, SPAIN //
6 // University of York, UK //
7 // Scuola Superiore Sant'Anna, ITALY //
8 // Kaiserslautern University, GERMANY //
9 // Univ. Politécnica Valencia, SPAIN //
10 // Czech Technical University in Prague, CZECH REPUBLIC //
12 // Thales Communication S.A. FRANCE //
13 // Visual Tools S.A. SPAIN //
14 // Rapita Systems Ltd UK //
17 // See http://www.frescor.org for a link to partners' websites //
19 // FRESCOR project (FP6/2005/IST/5-034026) is funded //
20 // in part by the European Union Sixth Framework Programme //
21 // The European Union is not liable of any use that may be //
22 // made of this code. //
25 // based on previous work (FSF) done in the FIRST project //
27 // Copyright (C) 2005 Mälardalen University, SWEDEN //
28 // Scuola Superiore S.Anna, ITALY //
29 // Universidad de Cantabria, SPAIN //
30 // University of York, UK //
32 // FSF API web pages: http:marte.unican.es/fsf/docs //
33 // http:shark.sssup.it/contrib/first/docs/ //
35 // This file is part of FORB (Frescor Object Request Broker) //
37 // FORB is free software; you can redistribute it and/or modify it //
38 // under terms of the GNU General Public License as published by the //
39 // Free Software Foundation; either version 2, or (at your option) any //
40 // later version. FORB is distributed in the hope that it will be //
41 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty //
42 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
43 // General Public License for more details. You should have received a //
44 // copy of the GNU General Public License along with FORB; see file //
45 // COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, //
46 // Cambridge, MA 02139, USA. //
48 // As a special exception, including FORB header files in a file, //
49 // instantiating FORB generics or templates, or linking other files //
50 // with FORB objects to produce an executable application, does not //
51 // by itself cause the resulting executable application to be covered //
52 // by the GNU General Public License. This exception does not //
53 // however invalidate any other reasons why the executable file might be //
54 // covered by the GNU Public License. //
55 ////////////////////////////////////////////////////////////////////////////
60 #include "../contract/fres_contract_idl.idl"
61 #include "../contract/fres_blocks.idl"
62 #include "../resmng/frm.idl"
63 #include "../resalloc/fra.idl"
67 /** Description of a resource */
68 struct resource_desc {
70 resource_manager manager;
74 frsh_resource_type_t restype;
75 frsh_resource_id_t resid;
79 typedef sequence<resource> resource_seq;
81 interface contract_broker {
82 const string reg_name = "fcb";
84 * Registers a resource with the contract broker
88 * @param res_desc Description of the resource
90 * @return Zero on success, non-zero error code on error.
92 long register_resource(in frsh_resource_type_t restype,
93 in frsh_resource_id_t resid,
94 in resource_desc res_desc);
97 * Registers a resource allocator with the contract broker
103 * @return Zero on success, non-zero error code on error.
105 long register_allocator(in frsh_resource_type_t restype,
106 in frsh_resource_id_t resid,
107 in resource_allocator rs_obj);
109 long deregister_allocator(in resource_allocator rs_obj);
112 * Tries to negotiate a contract
114 * @param[in] contract Contract to negotiate
116 * @param[out] id Global ID of the contract if
117 * negotiation was successful.
119 * @return Zero if the contract was successfully
120 * negotiated, non-zero code on error or when
121 * negotiation failed.
123 * @todo Convert @a contract to @c sequence<contract::ptr>.
125 long negotiate_contract(in contract::ptr contract, out fres::contract::id_t id);
128 * Cancels a previously negotiated contract
130 * @param id ID of the contract to cancel
132 * @return Zero if the contract was successfully
133 * canceled, non-zero code on error.
135 long cancel_contract(in contract::id_t id);
138 * Returns sequence of registered resources.
140 * @param[out] resources
142 void get_resources(out resource_seq resources);