IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
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
>
28
#include "
net/DiscoveryBeaconHandler.h
"
29
#include <
ibrcommon/net/vinterface.h
>
30
#include <
ibrcommon/net/socket.h
>
31
#include <
ibrcommon/net/vsocket.h
>
32
#include <
ibrcommon/link/LinkManager.h
>
33
34
35
namespace
dtn
36
{
37
namespace
net
38
{
43
class
UDPConvergenceLayer
:
public
ConvergenceLayer
,
public
dtn::daemon::IndependentComponent
,
public
DiscoveryBeaconHandler
,
public
ibrcommon::LinkManager::EventCallback
44
{
45
public
:
53
UDPConvergenceLayer
(
ibrcommon::vinterface
net,
int
port,
dtn::data::Length
mtu = 1280);
54
58
virtual
~UDPConvergenceLayer
();
59
63
void
onUpdateBeacon
(
const
ibrcommon::vinterface
&iface,
DiscoveryBeacon
&announcement)
64
throw
(
dtn::net::DiscoveryBeaconHandler::NoServiceHereException
);
65
66
dtn::core::Node::Protocol
getDiscoveryProtocol
()
const
;
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
virtual
void
resetStats
();
78
79
virtual
void
getStats
(
ConvergenceLayer::stats_data
&data)
const
;
80
81
protected
:
82
virtual
void
componentUp
()
throw
();
83
virtual
void
componentRun
()
throw
();
84
virtual
void
componentDown
()
throw
();
85
void
__cancellation
()
throw
();
86
87
private
:
88
void
receive(
dtn::data::Bundle
&,
dtn::data::EID
&sender)
throw
(
ibrcommon::socket_exception
,
dtn::InvalidDataException
);
89
void
send(
const
ibrcommon::vaddress
&addr,
const
std::string &data)
throw
(
ibrcommon::socket_exception
,
NoAddressFoundException
);
90
91
ibrcommon::vsocket
_vsocket;
92
ibrcommon::vinterface
_net;
93
int
_port;
94
95
static
const
int
DEFAULT_PORT;
96
97
dtn::data::Length
m_maxmsgsize;
98
99
ibrcommon::Mutex
m_writelock;
100
ibrcommon::Mutex
m_readlock;
101
102
bool
_running;
103
104
// stats variables
105
size_t
_stats_in;
106
size_t
_stats_out;
107
};
108
}
109
}
110
111
#endif
/*UDPCONVERGENCELAYER_H_*/
daemon
src
net
UDPConvergenceLayer.h
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4