LogService
libdadi: utility tools for distributed applications
LogCentralComponent_impl.hh
1 /****************************************************************************/
2 /* Header corresponding to the LogComponentComponent interface */
3 /* */
4 /* Author(s): */
5 /* - Georg Hoesch (hoesch@in.tum.de) */
6 /* - Cyrille Pontvieux (cyrille.pontvieux@edu.univ-fcomte.fr) */
7 /* */
8 /* This file is part of DIET . */
9 /* */
10 /* Copyright (C) 2000-2003 ENS Lyon, LIFC, INSA, INRIA and SysFera (2000) */
11 /* */
12 /* - Frederic.Desprez@ens-lyon.fr (Project Manager) */
13 /* - Eddy.Caron@ens-lyon.fr (Technical Manager) */
14 /* - Tech@sysfera.com (Maintainer and Technical Support) */
15 /* */
16 /* This software is a computer program whose purpose is to provide an */
17 /* distributed logging services. */
18 /* */
19 /* */
20 /* This software is governed by the CeCILL license under French law and */
21 /* abiding by the rules of distribution of free software. You can use, */
22 /* modify and/ or redistribute the software under the terms of the CeCILL */
23 /* license as circulated by CEA, CNRS and INRIA at the following URL */
24 /* "http://www.cecill.info". */
25 /* */
26 /* As a counterpart to the access to the source code and rights to copy, */
27 /* modify and redistribute granted by the license, users are provided */
28 /* only with a limited warranty and the software's author, the holder */
29 /* of the economic rights, and the successive licensors have only */
30 /* limited liability. */
31 /* */
32 /* In this respect, the user's attention is drawn to the risks */
33 /* associated with loading, using, modifying and/or developing or */
34 /* reproducing the software by the user in light of its specific status */
35 /* of free software, that may mean that it is complicated to */
36 /* manipulate, and that also therefore means that it is reserved for */
37 /* developers and experienced professionals having in-depth computer */
38 /* knowledge. Users are therefore encouraged to load and test the */
39 /* software's suitability as regards their requirements in conditions */
40 /* enabling the security of their systems and/or data to be ensured and, */
41 /* more generally, to use and operate it in the same conditions as */
42 /* regards security. */
43 /* */
44 /* The fact that you are presently reading this means that you have had */
45 /* knowledge of the CeCILL license and that you accept its terms. */
46 /* */
47 /****************************************************************************/
48 /* $Id$
49  * $Log$
50  * Revision 1.4 2010/12/13 12:21:14 kcoulomb
51  * Clean types
52  *
53  * Revision 1.3 2010/12/03 12:40:27 kcoulomb
54  * MAJ log to use forwarders
55  *
56  * Revision 1.2 2010/11/10 02:27:44 kcoulomb
57  * Update the log to use the forwarder.
58  * Programm run without launching forwarders but fails with forwarder.
59  *
60  * Revision 1.1 2004/01/09 11:07:12 ghoesch
61  * Restructured the whole LogService source tree.
62  * Added autotools make process. Cleaned up code.
63  * Removed some testers. Ready to release.
64  *
65  ***************************************************************************/
66 
67 #ifndef _LOGCENTRALCOMPONENT_IMPL_HH_
68 #define _LOGCENTRALCOMPONENT_IMPL_HH_
69 
70 #include "LogTypes.hh"
71 #include "LogComponent.hh"
72 #include "ComponentList.hh"
73 #include "FilterManagerInterface.hh"
74 #include "TimeBuffer.hh"
75 #include "FullLinkedList.hh"
76 
77 #include "CorbaLogForwarder.hh"
78 
79 
100 class LastPing {
101 public:
102  LastPing();
103 
104  LastPing(LastPing& newLastPing);
105 
106  ~LastPing();
107 
108  LastPing&
109  operator=(LastPing& newLastPing);
110 
111  char* name;
112  log_time_t time;
113  log_time_t timeDifference;
114 };
115 
117 
119  : public POA_LogCentralComponent,
120  public PortableServer::RefCountServantBase {
121 public:
123  FilterManagerInterface* filterManager,
124  TimeBuffer* timeBuffer);
125 
127 
128  void
129  test();
130 
151  CORBA::Short
152  connectComponent(char*& componentName,
153  const char* componentHostname,
154  const char* message,
155  const char* compConfigurator,
156  const log_time_t& componentTime,
157  tag_list_t& initialConfig);
158 
159 
170  CORBA::Short
171  disconnectComponent(const char* componentName, const char* message);
172 
173 
178  void
179  sendBuffer(const log_msg_buf_t& buffer);
180 
186  bool
187  isComponentExists(const char* name, ComponentList::ReadIterator* it);
188 
195  void
196  ping(const char* componentName);
197 
203  void
204  synchronize(const char* componentName, const log_time_t& componentTime);
205 
209 // char*
210 // getHostnameOf(const char* toto);
211 
212 private:
218  char*
219  getGeneratedName(const char* hostname, ComponentList::ReadIterator* it);
220 
221  class AliveCheckThread:public omni_thread {
222  public:
223  explicit AliveCheckThread(LogCentralComponent_impl* LCC);
224 
225  ~AliveCheckThread();
229  void
230  startThread();
234  void
235  stopThread();
236 
237  private:
238  void*
239  run_undetached(void* params);
240 
242  bool threadRunning;
243  };
244 
245  friend class LogCentralComponent_impl::AliveCheckThread;
246 
247 private:
248  ComponentList* componentList;
249  FilterManagerInterface* filterManager;
250  TimeBuffer* timeBuffer;
251  LastPings* lastPings;
252  AliveCheckThread* aliveCheckThread;
253 };
254 
255 
256 
259  public PortableServer::RefCountServantBase {
260 public:
261  LogCentralComponentFwdrImpl(CorbaLogForwarder_ptr fwdr, const char *objName);
262 
264 
265  CORBA::Short
266  connectComponent(char*& componentName,
267  const char* componentHostname,
268  const char* message,
269  const char* compConfigurator,
270  const log_time_t& componentTime,
271  tag_list_t& initialConfig);
272 
273  CORBA::Short
274  disconnectComponent(const char* componentName, const char* message);
275 
276  void
277  sendBuffer(const log_msg_buf_t& buffer);
278 
279  void
280  ping(const char* componentName);
281 
282 
283  void
284  synchronize(const char* componentName, const log_time_t& componentTime);
285 
286  void
287  test();
288 
289 protected:
290  CorbaLogForwarder_ptr forwarder;
291  char* objName;
292 
293 private:
294  ComponentList* componentList;
295  FilterManagerInterface* filterManager;
296  TimeBuffer* timeBuffer;
297  LastPings* lastPings;
298 };
299 
300 
303  public PortableServer::RefCountServantBase {
304 public:
306  const char* objName);
307 
309 
310  void
311  setTagFilter(const tag_list_t& tagList);
312 
313  void
314  addTagFilter(const tag_list_t& tagList);
315 
316  void
317  removeTagFilter(const tag_list_t& tagList);
318 
319  void
320  test();
321 
322 protected:
323  CorbaLogForwarder_ptr forwarder;
324  char* objName;
325 };
326 
327 #endif
Definition: FullLinkedList.hh:263
Definition: TimeBuffer.hh:66
Definition: LogCentralComponent_impl.hh:118
Definition: LogCentralComponent_impl.hh:301
Definition: LogTypes.hh:57
Definition: LogTypes.hh:107
Definition: LogCentralComponent_impl.hh:257
Definition: CorbaLogForwarder.hh:141
Definition: LogTypes.hh:221
Definition: LogComponentFwdr.hh:674
Definition: FilterManagerInterface.hh:73
Definition: FullLinkedList.hh:88
Definition: LogComponentFwdr.hh:549
Definition: LogCentralComponent_impl.hh:100
Definition: LogComponent.hh:388