]> rtime.felk.cvut.cz Git - frescor/frsh.git/blob - fres/cbroker/fcb.idl
Generic allocator: unify terminology (scheduler/allocator)
[frescor/frsh.git] / fres / cbroker / fcb.idl
1 ////////////////////////////////////////////////////////////////////////////
2 // ---------------------------------------------------------------------- //
3 // Copyright (C) 2006 - 2008 FRESCOR consortium partners:                 //
4 //                                                                        //
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                //
11 //   ENEA                                   SWEDEN                        //
12 //   Thales Communication S.A.              FRANCE                        //
13 //   Visual Tools S.A.                      SPAIN                         //
14 //   Rapita Systems Ltd                     UK                            //
15 //   Evidence                               ITALY                         //
16 //                                                                        //
17 //   See http://www.frescor.org for a link to partners' websites          //
18 //                                                                        //
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.                                               //
23 //                                                                        //
24 //                                                                        //
25 // based on previous work (FSF) done in the FIRST project                 //
26 //                                                                        //
27 //  Copyright (C) 2005  Mälardalen University, SWEDEN                    //
28 //                      Scuola Superiore S.Anna, ITALY                    //
29 //                      Universidad de Cantabria, SPAIN                   //
30 //                      University of York, UK                            //
31 //                                                                        //
32 //  FSF API web pages: http:marte.unican.es/fsf/docs                      //
33 //                     http:shark.sssup.it/contrib/first/docs/            //
34 //                                                                        //
35 //  This file is part of FORB (Frescor Object Request Broker)             //
36 //                                                                        //
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.                                              //
47 //                                                                        //
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 ////////////////////////////////////////////////////////////////////////////
56
57 #ifndef _CM_IDL
58 #define _CM_IDL
59
60 #include "../contract/fres_contract_idl.idl"
61 #include "../contract/fres_blocks.idl"
62 #include "../resmng/frm.idl"
63 #include "../resalloc/fra.idl"
64
65 module fres {
66
67         /** Description of a resource */
68         struct resource_desc {
69                 /** Manager */
70                 resource_manager     manager;
71         };
72
73         struct resource {
74                 frsh_resource_type_t restype;
75                 frsh_resource_id_t   resid;
76                 resource_desc        desc;
77         };
78         
79         typedef sequence<resource> resource_seq;
80         
81         interface contract_broker {
82                 const string reg_name = "fcb";
83                 /** 
84                  * Registers a resource with the contract broker
85                  * 
86                  * @param restype 
87                  * @param resid 
88                  * @param res_desc Description of the resource
89                  * 
90                  * @return Zero on success, non-zero error code on error.
91                  */
92                 long register_resource(in frsh_resource_type_t restype,
93                                        in frsh_resource_id_t   resid,
94                                        in resource_desc        res_desc);
95
96                 /** 
97                  * Registers a resource allocator with the contract broker
98                  * 
99                  * @param restype 
100                  * @param resid 
101                  * @param rs_obj 
102                  * 
103                  * @return Zero on success, non-zero error code on error.
104                  */
105                 long register_allocator(in frsh_resource_type_t restype,
106                                         in frsh_resource_id_t   resid,
107                                         in resource_allocator   rs_obj);
108                 
109                 long deregister_allocator(in resource_allocator rs_obj);
110
111                 /** 
112                  * Tries to negotiate a contract 
113                  * 
114                  * @param[in] contract Contract to negotiate
115                  * 
116                  * @param[out] id Global ID of the contract if
117                  * negotiation was successful.
118                  * 
119                  * @return Zero if the contract was successfully
120                  * negotiated, non-zero code on error or when
121                  * negotiation failed.
122                  *
123                  * @todo Convert @a contract to @c sequence<contract::ptr>.
124                  */
125                 long negotiate_contract(in contract::ptr contract, out fres::contract::id_t id);
126                 
127                 /** 
128                  * Cancels a previously negotiated contract
129                  * 
130                  * @param id ID of the contract to cancel
131                  * 
132                  * @return Zero if the contract was successfully
133                  * canceled, non-zero code on error.
134                  */
135                 long cancel_contract(in contract::id_t id);
136
137                 /** 
138                  * Returns sequence of registered resources.
139                  * 
140                  * @param[out] resources
141                  */
142                 void get_resources(out resource_seq resources);
143         };
144 };
145
146 #endif