source: source/ariba/SideportListener.h@ 3747

Last change on this file since 3747 was 3374, checked in by Christoph Mayer, 16 years ago

-Integration of Branch 20090424-mayer-sideport

File size: 5.6 KB
Line 
1// [License]
2// The Ariba-Underlay Copyright
3//
4// Copyright (c) 2008-2009, Institute of Telematics, UniversitÀt Karlsruhe (TH)
5//
6// Institute of Telematics
7// UniversitÀt Karlsruhe (TH)
8// Zirkel 2, 76128 Karlsruhe
9// Germany
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
22// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
25// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32//
33// The views and conclusions contained in the software and documentation
34// are those of the authors and should not be interpreted as representing
35// official policies, either expressed or implied, of the Institute of
36// Telematics.
37// [License]
38
39#ifndef SIDEPORTLISTENER_H_
40#define SIDEPORTLISTENER_H_
41
42#include <vector>
43#include "Identifiers.h"
44#include "CommunicationListener.h"
45
46using std::vector;
47
48namespace ariba {
49
50// forward declerations
51class Node;
52class AribaModule;
53namespace overlay {
54 class BaseOverlay;
55}
56
57/**
58 * A sideport class to gather advanced information about nodes, links,
59 * their endpoints and get information about all link activity on a node.
60 *
61 * @author Christoph Mayer <mayer@tm.uka.de>
62 */
63class SideportListener {
64
65 friend class Node;
66 friend class AribaModule;
67 friend class overlay::BaseOverlay;
68
69public:
70
71 /**
72 * A default object of the SideportListener that has empty
73 * event functions and will return invalid information.
74 */
75 static SideportListener DEFAULT;
76
77 /**
78 * Constructor of the SideportListener.
79 */
80 SideportListener();
81
82 /**
83 * Virtual Desctructor for the SideportListener.
84 */
85 virtual ~SideportListener();
86
87 /**
88 * Get a descriptive string that identifies
89 * the remote endpoint for the given link.
90 *
91 * @param link The link to query endpoint information for.
92 * @return A descriptive endpoint information.
93 */
94 string getEndpointDescription(
95 const LinkID& link
96 ) const;
97
98 /**
99 * Get a descriprive string that identifiers the remote node.
100 *
101 * @param node The node id to query endpoint information.
102 * @return A descriptive endpoint information.
103 */
104 string getEndpointDescription(
105 const NodeID& node = NodeID::UNSPECIFIED
106 ) const;
107
108 /**
109 * Get the remote endpoint node id for the given string,
110 * or the local nodeid for an unspecified link.
111 *
112 * @param link The link to get the remote node.
113 * @return The nodeid of the remote end of the link
114 * or the local nodeid for an unspecified link.
115 */
116 const NodeID& getNodeID(
117 const LinkID& link = LinkID::UNSPECIFIED
118 ) const;
119
120 /**
121 * Get all links that end at the specified node id.
122 * Or all links from the local node when the node id
123 * is set to unspecified.
124 *
125 * @param The remote node to query all links or unspecified
126 * for all local starting links
127 * @return A vector of link ids.
128 */
129 vector<LinkID> getLinkIDs(
130 const NodeID& node = NodeID::UNSPECIFIED
131 ) const;
132
133protected:
134
135 /**
136 * Notification function when a link has gone up.
137 *
138 * @param lnk The corresponding link id.
139 * @param local The local node id.
140 * @param remote The remote node id.
141 * @param spovnet The SpoVNet ID.
142 */
143 virtual void onLinkUp(
144 const LinkID& lnk,
145 const NodeID& local,
146 const NodeID& remote,
147 const SpoVNetID& spovnet
148 );
149
150 /**
151 * Notification function when a link has gone down.
152 *
153 * @param lnk The corresponding link id.
154 * @param local The local node id.
155 * @param remote The remote node id.
156 * @param spovnet The SpoVNet ID.
157 */
158 virtual void onLinkDown(
159 const LinkID& lnk,
160 const NodeID& local,
161 const NodeID& remote,
162 const SpoVNetID& spovnet
163 );
164
165 /**
166 * Notification function when a link has changed
167 *
168 * @param lnk The corresponding link id.
169 * @param local The local node id.
170 * @param remote The remote node id.
171 * @param spovnet The SpoVNet ID.
172 */
173 virtual void onLinkChanged(
174 const LinkID& lnk,
175 const NodeID& local,
176 const NodeID& remote,
177 const SpoVNetID& spovnet
178 );
179
180 /**
181 * Notification function when a link has failed
182 *
183 * @param lnk The corresponding link id.
184 * @param local The local node id.
185 * @param remote The remote node id.
186 * @param spovnet The SpoVNet ID.
187 */
188 virtual void onLinkFail(
189 const LinkID& lnk,
190 const NodeID& local,
191 const NodeID& remote,
192 const SpoVNetID& spovnet
193 );
194
195private:
196
197 /**
198 * Configure the sideport with the correct base overlay.
199 *
200 * @param _overlay The BaseOverlay where to attach the sideport.
201 */
202 void configure(
203 overlay::BaseOverlay* _overlay
204 );
205
206 /**
207 * The configured BaseOverlay where
208 * the sideport is attached to.
209 */
210 overlay::BaseOverlay* overlay;
211
212};
213
214} // namespace ariba
215
216#endif // SIDEPORTLISTENER_H_
Note: See TracBrowser for help on using the repository browser.