close Warning: Can't use blame annotator:
No changeset 2259 in the repository

source: source/ariba/overlay/messages/OverlayMsg.h@ 5756

Last change on this file since 5756 was 5316, checked in by Christoph Mayer, 15 years ago

merge from bootstrap branch

File size: 4.2 KB
RevLine 
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 OVERLAY_MSG_H__
40#define OVERLAY_MSG_H__
41
42#include <boost/cstdint.hpp>
43#include "ariba/utility/messages.h"
44#include "ariba/utility/serialization.h"
45#include "ariba/utility/types/ServiceID.h"
46#include "ariba/utility/types/NodeID.h"
47#include "ariba/utility/types/LinkID.h"
48
49using ariba::utility::LinkID;
50using ariba::utility::NodeID;
51using ariba::utility::ServiceID;
52using ariba::utility::Message;
53
54namespace ariba {
55namespace overlay {
56
57using_serialization
58;
59
60class OverlayMsg: public Message {
61VSERIALIZEABLE
62 ;
63public:
64
65 /// (payload-) message types
66 enum type_ {
67 typeInvalid = 0, ///< invalid type (no encapsulated messages)
68 typeData = 1, ///< message contains data for higher layers
69 typeJoinRequest = 2, ///< join request
70 typeJoinReply = 3, ///< join reply
71 typeUpdate = 4, ///< update message for link association
72 typeLinkRequest = 5, ///< link request (sent over the overlay)
73 typeRelay = 6, ///< relay message
74 typeKeepAlive = 7, ///< a keep-alive message
75 typeDirectLink = 8,
76 ///< a direct connection has been established
77 };
78
79 /// default constructor
80 OverlayMsg(type_ type = typeInvalid, const ServiceID _service =
81 ServiceID::UNSPECIFIED, const NodeID _sourceNode =
82 NodeID::UNSPECIFIED) :
83 type((uint8_t) type), service(_service), sourceNode(_sourceNode),
84 relayLink(LinkID::UNSPECIFIED), autoLink(false) {
85 }
86
87 OverlayMsg(const OverlayMsg& rhs) :
88 type(rhs.type), service(rhs.service), sourceNode(rhs.sourceNode),
89 relayLink(rhs.relayLink), autoLink(rhs.autoLink) {
90 }
91
92 /// type and source node constructor
93 OverlayMsg(type_ type, const NodeID _sourceNode) :
94 type((uint8_t) type), service(ServiceID::UNSPECIFIED), sourceNode(
95 _sourceNode), relayLink(LinkID::UNSPECIFIED), autoLink(false) {
96 }
97
98 /// destructor
99 ~OverlayMsg();
100
101 type_ getType() const {
102 return (type_) type;
103 }
104
105 const ServiceID& getService() const {
106 return service;
107 }
108
109 const NodeID& getSourceNode() const {
110 return sourceNode;
111 }
112
113 const LinkID& getRelayLink() const {
114 return relayLink;
115 }
116
117 void setRelayLink(const LinkID& relayLink) {
118 this->relayLink = relayLink;
119 }
120
121 const bool isAutoLink() const {
122 return autoLink;
123 }
124
125 void setAutoLink(bool autoLink) {
126 this->autoLink = autoLink;
127 }
128private:
129 uint8_t type;
130 ServiceID service;
131 NodeID sourceNode;
132 LinkID relayLink;
133 uint8_t autoLink;
134};
135
136}
137} // ariba::overlay
138
139sznBeginDefault( ariba::overlay::OverlayMsg, X ){
140X && type && &service && &sourceNode;
141if (type == typeDirectLink) X && &relayLink;
142if (type == typeUpdate) X && autoLink;
143X && Payload();
144}sznEnd();
145
146#endif // OVERLAY_MSG_H__
Note: See TracBrowser for help on using the repository browser.