| 1 | #ifndef RELAYMESSAGE_H_
|
---|
| 2 | #define RELAYMESSAGE_H_
|
---|
| 3 |
|
---|
| 4 | #include "ariba/utility/messages.h"
|
---|
| 5 | #include "ariba/utility/serialization.h"
|
---|
| 6 | #include "ariba/communication/EndpointDescriptor.h"
|
---|
| 7 |
|
---|
| 8 | using ariba::communication::EndpointDescriptor;
|
---|
| 9 |
|
---|
| 10 | namespace ariba {
|
---|
| 11 | namespace overlay {
|
---|
| 12 |
|
---|
| 13 | using_serialization;
|
---|
| 14 |
|
---|
| 15 | using ariba::utility::Message;
|
---|
| 16 |
|
---|
| 17 | /**
|
---|
| 18 | * This message is sent to another overlay node to request a new link.
|
---|
| 19 | *
|
---|
| 20 | * @author Sebastian Mies <mies@tm.uka.de>
|
---|
| 21 | */
|
---|
| 22 | class RelayMessage : public Message {
|
---|
| 23 | VSERIALIZEABLE;
|
---|
| 24 | private:
|
---|
| 25 | uint8_t type;
|
---|
| 26 | NodeID relayNode;
|
---|
| 27 | NodeID destNode;
|
---|
| 28 | LinkID destLink;
|
---|
| 29 |
|
---|
| 30 | public:
|
---|
| 31 | enum type_ {
|
---|
| 32 | typeInvalid = 0,
|
---|
| 33 | typeInform = 1,
|
---|
| 34 | typeRoute = 2
|
---|
| 35 | };
|
---|
| 36 |
|
---|
| 37 | /// contructs a unspecified relay message
|
---|
| 38 | RelayMessage() :
|
---|
| 39 | type(typeInvalid), relayNode(NodeID::UNSPECIFIED), destNode(NodeID::UNSPECIFIED), destLink(LinkID::UNSPECIFIED) {
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | RelayMessage( const RelayMessage& rhs ) :
|
---|
| 43 | type(rhs.type), relayNode(rhs.relayNode), destNode(rhs.destNode), destLink(rhs.destLink) {
|
---|
| 44 |
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | RelayMessage( type_ type, const NodeID& relayNode, const NodeID& destNode, const LinkID& destLink = LinkID::UNSPECIFIED ) :
|
---|
| 48 | type(type), relayNode(relayNode), destNode(destNode), destLink(destLink) {
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | ~RelayMessage();
|
---|
| 52 |
|
---|
| 53 | /// returns the type of this message
|
---|
| 54 | type_ getType() const {
|
---|
| 55 | return (type_)type;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | /// sets the type of this message
|
---|
| 59 | void setType( type_ type ) {
|
---|
| 60 | this->type = type;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | /// returns the remote (destination) node id
|
---|
| 64 | const NodeID& getDestNode() const {
|
---|
| 65 | return destNode;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | const LinkID& getDestLink() const {
|
---|
| 69 | return destLink;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | /// returns the relay node for the destination
|
---|
| 73 | const NodeID& getRelayNode() const {
|
---|
| 74 | return relayNode;
|
---|
| 75 | }
|
---|
| 76 | };
|
---|
| 77 |
|
---|
| 78 | }} // ariba::overlay
|
---|
| 79 |
|
---|
| 80 | sznBeginDefault( ariba::overlay::RelayMessage, X ) {
|
---|
| 81 | X && type && &relayNode && &destNode && &destLink && Payload();
|
---|
| 82 | } sznEnd();
|
---|
| 83 |
|
---|
| 84 | #endif /* RELAYMESSAGE_H_ */
|
---|