| 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) { | 
|---|
| 40 | } | 
|---|
| 41 |  | 
|---|
| 42 | RelayMessage( type_ type, const NodeID& relayNode, const NodeID& destNode, const LinkID& destLink = LinkID::UNSPECIFIED ) : | 
|---|
| 43 | type(type), relayNode(relayNode), destNode(destNode), destLink(destLink) { | 
|---|
| 44 | } | 
|---|
| 45 |  | 
|---|
| 46 | ~RelayMessage(); | 
|---|
| 47 |  | 
|---|
| 48 | /// returns the type of this message | 
|---|
| 49 | type_ getType() const { | 
|---|
| 50 | return (type_)type; | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | /// sets the type of this message | 
|---|
| 54 | void setType( type_ type ) { | 
|---|
| 55 | this->type = type; | 
|---|
| 56 | } | 
|---|
| 57 |  | 
|---|
| 58 | /// returns the remote (destination) node id | 
|---|
| 59 | const NodeID& getDestNode() const { | 
|---|
| 60 | return destNode; | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 | const LinkID& getDestLink() const { | 
|---|
| 64 | return destLink; | 
|---|
| 65 | } | 
|---|
| 66 |  | 
|---|
| 67 | /// returns the relay node for the destination | 
|---|
| 68 | const NodeID& getRelayNode() const { | 
|---|
| 69 | return relayNode; | 
|---|
| 70 | } | 
|---|
| 71 | }; | 
|---|
| 72 |  | 
|---|
| 73 | }} // ariba::overlay | 
|---|
| 74 |  | 
|---|
| 75 | sznBeginDefault( ariba::overlay::RelayMessage, X ) { | 
|---|
| 76 | X && type && &relayNode && &destNode && &destLink && Payload(); | 
|---|
| 77 | } sznEnd(); | 
|---|
| 78 |  | 
|---|
| 79 | #endif /* RELAYMESSAGE_H_ */ | 
|---|