IBR-DTNSuite  0.10
UDPConvergenceLayer.h
Go to the documentation of this file.
1 /*
2  * UDPConvergenceLayer.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 UDPCONVERGENCELAYER_H_
23 #define UDPCONVERGENCELAYER_H_
24 
25 #include "Component.h"
26 #include "net/ConvergenceLayer.h"
27 #include <ibrcommon/Exceptions.h>
30 #include <ibrcommon/net/socket.h>
31 #include <ibrcommon/net/vsocket.h>
33 
34 
35 namespace dtn
36 {
37  namespace net
38  {
44  {
45  public:
54 
58  virtual ~UDPConvergenceLayer();
59 
63  void update(const ibrcommon::vinterface &iface, DiscoveryAnnouncement &announcement)
65 
67 
68  void queue(const dtn::core::Node &n, const dtn::net::BundleTransfer &job);
69 
73  virtual const std::string getName() const;
74 
75  void eventNotify(const ibrcommon::LinkEvent &evt);
76 
77  protected:
78  virtual void componentUp() throw ();
79  virtual void componentRun() throw ();
80  virtual void componentDown() throw ();
81  void __cancellation() throw ();
82 
83  private:
85  void send(const ibrcommon::vaddress &addr, const std::string &data) throw (ibrcommon::socket_exception, NoAddressFoundException);
86 
87  ibrcommon::vsocket _vsocket;
89  int _port;
90 
91  static const int DEFAULT_PORT;
92 
93  dtn::data::Length m_maxmsgsize;
94 
95  ibrcommon::Mutex m_writelock;
96  ibrcommon::Mutex m_readlock;
97 
98  bool _running;
99 
100 
101  };
102  }
103 }
104 
105 #endif /*UDPCONVERGENCELAYER_H_*/