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;
71 string name; /**< Human understandable name of the resource (used by frm_gui) */
75 frsh_resource_type_t restype;
76 frsh_resource_id_t resid;
80 typedef sequence<resource> resource_seq;
82 interface contract_broker {
83 const string reg_name = "fcb";
85 * Registers a resource with the contract broker
89 * @param res_desc Description of the resource
91 * @return Zero on success, non-zero error code on error.
93 long register_resource(in frsh_resource_type_t restype,
94 in frsh_resource_id_t resid,
95 in resource_desc res_desc);
98 * Registers a resource allocator with the contract broker
104 * @return Zero on success, non-zero error code on error.
106 long register_allocator(in frsh_resource_type_t restype,
107 in frsh_resource_id_t resid,
108 in resource_allocator rs_obj);
110 long deregister_allocator(in resource_allocator rs_obj);
113 * This function performs a set of negotiation
114 * operations with one resource. The oprations can
115 * include: adding new contracts (neg), modifying
116 * existing vres (reneg) or cancelling existing vres
117 * (cancel). It is guarantied that either all
118 * operation will be completed or none of them.
120 * @param[in] contracts Contract(s) to negotiate,
121 * renegotiate or cancel. The operation on the
122 * contract is determined as follows:
123 * - neg: contracts without ID
124 * - cancel: contracts with an ID and without any block
125 * - reneg: contracts with ID and some blocks (the old
126 * contract will we replaced by the new one).
128 * @param[out] ids IDs of the newly negotiated
129 * contracts, if negotiation was successful. Ordering
130 * of IDs is the same as in @a contracts.
132 * @return Zero if all operations were successfully
133 * carried out, non-zero code on error or when
134 * negotiation failed.
136 long negotiate_contracts(in contract::ptr_seq contracts, out contract::id_seq ids);
139 * Redistributes spare capacity for a given resource.
140 * This is meant as a support for resources with
141 * variable capacity (WiFi) as a mean for applications
142 * to adapt to the changed capacity.
144 * @param restype For which resource to perform
147 void redistribute_spare_capacity(in frsh_resource_type_t restype,
148 in frsh_resource_id_t resid);
151 * Returns sequence of registered resources.
153 * @param[out] resources
155 void get_resources(out resource_seq resources);