00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef SIDEPORTLISTENER_H_
00040 #define SIDEPORTLISTENER_H_
00041
00042 #include <vector>
00043 #include <map>
00044 #include <iostream>
00045 #include <boost/foreach.hpp>
00046 #include "Identifiers.h"
00047 #include "CommunicationListener.h"
00048
00049 using std::cout;
00050 using std::map;
00051 using std::vector;
00052
00053 namespace ariba {
00054
00055
00056 class Node;
00057 class AribaModule;
00058 namespace overlay {
00059 class BaseOverlay;
00060 }
00061
00068 class SideportListener {
00069
00070 friend class Node;
00071 friend class AribaModule;
00072 friend class overlay::BaseOverlay;
00073
00074 public:
00075
00080 static SideportListener DEFAULT;
00081
00085 SideportListener();
00086
00090 virtual ~SideportListener();
00091
00099 string getEndpointDescription(
00100 const LinkID& link
00101 ) const;
00102
00109 string getEndpointDescription(
00110 const NodeID& node = NodeID::UNSPECIFIED
00111 ) const;
00112
00121 const NodeID& getNodeID(
00122 const LinkID& link = LinkID::UNSPECIFIED
00123 ) const;
00124
00134 vector<LinkID> getLinkIDs(
00135 const NodeID& node = NodeID::UNSPECIFIED
00136 ) const;
00137
00142 string getHtmlLinks();
00143
00148 vector<NodeID> getOverlayNeighbors(bool deep = true);
00149
00156 bool isRelayingNode(const NodeID& node);
00157
00164 bool isRelayedNode(const NodeID& node);
00165
00166
00170 enum Protocol {
00171 undefined = 0x0,
00172 rfcomm = 0x1,
00173 ipv4 = 0x2,
00174 ipv6 = 0x3
00175 };
00176
00183 Protocol getReachabilityProtocol(const NodeID& node);
00184
00185 protected:
00186
00195 virtual void onLinkUp(
00196 const LinkID& lnk,
00197 const NodeID& local,
00198 const NodeID& remote,
00199 const SpoVNetID& spovnet
00200 );
00201
00210 virtual void onLinkDown(
00211 const LinkID& lnk,
00212 const NodeID& local,
00213 const NodeID& remote,
00214 const SpoVNetID& spovnet
00215 );
00216
00225 virtual void onLinkChanged(
00226 const LinkID& lnk,
00227 const NodeID& local,
00228 const NodeID& remote,
00229 const SpoVNetID& spovnet
00230 );
00231
00240 virtual void onLinkFail(
00241 const LinkID& lnk,
00242 const NodeID& local,
00243 const NodeID& remote,
00244 const SpoVNetID& spovnet
00245 );
00246
00247 private:
00248
00254 void configure(
00255 overlay::BaseOverlay* _overlay
00256 );
00257
00262 overlay::BaseOverlay* overlay;
00263
00264 };
00265
00266 }
00267
00268 #endif // SIDEPORTLISTENER_H_