00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef DISCOVERY_H__
00040 #define DISCOVERY_H__
00041
00042 #include <vector>
00043
00044 #include "ariba/utility/messages.h"
00045 #include "ariba/utility/serialization.h"
00046 #include "ariba/utility/types/NodeID.h"
00047 #include "ariba/communication/EndpointDescriptor.h"
00048
00049 using std::pair;
00050 using std::make_pair;
00051 using std::vector;
00052 using ariba::utility::Message;
00053 using ariba::utility::NodeID;
00054 using ariba::communication::EndpointDescriptor;
00055
00056 namespace ariba {
00057 namespace overlay {
00058
00059 using_serialization;
00060
00061 class Discovery : public Message {
00062 VSERIALIZEABLE;
00063 public:
00064 enum type_ {
00065 invalid = 0,
00066 normal = 1,
00067 successor = 2,
00068 predecessor = 3
00069 };
00070
00071 Discovery( const Discovery& msg ) : type(msg.type), ttl(msg.ttl),
00072 endpoint(msg.endpoint) {
00073 }
00074 Discovery( type_ type = invalid, uint8_t ttl = 4,
00075 const EndpointDescriptor& endpoint = EndpointDescriptor::UNSPECIFIED() )
00076 : type(type), ttl(ttl), endpoint(endpoint) {
00077 }
00078 virtual ~Discovery();
00079
00080 inline type_ getType() const {
00081 return (type_)type;
00082 }
00083
00084 inline void setType( type_ type ) {
00085 this->type = type;
00086 }
00087
00088 inline uint8_t getTTL() const {
00089 return ttl;
00090 }
00091
00092 inline void setTTL( uint8_t ttl ) {
00093 this->ttl = ttl;
00094 }
00095
00096 inline const EndpointDescriptor& getEndpoint() const {
00097 return endpoint;
00098 }
00099
00100 inline void setEndpoint( const EndpointDescriptor& endpoint ) {
00101 this->endpoint = endpoint;
00102 }
00103
00104 private:
00105 uint8_t type;
00106 uint8_t ttl;
00107 EndpointDescriptor endpoint;
00108 };
00109
00110 }}
00111
00112 sznBeginDefault( ariba::overlay::Discovery, X ) {
00113 X && type && ttl && endpoint;
00114 } sznEnd();
00115
00116 #endif // DISCOVERY_H__