IBR-DTNSuite
0.10
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/DiscoveryServiceProvider.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
DiscoveryServiceProvider
,
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
update
(
const
ibrcommon::vinterface
&iface,
DiscoveryAnnouncement
&announcement)
64
throw
(
dtn::net::DiscoveryServiceProvider::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
protected
:
78
virtual
void
componentUp
()
throw
();
79
virtual
void
componentRun
()
throw
();
80
virtual
void
componentDown
()
throw
();
81
void
__cancellation
()
throw
();
82
83
private
:
84
void
receive(
dtn::data::Bundle
&,
dtn::data::EID
&sender)
throw
(
ibrcommon::socket_exception
,
dtn::InvalidDataException
);
85
void
send(
const
ibrcommon::vaddress
&addr,
const
std::string &data)
throw
(
ibrcommon::socket_exception
,
NoAddressFoundException
);
86
87
ibrcommon::vsocket
_vsocket;
88
ibrcommon::vinterface
_net;
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_*/
daemon
src
net
UDPConvergenceLayer.h
Generated on Mon Jul 22 2013 15:16:00 for IBR-DTNSuite by
1.8.3.1