IBR-DTN  1.0.0
BundleTransfer.h
Go to the documentation of this file.
1 /*
2  * BundleTransfer.h
3  *
4  * Copyright (C) 2013 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 
23 #include <ibrdtn/data/Number.h>
24 #include <ibrdtn/data/EID.h>
25 #include <ibrdtn/data/MetaBundle.h>
26 #include "core/Node.h"
27 
28 #include <ibrcommon/thread/Mutex.h>
29 #include <map>
30 
31 #ifndef BUNDLETRANSFER_H_
32 #define BUNDLETRANSFER_H_
33 
34 namespace dtn
35 {
36  namespace net
37  {
39  public:
41  virtual ~BundleTransfer();
42 
43  const dtn::data::EID& getNeighbor() const;
44  const dtn::data::MetaBundle& getBundle() const;
46 
50  void abort(const TransferAbortedEvent::AbortReason reason);
51 
55  void complete();
56 
57  private:
58  class Slot {
59  public:
60  Slot(const dtn::data::EID &neighbor, const dtn::data::MetaBundle &bundle, dtn::core::Node::Protocol p);
61  virtual ~Slot();
62 
63  const dtn::data::EID neighbor;
64  const dtn::data::MetaBundle bundle;
65  const dtn::core::Node::Protocol protocol;
66 
70  void abort(const TransferAbortedEvent::AbortReason reason);
71 
75  void complete();
76 
77  private:
78  bool _completed;
79  bool _aborted;
81  };
82 
83  refcnt_ptr<Slot> _slot;
84  };
85  } /* namespace net */
86 } /* namespace dtn */
87 #endif /* BUNDLETRANSFER_H_ */
const dtn::data::EID & getNeighbor() const
dtn::core::Node::Protocol getProtocol() const
BundleTransfer(const dtn::data::EID &neighbor, const dtn::data::MetaBundle &bundle, dtn::core::Node::Protocol p)
void abort(const TransferAbortedEvent::AbortReason reason)
const dtn::data::MetaBundle & getBundle() const