| 1 | #ifndef ARIBA_OVERLAY_LINKREQUEST_H_
|
|---|
| 2 | #define ARIBA_OVERLAY_LINKREQUEST_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 LinkRequest : public Message {
|
|---|
| 23 | VSERIALIZEABLE;
|
|---|
| 24 | private:
|
|---|
| 25 | bool free_endpoint_;
|
|---|
| 26 | uint8_t flags;
|
|---|
| 27 | uint32_t nonce;
|
|---|
| 28 | const EndpointDescriptor* endpoint;
|
|---|
| 29 | LinkID remoteLinkId;
|
|---|
| 30 | NodeID relay;
|
|---|
| 31 |
|
|---|
| 32 | public:
|
|---|
| 33 | LinkRequest() {
|
|---|
| 34 |
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | LinkRequest( uint32_t nonce, const EndpointDescriptor* endpoint,
|
|---|
| 38 | bool reply = false, const LinkID& remoteLinkId = LinkID::UNSPECIFIED,
|
|---|
| 39 | const NodeID& relay = NodeID::UNSPECIFIED ) :
|
|---|
| 40 | flags(reply&1), nonce(nonce), endpoint(endpoint), remoteLinkId(remoteLinkId), relay(relay) {
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | virtual ~LinkRequest();
|
|---|
| 44 |
|
|---|
| 45 | const EndpointDescriptor* getEndpoint() const {
|
|---|
| 46 | return endpoint;
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | const LinkID& getRemoteLinkId() const {
|
|---|
| 50 | return remoteLinkId;
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | const NodeID& getRelay() const {
|
|---|
| 54 | return relay;
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | bool isReply() const {
|
|---|
| 58 | return flags & 1;
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | uint32_t getNonce() const {
|
|---|
| 62 | return nonce;
|
|---|
| 63 | }
|
|---|
| 64 | };
|
|---|
| 65 |
|
|---|
| 66 | }} // ariba::overlay
|
|---|
| 67 |
|
|---|
| 68 | sznBeginDefault( ariba::overlay::LinkRequest, X ) {
|
|---|
| 69 | if (X.isDeserializer()) endpoint = new EndpointDescriptor();
|
|---|
| 70 | X && flags && nonce;
|
|---|
| 71 | X && const_cast<EndpointDescriptor*>(endpoint);
|
|---|
| 72 | X && &relay && &remoteLinkId;
|
|---|
| 73 | } sznEnd();
|
|---|
| 74 |
|
|---|
| 75 | #endif /* ARIBA_OVERLAY_LINKREQUEST_H_ */
|
|---|