]> rtime.felk.cvut.cz Git - frescor/forb.git/blob - src/exec_req.h
Prepared for multiple executors in a single address space
[frescor/forb.git] / src / exec_req.h
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 /*  This file is part of FORB (Frescor Object Request Broker)             */
26 /*                                                                        */
27 /* FORB is free software; you can redistribute it and/or modify it        */
28 /* under terms of the GNU General Public License as published by the      */
29 /* Free Software Foundation; either version 2, or (at your option) any    */
30 /* later version.  FORB is distributed in the hope that it will be        */
31 /* useful, but WITHOUT ANY WARRANTY; without even the implied warranty    */
32 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU    */
33 /* General Public License for more details. You should have received a    */
34 /* copy of the GNU General Public License along with FORB; see file       */
35 /* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,  */
36 /* Cambridge, MA 02139, USA.                                              */
37 /*                                                                        */
38 /* As a special exception, including FORB header files in a file,         */
39 /* instantiating FORB generics or templates, or linking other files       */
40 /* with FORB objects to produce an executable application, does not       */
41 /* by itself cause the resulting executable application to be covered     */
42 /* by the GNU General Public License. This exception does not             */
43 /* however invalidate any other reasons why the executable file might be  */
44 /* covered by the GNU Public License.                                     */
45 /**************************************************************************/
46
47 /**
48  * @file   exec_req.h
49  * @author Michal Sojka <sojkam1@fel.cvut.cz>
50  * @date   Sun Oct 12 16:21:40 2008
51  * 
52  * @brief  Data type and functions prototypes for requests to executors.
53  * 
54  * 
55  */
56
57 #ifndef FORB_EXEC_REQ_H
58 #define FORB_EXEC_REQ_H
59
60 #include <forb.h>
61 #include <forb/cdr_codec.h>
62 #include <forb/cdr.h>
63 #include <ul_list.h>
64 #include "executor.h"
65 #include "request.h"
66
67 /**
68  * Distinguishing execution methods of a request.
69  */
70 enum FORB_EXEC_REQ_TYPE {
71         local,          // no serialization used
72         remote
73 };
74
75 /**
76  * Request for ::forb_executor_t.
77  * 
78  */
79 typedef struct forb_exec_req {
80         unsigned request_id;    /**< Request ID. Used to prepare reply message. */
81         forb_server_id source;  /**< Source of this request. */
82         forb_object obj;        /**< Object which is requested */
83         unsigned method_index;  /**< Mehotd number to be invoked on the object @a obj. */
84         FORB_CDR_Codec codec;   /**< Bufffer with serialized request parameters. */
85         ul_list_node_t node;    /**< Node for forb_executor_t::requests. */
86         enum FORB_EXEC_REQ_TYPE request_type; /**< Execution method. */
87         forb_request_t *input_request; /**< Input request data for the case of local invocation */
88 } forb_exec_req_t;
89
90 UL_LIST_CUST_DEC(forb_exec_req_nolock, /* cust_prefix */
91                  forb_executor_t, /* cust_head_t */
92                  forb_exec_req_t, /* cust_item_t */
93                  requests, /* cust_head_field */
94                  node); /* cust_node_field */
95                  
96
97 void forb_exec_req_process(forb_exec_req_t *exec_req);
98
99 void forb_exec_req_ins_tail(forb_executor_t *executor,
100                             forb_exec_req_t *exec_req);
101 void forb_exec_req_destroy(forb_exec_req_t *exec_req);
102
103 #endif