IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
LinkManager.h
Go to the documentation of this file.
1
/*
2
* LinkManager.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 LINKMANAGER_H_
23
#define LINKMANAGER_H_
24
25
#include "
ibrcommon/link/LinkEvent.h
"
26
#include "
ibrcommon/net/vinterface.h
"
27
#include "
ibrcommon/net/vaddress.h
"
28
#include "
ibrcommon/thread/Mutex.h
"
29
#include <string>
30
#include <map>
31
#include <set>
32
33
namespace
ibrcommon
34
{
35
class
LinkManager
36
{
37
public
:
38
class
EventCallback
39
{
40
public
:
41
virtual
~EventCallback
() {};
42
virtual
void
eventNotify
(
const
LinkEvent
&) = 0;
43
};
44
45
virtual
~LinkManager
() {};
46
47
virtual
void
up
() throw () { };
48
virtual
void
down
() throw () { };
49
50
virtual
const
ibrcommon::vinterface
getInterface
(
int
index)
const
= 0;
51
virtual
const
std::list<vaddress>
getAddressList
(
const
vinterface
&iface,
const
std::string &scope =
""
) = 0;
52
53
virtual
void
addEventListener
(
const
vinterface
&,
LinkManager::EventCallback
*) throw ();
54
virtual
void
removeEventListener
(const
vinterface
&,
LinkManager
::EventCallback*) throw ();
55
virtual
void
removeEventListener
(
LinkManager
::EventCallback*) throw ();
56
57
void
raiseEvent
(const
LinkEvent
&lme);
58
62
static
LinkManager
&
getInstance
();
63
67
static
void
initialize
();
68
72
static
void
setLinkRequestInterval
(
size_t
interval);
73
77
static
size_t
getLinkRequestInterval
();
78
79
/*
80
* returns a set of interfaces, containing all interfaces with an eventListener
81
*/
82
std::set<vinterface>
getMonitoredInterfaces
();
83
84
protected:
85
ibrcommon::
Mutex
_listener_mutex
;
86
87
typedef std::set<
LinkManager
::
EventCallback
* >
callback_set
;
88
typedef std::map<ibrcommon::vinterface, callback_set>
listener_map
;
89
listener_map
_listener
;
90
91
static
size_t
_link_request_interval
;
92
};
93
}
94
95
#endif
/* LINKMANAGER_H_ */
ibrcommon
ibrcommon
link
LinkManager.h
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4