Changeset 2440
- Timestamp:
- Feb 17, 2009, 12:07:04 PM (16 years ago)
- Location:
- source/ariba
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/SpoVNetProperties.cpp
r2409 r2440 43 43 const SpoVNetProperties SpoVNetProperties::DEFAULT; 44 44 45 SpoVNetProperties::SpoVNetProperties() : 46 name( Name::random() ), type( ONE_HOP_OVERLAY ), idLength( 192 ), 47 initiator( NodeID::UNSPECIFIED ), hidden( false ) { 48 49 id = name.toSpoVNetId(); 45 50 } 51 52 SpoVNetProperties::SpoVNetProperties(const SpoVNetProperties& copy) : 53 name( copy.name ), id( copy.id ), 54 type( copy.type ), idLength( copy.idLength ), 55 initiator( copy.initiator ), hidden( copy.hidden ) { 56 } 57 58 SpoVNetProperties::~SpoVNetProperties() { 59 } 60 61 const Name& SpoVNetProperties::getName() const { 62 return name; 63 } 64 65 const SpoVNetID& SpoVNetProperties::getId() const { 66 return id; 67 } 68 69 const NodeID& SpoVNetProperties::getInitiator() const { 70 return initiator; 71 } 72 73 uint16_t SpoVNetProperties::getIdentifierLength() const { 74 return idLength; 75 } 76 77 const SpoVNetProperties::OverlayType SpoVNetProperties::getBaseOverlayType() const { 78 return (OverlayType)type; 79 } 80 81 bool SpoVNetProperties::isHidden() const { 82 return hidden; 83 } 84 85 std::string SpoVNetProperties::toString() const { 86 std::ostringstream buf; 87 buf << "spovnet" 88 << " name=" << name.toString() 89 << " id=" << id.toString() 90 << " overlay_type=" << type 91 << " id_length=" << idLength 92 << " initiator=" << initiator 93 << " hidden=" << hidden; 94 return buf.str(); 95 } 96 97 } // namespace ariba -
source/ariba/SpoVNetProperties.h
r2409 r2440 70 70 KADEMLIA_OVERLAY = 2, 71 71 }; 72 private:73 Name name;74 SpoVNetID id;75 uint8_t type;76 uint16_t idLength;77 NodeID initiator;78 bool hidden;79 72 80 public: 73 81 74 /** 82 75 * This object holds the default settings for a newly created spovnet 83 76 * instance. 84 77 */ 85 const staticSpoVNetProperties DEFAULT;78 static const SpoVNetProperties DEFAULT; 86 79 87 public:88 80 /** 89 81 * Constructs a new default SpoVnet property object. 90 82 */ 91 SpoVNetProperties() { 92 name = Name::random(); 93 id = name.toSpoVNetId(); 94 type = ONE_HOP_OVERLAY; 95 idLength = 192; 96 initiator = NodeID::UNSPECIFIED; 97 hidden = false; 98 } 83 SpoVNetProperties(); 99 84 100 85 /** … … 113 98 * Copy constructor. 114 99 */ 115 SpoVNetProperties(const SpoVNetProperties& copy) { 116 this->name = copy.name; 117 this->id = copy.id; 118 this->type = copy.type; 119 this->idLength = copy.idLength; 120 this->initiator = copy.initiator; 121 this->hidden = copy.hidden; 122 } 100 SpoVNetProperties(const SpoVNetProperties& copy); 123 101 124 102 /** 125 103 * Destructor. 126 104 */ 127 ~SpoVNetProperties() { 128 } 105 virtual ~SpoVNetProperties(); 129 106 130 107 /** 131 108 * Returns the canonical SpoVNet name 132 109 */ 133 const Name& getName() const { 134 return name; 135 } 110 const Name& getName() const; 136 111 137 112 /** 138 113 * Returns the SpoVNet id 139 114 */ 140 const SpoVNetID& getId() const { 141 return id; 142 } 115 const SpoVNetID& getId() const; 143 116 144 117 /** … … 146 119 * If the node id is unspecified, the initiator wanted to be anonymous. 147 120 */ 148 const NodeID& getInitiator() const { 149 return initiator; 150 } 121 const NodeID& getInitiator() const; 151 122 152 123 /** 153 124 * Returns the node identifier length in bites 154 125 */ 155 uint16_t getIdentifierLength() const { 156 return idLength; 157 } 126 uint16_t getIdentifierLength() const; 158 127 159 128 /** 160 129 * Returns the overlay type. 161 130 */ 162 const OverlayType getBaseOverlayType() const { 163 return (OverlayType)type; 164 } 131 const OverlayType getBaseOverlayType() const; 165 132 166 133 /** 167 134 * Returns true, if the spovnet is hidden 168 135 */ 169 bool isHidden() const { 170 return hidden; 171 } 136 bool isHidden() const; 172 137 173 138 /** … … 176 141 * @return A human readable string representation of the SpoVNet properties 177 142 */ 178 std::string toString() const { 179 std::ostringstream buf; 180 buf << "spovnet" 181 << " name=" << name.toString() 182 << " id=" << id.toString() 183 << " base_overlay_type=" << type << " id_length=" 184 << idLength << " initiator=" << initiator 185 << " hidden=" << hidden; 186 return buf.str(); 187 } 143 std::string toString() const; 144 145 private: 146 Name name; 147 SpoVNetID id; 148 uint8_t type; 149 uint16_t idLength; 150 NodeID initiator; 151 bool hidden; 188 152 }; 189 153 190 } 154 } // namespace ariba 191 155 192 156 #endif /* SPOVNETPROPERTIES_H_ */
Note:
See TracChangeset
for help on using the changeset viewer.