source: source/ariba/tidy/AribaModule.h@ 2391

Last change on this file since 2391 was 2391, checked in by mies, 16 years ago

added more stuff to svn:ignore :)

File size: 5.1 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 ARIBAMODULE_H_
40#define ARIBAMODULE_H_
41
42#include <string>
43#include <vector>
44
45// usings
46using std::vector;
47using std::string;
48
49// forward declaration
50namespace ariba {
51class AribaModule;
52}
53
54// local includes
55#include "Name.h"
56#include "Module.h"
57
58namespace ariba {
59
60// forward declarations of old interface
61namespace communication {
62class EndpointDescriptor;
63class NetworkLocator;
64}
65namespace interface {
66class UnderlayAbstraction;
67}
68
69/**
70 * This class implements a container class for ariba base services. Each node
71 * is a running using this base-module. It also manages Bootstrap information
72 * in a abstract simple way.
73 *
74 * +---+ +---+
75 * |N1 | |N2 |
76 * +--| |---| |--+
77 * | +---+ +---+ |
78 * | |
79 * | AribaModule |
80 * +-----------------+
81 *
82 * N1, N2 are nodes.
83 *
84 * @author Sebastian Mies <mies@tm.uka.de>
85 */
86class AribaModule: public Module {
87 friend class Node;
88public:
89 /**
90 * Constructor of the ariba underlay module
91 */
92 AribaModule();
93
94 /**
95 * Destructor of the ariba underlay module
96 */
97 virtual ~AribaModule();
98
99 /**
100 * Returns all known bootstrap endpoints to this ariba module in
101 * a human-readable string. This information can be used by other
102 * nodes for bootstraping. It may also be used to publish this info
103 * to other nodes via the web, for example.
104 *
105 * @param The name of the spovnet
106 * @return A human-readable string containing all known bootstrap
107 * information known to this module.
108 */
109 string getBootstrapHints(const Name& spoVNetName = Name::UNSPECIFIED) const;
110
111 /**
112 * Adds bootstrap hints to the local database. The format of the string
113 * must is the same as returned by <code>getBootstrapInfo</code>.
114 *
115 * @param bootinfo A string containing bootstrap information.
116 */
117 void addBootstrapHints(string bootinfo);
118
119 // --- module implementation ---
120
121 /**
122 * Module Property information:
123 *
124 * ip.addr = preferred ip address (otherwise bind to all)
125 * tcp.port = preferred tcp port (or use default value)
126 * udp.port = preferred udp port (or use default value)
127 * bootstrap.hints = used bootstrap hints
128 * bootstrap.file = used file for bootstrap information
129 */
130 void initialize(); ///< @see Module.h
131 void start(); ///< @see Module.h
132 void stop(); ///< @see Module.h
133 string getName() const; ///< @see Module.h
134 void setProperty(string key, string value); ///< @see Module.h
135 const string getProperty(string key) const; ///< @see Module.h
136 const vector<string> getProperties() const; ///< @see Module.h
137
138private:
139 // bootstrap node
140 class BootstrapNode {
141 public:
142 uint32_t timestamp;
143 communication::EndpointDescriptor* desc;
144 };
145
146 // bootstrap info
147 class BootstrapInfo {
148 public:
149 Name spovnetName;
150 vector<BootstrapNode> desc;
151 };
152 vector<BootstrapInfo> bootstrapNodes;
153
154protected:
155 // members
156 string bootstrapFile; //< file with bootstrap information
157 bool started; //< flag, if module has been started
158
159 // bootstrap node management
160 void addBootstrapNode(const Name& spovnet, const Name& node,
161 communication::EndpointDescriptor* desc);
162 const communication::EndpointDescriptor* getBootstrapNode(
163 const Name& spovnet);
164
165 // TODO: merge with old interface
166 interface::UnderlayAbstraction* underlay_abs;
167
168 // TODO: use "abstract" representations here!
169 communication::NetworkLocator* ip_addr;
170 uint16_t tcp_port, udp_port;
171};
172
173} // namespace ariba
174
175#endif /* ENVIRONMENT_H_ */
Note: See TracBrowser for help on using the repository browser.