IBR-DTN  1.0.0
EventConnection.h
Go to the documentation of this file.
1 /*
2  * EventConnection.h
3  *
4  * Copyright (C) 2011 IBR, TU Braunschweig
5  *
6  * Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 
22 #ifndef EVENTCONNECTION_H_
23 #define EVENTCONNECTION_H_
24 
25 #include "api/ClientHandler.h"
26 #include "core/EventReceiver.h"
27 
28 #include "core/NodeEvent.h"
29 #include "core/GlobalEvent.h"
30 #include "core/CustodyEvent.h"
34 #include "net/ConnectionEvent.h"
36 
37 namespace dtn
38 {
39  namespace api
40  {
42  public dtn::core::EventReceiver<dtn::core::NodeEvent>,
43  public dtn::core::EventReceiver<dtn::core::GlobalEvent>,
44  public dtn::core::EventReceiver<dtn::core::CustodyEvent>,
45  public dtn::core::EventReceiver<dtn::net::BundleReceivedEvent>,
46  public dtn::core::EventReceiver<dtn::net::TransferAbortedEvent>,
47  public dtn::core::EventReceiver<dtn::net::TransferCompletedEvent>,
48  public dtn::core::EventReceiver<dtn::net::ConnectionEvent>,
49  public dtn::core::EventReceiver<dtn::routing::QueueBundleEvent>
50  {
51  public:
52  EventConnection(ClientHandler &client, ibrcommon::socketstream &stream);
53  virtual ~EventConnection();
54 
55  void run();
56  void finally();
57  void setup();
58  void __cancellation() throw ();
59 
60  void raiseEvent(const dtn::core::NodeEvent &evt) throw ();
61  void raiseEvent(const dtn::core::GlobalEvent &evt) throw ();
62  void raiseEvent(const dtn::core::CustodyEvent &evt) throw ();
63  void raiseEvent(const dtn::net::BundleReceivedEvent &evt) throw ();
64  void raiseEvent(const dtn::net::TransferAbortedEvent &evt) throw ();
65  void raiseEvent(const dtn::net::TransferCompletedEvent &evt) throw ();
66  void raiseEvent(const dtn::net::ConnectionEvent &evt) throw ();
67  void raiseEvent(const dtn::routing::QueueBundleEvent &evt) throw ();
68 
69  private:
70  ibrcommon::Mutex _mutex;
71  bool _running;
72  };
73  } /* namespace api */
74 } /* namespace dtn */
75 #endif /* EVENTCONNECTION_H_ */
void raiseEvent(const dtn::core::NodeEvent &evt)
EventConnection(ClientHandler &client, ibrcommon::socketstream &stream)