An Overlay-based
Virtual Network Substrate
SpoVNet

source: source/ariba/overlay/modules/OverlayInterface.h @ 3690

Last change on this file since 3690 was 3690, checked in by mies, 14 years ago

Merged 20090512-mies-connectors changes r3472:r3689 into trunk.

File size: 5.3 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 ARIBA PROJECT 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 __OVERLAY_INTERFACE_H
40#define __OVERLAY_INTERFACE_H
41
42#include "ariba/CommunicationListener.h"
43#include "ariba/communication/EndpointDescriptor.h"
44#include "ariba/overlay/modules/OverlayStructureEvents.h"
45#include "ariba/utility/types/NodeID.h"
46#include "ariba/utility/types/ServiceID.h"
47
48using ariba::CommunicationListener;
49using ariba::communication::EndpointDescriptor;
50using ariba::overlay::OverlayStructureEvents;
51using ariba::utility::NodeID;
52using ariba::utility::ServiceID;
53
54namespace ariba {
55namespace overlay {
56
57class BaseOverlay;
58
59/**
60 * This class declares an interface for an structured overlay.
61 */
62class OverlayInterface: public CommunicationListener {
63        friend class BaseOverlay;
64
65public:
66        /**
67         * A node list
68         */
69        typedef vector<NodeID> NodeList;
70
71        /**
72         * Constructs a new overlay.
73         */
74        OverlayInterface(
75                        BaseOverlay& _baseoverlay,
76                        const NodeID& _nodeid,
77                        OverlayStructureEvents* _eventsReceiver );
78
79        /**
80         * Destrcuts the overlay.
81         */
82        virtual ~OverlayInterface();
83
84        /**
85         * Creates the overlay.
86         */
87        virtual void createOverlay() = 0;
88
89        /**
90         * Destroys the overlay.
91         */
92        virtual void deleteOverlay() = 0;
93
94        /**
95         * Joins the overlay. Starts integration and stabilization of the overlay
96         * Node.
97         *
98         * @param bootstrap The bootstrap end-point descriptor or the default
99         *    end-point, if this node is the initiator
100         */
101        virtual void joinOverlay(const EndpointDescriptor& bootstrap =
102                EndpointDescriptor::UNSPECIFIED ) = 0;
103
104        /**
105         * Leaves the overlay gracefully.
106         */
107        virtual void leaveOverlay() = 0;
108
109        /**
110         * Resolves a overlay neighbor.
111         *
112         * @param node The node to resolve
113         * @return Endpoint descriptor of local neighbor or UNSPECIFIED
114         */
115        virtual const EndpointDescriptor& resolveNode(const NodeID& node) = 0;
116
117        /**
118         * Routes a message to a given node by using overlay routing.
119         *
120         * @param destnode The destination node.
121         * @param msg The message to be routed.
122         */
123        virtual void routeMessage(const NodeID& destnode, Message* msg) = 0;
124
125        /**
126         * Returns the nodes known to this overlay.
127         *
128         * Usually this are the direct neighbors in the overlay structure.
129         * For instance, Chord would return his predecessor, successor and finger
130         * nodes. On the other hand OneHop would likely return all participating
131         * nodes in the overlay.
132         *
133         * @return The list of all known nodes
134         */
135        virtual NodeList getKnownNodes() const = 0;
136
137        //--- functions from CommunicationListener that we _can_ use as overlay ---
138
139        /// @see CommunicationListener
140        virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
141        /// @see CommunicationListener
142        virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
143        /// @see CommunicationListener
144        virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
145        /// @see CommunicationListener
146        virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
147        /// @see CommunicationListener
148        virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote,
149                        const LinkProperties& prop);
150        /// @see CommunicationListener
151        virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg);
152        /// @see CommunicationListener
153        virtual void onMessage(const DataMessage& msg, const NodeID& remote,
154                        const LinkID& lnk = LinkID::UNSPECIFIED);
155
156protected:
157
158        /// Reference to an active base overlay
159        BaseOverlay& baseoverlay;
160
161        /// The node identifier to use with this overlay
162        const NodeID& nodeid;
163
164        /// The listener used to inform about overlay structure changes
165        OverlayStructureEvents* eventsReceiver;
166
167        /// The service identifer of this overlay
168        static ServiceID OVERLAY_SERVICE_ID;
169};
170
171}} // namespace ariba, overlay
172
173#endif // __OVERLAY_INTERFACE_H
Note: See TracBrowser for help on using the repository browser.