- Timestamp:
- Mar 22, 2011, 4:05:57 PM (14 years ago)
- Location:
- source/ariba
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/AribaModule.h
r7535 r9684 67 67 } 68 68 69 /** 69 /** \addtogroup public 70 * @{ 70 71 * This class implements a container class for ariba base services. Each node 71 72 * is a running using this base-module. It also manages Bootstrap information … … 272 273 } // namespace ariba 273 274 275 /** @}*/ 276 274 277 #endif /* ENVIRONMENT_H_ */ -
source/ariba/CommunicationListener.h
r7535 r9684 52 52 } 53 53 54 /** 54 /** \addtogroup public 55 * @{ 55 56 * Listener for communication events on links. 56 57 */ … … 136 137 } // namespace ariba 137 138 139 /** @} */ 140 138 141 #endif /* COMMUNICATIONLISTENER_H_ */ -
source/ariba/DataMessage.h
r7535 r9684 21 21 22 22 /** 23 * \addtogroup public 24 * @{ 23 25 * This class wraps different representations of a message. In its current 24 26 * version is allows to specify binary data (as void*) with a size specifying … … 148 150 } // namespace ariba 149 151 152 /** @} */ 153 150 154 #endif /* DATAMESSAGE_H_ */ -
source/ariba/Identifiers.h
r7468 r9684 44 44 #include "ariba/utility/types/LinkID.h" 45 45 #include "ariba/utility/types/SpoVNetID.h" 46 /** \addtogroup public 47 * @{ 48 */ 46 49 47 50 namespace ariba { … … 52 55 } // namespace ariba 53 56 57 /** @} */ 58 54 59 #endif /* IDENTIFIERS_H_ */ -
source/ariba/LinkProperties.h
r7535 r9684 54 54 55 55 /** 56 * \addtogroup public 57 * @{ 58 * 56 59 * Link properties storage. Currently empty but will 57 60 * contain properties to create the link in the future … … 83 86 } // namespace ariba 84 87 88 /** @} */ 89 85 90 #endif /* LINKPROPERTIES_H_ */ -
source/ariba/Message.h
r7535 r9684 43 43 #include "ariba/utility/messages.h" 44 44 45 /** \addtogroup public 46 * @{ 47 */ 48 49 45 50 namespace ariba { 46 51 typedef uint16_t seqnum_t; 52 //! \addtogroup public 47 53 typedef utility::Message Message; 48 54 } // namespace ariba 49 55 56 /** @} */ 57 50 58 #endif /* MESSAGE_H_ */ -
source/ariba/Module.h
r2409 r9684 50 50 51 51 /** 52 * \addtogroup public 53 * @{ 54 * 52 55 * This class serves as base class for generic modules that 53 56 * can be initialized, started, stopped and configured using standard … … 110 113 } // namespace ariba 111 114 115 /** @} */ 116 112 117 #endif /* MODULE_H_ */ -
source/ariba/Name.cpp
r6919 r9684 38 38 39 39 #include "Name.h" 40 41 #include "ariba/utility/types/Identifier.h" 42 43 using ariba::utility::Identifier; 40 44 41 45 std::ostream& operator<<( std::ostream& s, const ariba::Name& n ) { -
source/ariba/Name.h
r7535 r9684 56 56 57 57 /** 58 * \addtogroup public 59 * @{ 60 * 58 61 * This class is a wrapper for canonical names. 59 62 * Currently only human readable names are supported. … … 159 162 } // namespace ariba 160 163 164 /** @} */ 165 161 166 #endif /* NAME_H_ */ -
source/ariba/Node.h
r7535 r9684 67 67 68 68 /** 69 * \addtogroup public 70 * @{ 71 * 69 72 * This class should implement all ariba node functionality. 70 73 * … … 338 341 } // namespace ariba 339 342 343 /** @} */ 344 340 345 #endif /* NODE_H_ */ -
source/ariba/NodeListener.h
r3056 r9684 50 50 51 51 /** 52 * \addtogroup public 53 * @{ 54 * 52 55 * This class is used to inform a listener about node changes. 53 56 * … … 98 101 } // namespace ariba 99 102 103 /** @} */ 104 100 105 #endif /* NODELISTENER_H_ */ -
source/ariba/SideportListener.h
r7468 r9684 61 61 62 62 /** 63 * \addtogroup public 64 * @{ 65 * 63 66 * A sideport class to gather advanced information about nodes, links, 64 67 * their endpoints and get information about all link activity on a node. … … 265 268 } // namespace ariba 266 269 270 /** @} */ 271 267 272 #endif // SIDEPORTLISTENER_H_ -
source/ariba/SpoVNetProperties.h
r7535 r9684 57 57 58 58 /** 59 * \addtogroup public 60 * @{ 61 * 59 62 * This class implements a container that holds all properties of a 60 63 * SpoVNet instance. It may evolve with new features when new features … … 117 120 } // namespace ariba 118 121 122 /** @} */ 123 119 124 #endif /* SPOVNETPROPERTIES_H_ */ -
source/ariba/communication/BaseCommunication.h
r6941 r9684 131 131 132 132 /// Establishes a link to another end-point. 133 const LinkID establishLink(const EndpointDescriptor& descriptor, 134 const LinkID& linkid = LinkID::UNSPECIFIED, const QoSParameterSet& qos = 135 QoSParameterSet::DEFAULT, const SecurityParameterSet& sec = 136 SecurityParameterSet::DEFAULT); 133 const LinkID establishLink(const EndpointDescriptor& descriptor ); 137 134 138 135 /// Drops a link 139 void dropLink( const LinkID link);136 void dropLink( LinkID link ); 140 137 141 138 /** … … 146 143 * @return A sequence number for this message 147 144 */ 148 seqnum_t sendMessage( const LinkID lid, const Message* message);145 seqnum_t sendMessage( LinkID lid, const Message* message ); 149 146 150 147 /** … … 154 151 * @return The end-point descriptor of the link's end-point 155 152 */ 156 const EndpointDescriptor& getEndpointDescriptor( const LinkID link =157 LinkID ::UNSPECIFIED) const;153 const EndpointDescriptor& getEndpointDescriptor( 154 LinkID link = LinkID::UNSPECIFIED) const; 158 155 159 156 /** … … 212 209 class LinkDescriptor { 213 210 public: 214 215 211 /// default constructor 216 LinkDescriptor() : 217 localLink(LinkID::UNSPECIFIED), localLocator(NULL), 218 remoteLink(LinkID::UNSPECIFIED), remoteLocator(NULL), 219 up(false) { 220 } 212 LinkDescriptor() : up(false), id(), localLocator(NULL), remoteLocator(NULL) {} 221 213 222 214 ~LinkDescriptor() { … … 226 218 227 219 bool isUnspecified() const { 228 return (this == &UNSPECIFIED());220 return id.isUnspecified(); 229 221 } 230 222 231 static LinkDescriptor& UNSPECIFIED(){ 232 static LinkDescriptor* unspec = NULL; 233 if(unspec == NULL) unspec = new LinkDescriptor(); 234 return *unspec; 235 } 236 237 bool unspecified; 238 239 /// link identifiers 240 LinkID localLink; 223 /// flag, whether this link is up 224 bool up; 225 226 /// link identifier 227 LinkID id; 228 229 /// locators 241 230 const address_v* localLocator; 242 243 /// used underlay addresses for the link244 LinkID remoteLink;245 231 const address_v* remoteLocator; 246 232 247 233 /// the remote end-point descriptor 248 234 EndpointDescriptor remoteEndpoint; 249 250 /// flag, whether this link is up251 bool up;252 235 }; 253 236 … … 259 242 260 243 /// Link management: add a link 261 void addLink( LinkDescriptor*link );244 LinkDescriptor& addLink( LinkID link ); 262 245 263 246 /// Link management: remove a link 264 void removeLink( const LinkID& localLink);247 void removeLink( LinkID link); 265 248 266 249 /// Link management: get link information using the local link 267 LinkDescriptor& queryLocalLink(const LinkID& localLink) const; 268 269 /// Link management: get link information using the remote link 270 LinkDescriptor& queryRemoteLink(const LinkID& remoteLink) const; 250 LinkDescriptor& queryLink( LinkID link) const; 271 251 272 252 /// The local end-point descriptor … … 307 287 /// convenience: send message to peer 308 288 void send( Message* message, const EndpointDescriptor& endpoint ); 289 309 290 void send( Message* message, const LinkDescriptor& descriptor ); 310 291 311 292 /// state of the base communication 312 293 bool started; 313 314 294 }; 315 295 -
source/ariba/communication/messages/AribaBaseMsg.cpp
r6919 r9684 44 44 vsznDefault(AribaBaseMsg); 45 45 46 AribaBaseMsg::AribaBaseMsg( type_ _type, 47 const LinkID& localLink, const LinkID& remoteLink ) : 48 type((uint8_t)_type), 49 localLink(localLink),remoteLink(remoteLink) { 46 AribaBaseMsg::AribaBaseMsg( type_ _type, LinkID link ) : 47 type((uint8_t)_type), link(link){ 50 48 } 51 49 -
source/ariba/communication/messages/AribaBaseMsg.h
r5284 r9684 41 41 42 42 #include <string> 43 #include <boost/cstdint.hpp> 43 #include <stdint.h> 44 44 45 #include "ariba/utility/messages.h" 45 46 #include "ariba/utility/serialization.h" 47 46 48 #include "ariba/utility/types/LinkID.h" 47 49 #include "ariba/utility/types/Address.h" … … 72 74 }; 73 75 74 AribaBaseMsg( type_ type = typeData, 75 const LinkID& localLink = LinkID::UNSPECIFIED, 76 const LinkID& remoteLink = LinkID::UNSPECIFIED ); 77 76 AribaBaseMsg( type_ type = typeData, LinkID link = LinkID::UNSPECIFIED ); 78 77 virtual ~AribaBaseMsg(); 79 78 … … 84 83 } 85 84 86 const LinkID& getLocalLink() const { 87 return localLink; 88 } 89 90 const LinkID& getRemoteLink() const { 91 return remoteLink; 85 const LinkID& getLink() const { 86 return link; 92 87 } 93 88 … … 101 96 102 97 private: 103 uint8_t type; // the link message type 98 // link message type 99 uint8_t type; 104 100 105 // remote and local link ids 106 LinkID localLink; // the local link id 107 LinkID remoteLink; // the remote link id 101 // link identifier 102 LinkID link; 108 103 109 // remote and local endpoint descriptors 104 // remote and local endpoint descriptors (link reply/request only) 110 105 EndpointDescriptor localDescriptor; 111 106 EndpointDescriptor remoteDescriptor; … … 115 110 116 111 sznBeginDefault( ariba::communication::AribaBaseMsg, X ) { 117 X && type && &localLink && &remoteLink;118 if (type == typeLinkReply || type == typeLinkRequest) 112 X && type && link; 113 if (type == typeLinkReply || type == typeLinkRequest) { 119 114 X && localDescriptor && remoteDescriptor; 115 } 120 116 X && Payload(); 121 117 } sznEnd(); -
source/ariba/utility/serialization/Data.hpp
r8620 r9684 351 351 } 352 352 public: 353 finlineDefaultDataModel() {353 DefaultDataModel() { 354 354 bufferPtr = NULL; 355 355 bufferLen = -1; -
source/ariba/utility/types/LinkID.cpp
r3690 r9684 39 39 #include "LinkID.h" 40 40 41 #include <boost/unordered_map.hpp> 42 41 43 namespace ariba { 42 44 namespace utility { 43 45 44 const LinkID LinkID::UNSPECIFIED; // for this link isvalid is always false! 46 /// the unspecified link id 47 const LinkID LinkID::UNSPECIFIED; 45 48 46 LinkID::LinkID() : isvalid(false) { 49 const char* UNSPECIFIED_LINK = "<LINKID-UNSPECIFIED>"; 50 const char* UNKNOWN_LINK = "<LINKID-UNKNOWN>"; 51 const char* NULL_INFO = "<NO-INFO-AVAILABLE>"; 52 53 boost::unordered_map<uint16_t, const char*> link_ids; 54 55 bool LinkID::isValid( const LinkID& id ) { 56 return link_ids.count(id.local_id)!=0; 47 57 } 48 58 49 LinkID::LinkID(const Identifier& identifier) : Identifier(identifier), isvalid(true) { 59 const char* LinkID::getInfo( const LinkID& id ) { 60 if (!id.valid()) 61 return UNSPECIFIED_LINK; 62 if ( link_ids.count(id.local_id) == 0 ) 63 return UNKNOWN_LINK; 64 const char* info = link_ids.find( id.local_id )->second; 65 if (info == NULL) 66 return NULL_INFO; 67 return info; 50 68 } 51 69 52 LinkID::~LinkID() { 70 /// create a new locally unique link id 71 LinkID LinkID::create( const char* info ) { 72 assert( link_ids.size() != 0xFFFE ); 73 uint16_t id; 74 do { 75 id = rand() & 0xFFFF; 76 } while (id == 0 || link_ids.count(id) != 0); 77 link_ids.insert( std::make_pair(id, info) ); 78 return LinkID(id); 53 79 } 54 80 55 LinkID::LinkID(const LinkID& rh) : Identifier(rh) { 81 /// free a locally unique link id 82 void LinkID::destroy( const LinkID& id ) { 83 link_ids.erase(id.local_id); 56 84 } 57 85 58 LinkID& LinkID::operator=(const LinkID& rh){ 59 60 Identifier::operator=( rh ); 61 this->isvalid = rh.isvalid; 62 63 return *this; 64 } 65 66 bool LinkID::valid(){ 67 return isvalid; 68 } 69 70 LinkID LinkID::create() { 71 return LinkID( Identifier::random() ); 86 std::ostream& operator<<(std::ostream& s, const LinkID& id ) { 87 return s << id.toString(); 72 88 } 73 89 -
source/ariba/utility/types/LinkID.h
r3690 r9684 40 40 #define LINKID_H_ 41 41 42 #include <stdlib.h> 43 #include <stdint.h> 44 #include <stdio.h> 45 42 46 #include <vector> 43 #include "ariba/utility/types/Identifier.h" 47 #include <string> 48 49 #include "ariba/utility/serialization.h" 44 50 45 51 using std::vector; 46 using ariba::utility::Identifier;47 52 48 53 namespace ariba { … … 50 55 51 56 /** 52 * Represents a link from the base communication. 57 * The link id identifies a link between two devices/nodes. 58 * 59 * Its a 32-bit value, that is composed out of two 16-bit values 60 * identifing a initiator and acceptor id. 53 61 */ 54 class LinkID : public Identifier { 62 class LinkID { 63 private: 64 uint16_t local_id; 65 uint16_t initiator_id; 66 uint16_t acceptor_id; 67 68 69 LinkID(uint16_t local_id) { 70 this->local_id = local_id; 71 this->initiator_id = 0; 72 this->acceptor_id = 0; 73 } 74 75 /// returns the full id 76 inline uint32_t getFullId() const { 77 return (initiator_id << 16) + acceptor_id; 78 } 79 80 inline int compareTo( const LinkID& rhs ) const { 81 // compare local id 82 if (rhs.isLocal() && this->isLocal()) 83 return local_id - rhs.local_id; 84 85 // compare initiator id 86 else if ((initiator_id == 0 || rhs.initiator_id == 0) 87 && (acceptor_id == rhs.acceptor_id) ) return 0; 88 89 // compare acceptor id 90 else if ((acceptor_id == 0 || rhs.acceptor_id == 0) 91 && (initiator_id == rhs.initiator_id) ) return 0; 92 93 // compare full id 94 else if (getFullId() == rhs.getFullId()) return 0; 95 else if (getFullId() < rhs.getFullId()) return -1; 96 else if (getFullId() > rhs.getFullId()) return 1; 97 return -1; 98 } 99 100 static const char* getInfo( const LinkID& id ); 101 102 static bool isValid( const LinkID& id ); 103 55 104 public: 105 /// the unspecified link id 56 106 static const LinkID UNSPECIFIED; 57 107 58 LinkID(); 59 LinkID(const LinkID& rh); 60 LinkID(const Identifier& identifier); 61 virtual ~LinkID(); 62 LinkID& operator=(const LinkID& rh); 63 64 bool valid(); 65 static LinkID create(); 66 67 private: 68 bool isvalid; 108 /// create a new locally unique link id 109 static LinkID create( const char* info = NULL ); 110 111 /// free a locally unique link id 112 static void destroy( const LinkID& id ); 113 114 /// construct a unspecified id 115 LinkID() { 116 local_id = 0; 117 initiator_id = 0; 118 acceptor_id = 0; 119 } 120 121 /// copy constructor 122 LinkID( const LinkID& rh ); 123 124 /// assigns another link id 125 LinkID& operator=(const LinkID& rh) { 126 local_id = rh.local_id; 127 initiator_id = rh.initiator_id; 128 acceptor_id = rh.acceptor_id; 129 return *this; 130 } 131 132 /// returns true, if the local link id is known and registered 133 bool isValid() const { 134 return isValid(*this); 135 } 136 137 bool isUnspecified() const { 138 return local_id == 0 && initiator_id == 0 && acceptor_id == 0; 139 } 140 141 /// returns true, if this is a local id only 142 bool isLocal() const { 143 return acceptor_id == 0 && initiator_id == 0; 144 } 145 146 /// returns true, if this is a remote id only 147 bool isRemote() const { 148 return local_id == 0; 149 } 150 151 /// returns true, if this is a full link id (with acceptor/initiator id) 152 bool isLink() const { 153 return acceptor_id != 0 && initiator_id != 0; 154 } 155 156 /// returns the local id 157 uint16_t getLocalId() const { 158 return local_id; 159 } 160 161 /// returns the remote id 162 uint16_t getRemoteId() const { 163 return local_id == initiator_id ? acceptor_id : initiator_id; 164 } 165 166 /// returns the initiators local link id 167 uint16_t getInitiatorId() const { 168 return initiator_id; 169 } 170 171 /// returns the acceptors local link id 172 uint16_t getAcceptorId() const { 173 return acceptor_id; 174 } 175 176 /// sets the local initiator id of the link 177 /// if id is unspecified a new local id is used as initiator id 178 void setInitiatorId( const LinkID& id = UNSPECIFIED ) { 179 assert(initiator_id == 0); 180 if ( id == UNSPECIFIED ) { 181 assert(local_id == 0); 182 local_id = LinkID::create().local_id; 183 initiator_id = local_id; 184 } else { 185 assert(local_id == acceptor_id && id.local_id == 0 && id.initiator_id != 0); 186 initiator_id = id.initiator_id; 187 } 188 } 189 190 /// sets the local acceptor id of the link 191 /// if id is unspecified a new local id is used as acceptor id 192 void setAcceptorId( const LinkID& id = UNSPECIFIED ) { 193 assert(acceptor_id == 0); 194 if ( id == UNSPECIFIED ) { 195 assert(local_id == 0); 196 local_id = LinkID::create().local_id; 197 acceptor_id = local_id; 198 } else { 199 assert(local_id == initiator_id && id.local_id == 0 && id.acceptor_id != 0); 200 acceptor_id = id.acceptor_id; 201 } 202 } 203 204 void combine( const LinkID& id ) { 205 206 } 207 208 /// returns a string representation of the link id 209 std::string toString() const { 210 char str[20]; 211 if (isLocal()) 212 sprintf(str, "l%04x", local_id); 213 else 214 sprintf(str, "i%04x.a%04x", initiator_id, acceptor_id ); 215 return std::string(str); 216 } 217 218 /// returns the info of the link id 219 const char* getInfo() const { 220 return getInfo(*this); 221 } 222 223 /// convenience operators 224 bool operator==( const LinkID& rhs ) const { return compareTo(rhs) == 0; } 225 bool operator!=( const LinkID& rhs ) const { return compareTo(rhs) != 0; } 226 bool operator< ( const LinkID& rhs ) const { return compareTo(rhs) < 0; } 227 bool operator<=( const LinkID& rhs ) const { return compareTo(rhs) <= 0; } 228 bool operator> ( const LinkID& rhs ) const { return compareTo(rhs) > 0; } 229 bool operator>=( const LinkID& rhs ) const { return compareTo(rhs) >= 0; } 69 230 }; 70 231 232 std::ostream& operator<<(std::ostream& s, const LinkID& id ); 233 71 234 typedef vector<LinkID> LinkIDs; 72 235 73 236 }} // namespace ariba, utility 74 237 238 sznBeginDefault( ariba::utility::LinkID, X ) { 239 if (X.isDeserializer()) local_id = 0; 240 X && initiator_id && acceptor_id; 241 } sznEnd(); 242 243 75 244 #endif /* LINKID_H_ */
Note:
See TracChangeset
for help on using the changeset viewer.