Changeset 12060 for source/ariba/Node.h
- Timestamp:
- Jun 19, 2013, 11:05:49 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/Node.h
r10653 r12060 43 43 namespace ariba { 44 44 class Node; 45 namespace overlay { 46 class BaseOverlay; 47 } 45 namespace communication { 46 class BaseCommunication; 47 } 48 namespace overlay { 49 class BaseOverlay; 50 } 48 51 } 49 52 50 53 #include <vector> 51 54 #include <iostream> 52 #include <boost/foreach.hpp> 55 #include <exception> 56 53 57 #include "Module.h" 54 58 #include "Identifiers.h" … … 56 60 #include "NodeListener.h" 57 61 #include "Name.h" 58 #include "AribaModule.h"62 //#include "AribaModule.h" 59 63 #include "CommunicationListener.h" 60 64 #include "DataMessage.h" 61 65 #include "SideportListener.h" 66 #include "ariba/overlay/SequenceNumber.h" 67 68 // reboost messages 69 #include "ariba/utility/transport/messages/message.hpp" 70 71 #include <boost/property_tree/ptree.hpp> 62 72 63 73 using std::vector; … … 65 75 66 76 namespace ariba { 77 78 // typedef ariba::overlay::SequenceNumber SequenceNumber; // XXX see CommunicationListener 79 80 using boost::property_tree::ptree; 81 82 // sendMessage-Priorities 83 struct send_priority 84 { 85 enum SEND_PRIORITY 86 { 87 HIGHEST = 2, 88 HIGHER = 3, 89 NORMAL = 4, 90 LOWER = 5, 91 LOWEST = 6 92 }; 93 }; 94 95 67 96 68 97 /** … … 75 104 * @author Christoph Mayer <mayer@tm.uka.de> 76 105 */ 106 // TODO do we really want to inherit from Module.. ? 77 107 class Node: public Module { 78 108 public: 109 79 110 /** 80 111 * Constructs a new node using a given ariba module … … 86 117 * is a zero-terminated char-string. 87 118 */ 88 Node(AribaModule& ariba_mod, const Name& node_name = Name::UNSPECIFIED); 119 // Node(AribaModule& ariba_mod, const Name& node_name = Name::UNSPECIFIED); 120 121 // XXX EXPERIMENTAL 122 Node(); 89 123 90 124 /** … … 100 134 //--- node control --- 101 135 136 /** 137 * XXX EXPERIMENTAL 138 * 139 * Replaces initialte & join 140 */ 141 void connect(const ptree& config); 142 143 // XXX DEPRECATED 102 144 /** 103 145 * This method instructs the node to join a particular spovnet. … … 107 149 * @param vnetId The SpoVNet name 108 150 */ 109 void join(const Name& name);151 // void join(const Name& name); 110 152 111 153 /** … … 116 158 * @param param The SpoVNet properties 117 159 */ 118 void initiate(const Name& name, const SpoVNetProperties& parm =119 SpoVNetProperties::DEFAULT);160 // void initiate(const Name& name, const SpoVNetProperties& parm = 161 // SpoVNetProperties::DEFAULT); 120 162 121 163 /** … … 221 263 void dropLink(const LinkID& lnk); 222 264 223 // message sending 224 225 /** 226 * Sends a one-shot message to a service. If link properties are specified, 227 * the node tries to fulfill those requirements. This may cause the node 228 * to first establish a temporary link, second sending the message and last 229 * dropping the link. This would result in a small amount of extra latency 230 * until the message is delivered. If reliable transport was selected, 231 * the method returns a sequence number and a communication event is 232 * triggered on message delivery or loss. 233 * 234 * @param msg The message to be sent 235 * @param nid The remote node identifier 236 * @param sid The remote service identifier 237 * @param req The requirements associated with the message 238 * @return A sequence number 239 */ 265 /** 266 * Returns whether a link is direct or relayed over other nodes 267 * @param lnk LinkID of the link 268 * @return true if link is direct; false otherwise 269 */ 270 bool isLinkDirect(const ariba::LinkID& lnk) const; 271 272 /** 273 * Returns the latest measured hop count on this link. 274 * NOTE: This is not guaranteed to be up to date. 275 * 276 * @param lnk LinkID of the link 277 * @return overlay hop count on this link 278 */ 279 int getHopCount(const ariba::LinkID& lnk) const; 280 281 282 /* +++++ Message sending +++++ */ 283 284 285 /** 286 * Sends a message via an established link. If reliable transport was 287 * selected, the method returns a sequence number and a communication event 288 * is triggered on message delivery or loss. 289 * 290 * +++ New interface, using efficient zero-copy reboost messages. +++ 291 * 292 * @param msg The message to be sent 293 * @param lnk The link to be used for sending the message 294 */ 295 const SequenceNumber& sendMessage(reboost::message_t msg, const LinkID& lnk, uint8_t priority=send_priority::NORMAL); 296 297 /** 298 * +++ Legacy interface, converts old ariba messages into new reboost messages. +++ 299 */ 300 seqnum_t sendMessage(const DataMessage& msg, const LinkID& lnk); 301 302 303 /** 304 * Sends a one-shot message to a service. If link properties are specified, 305 * the node tries to fulfill those requirements. This may cause the node 306 * to first establish a temporary link, second sending the message and last 307 * dropping the link. This would result in a small amount of extra latency 308 * until the message is delivered. If reliable transport was selected, 309 * the method returns a sequence number and a communication event is 310 * triggered on message delivery or loss. 311 * 312 * +++ New interface, using efficient zero-copy reboost messages. +++ 313 * 314 * @param msg The message to be sent 315 * @param nid The remote node identifier 316 * @param sid The remote service identifier 317 * @param req The requirements associated with the message 318 * @return A sequence number 319 */ 320 const SequenceNumber& sendMessage(reboost::message_t msg, const NodeID& nid, const ServiceID& sid, 321 uint8_t priority=send_priority::NORMAL, const LinkProperties& req = LinkProperties::DEFAULT); 322 323 /** 324 * +++ Legacy interface, converts old ariba messages into new reboost messages. +++ 325 */ 240 326 seqnum_t sendMessage(const DataMessage& msg, const NodeID& nid, const ServiceID& sid, 241 327 const LinkProperties& req = LinkProperties::DEFAULT); 242 328 243 /** 244 * like the above function, but sends the message to the closest directly known node 245 * to the specified address 246 */ 329 330 /** 331 * like the above function, but sends the message to the closest directly known node 332 * to the specified address 333 * 334 * +++ New interface, using efficient zero-copy reboost messages. +++ 335 * 336 */ 337 NodeID sendMessageCloserToNodeID(reboost::message_t msg, const NodeID& nid, const ServiceID& sid, 338 uint8_t priority=send_priority::NORMAL, const LinkProperties& req = LinkProperties::DEFAULT); 339 340 /** 341 * +++ Legacy interface, converts old ariba messages into new reboost messages. +++ 342 */ 247 343 NodeID sendMessageCloserToNodeID(const DataMessage& msg, const NodeID& nid, const ServiceID& sid, 248 344 const LinkProperties& req = LinkProperties::DEFAULT); 249 345 250 /** 251 * Sends a message via an established link. If reliable transport was 252 * selected, the method returns a sequence number and a communication event 253 * is triggered on message delivery or loss. 254 * 255 * @param msg The message to be sent 256 * @param lnk The link to be used for sending the message 257 */ 258 seqnum_t sendMessage(const DataMessage& msg, const LinkID& lnk); 259 260 /** 261 * Sends a message to all known hosts in the overlay structure 262 * the nodes that are reached here depend on the overlay structure. 263 * 264 * @param msg The message to be send 265 * @param sid The id of the service that should receive the message 266 * @see getNeighborNodes 267 */ 346 347 /** 348 * Sends a message to all known hosts in the overlay structure 349 * the nodes that are reached here depend on the overlay structure. 350 * 351 * +++ New interface, using efficient zero-copy reboost messages. +++ 352 * 353 * @param msg The message to be send 354 * @param sid The id of the service that should receive the message 355 * @see getNeighborNodes 356 */ 357 void sendBroadcastMessage(reboost::message_t msg, const ServiceID& sid, uint8_t priority=send_priority::NORMAL); 358 359 /** 360 * +++ Legacy interface, converts old ariba messages into new reboost messages. +++ 361 */ 268 362 void sendBroadcastMessage(const DataMessage& msg, const ServiceID& sid); 269 363 364 365 /* +++++ [Message sending] +++++ */ 366 367 368 270 369 // --- communication listeners --- 271 370 … … 313 412 /** @see Module.h */ 314 413 string getName() const; 315 414 415 416 private: 417 inline void check_send_priority(uint8_t priority); 418 419 316 420 protected: 317 421 // friends … … 320 424 // member variables 321 425 Name name; //< node name 322 AribaModule&ariba_mod; //< ariba module426 // AribaModule* ariba_mod; //< ariba module 323 427 SpoVNetID spovnetId; //< current spovnet id 324 428 NodeID nodeId; //< current node id 429 communication::BaseCommunication* base_communication; 325 430 overlay::BaseOverlay* base_overlay; //< the base overlay 326 431
Note:
See TracChangeset
for help on using the changeset viewer.