Changeset 9684


Ignore:
Timestamp:
Mar 22, 2011, 4:05:57 PM (13 years ago)
Author:
mies
Message:

almost forgot to commit: doxygen modules :)

Location:
source/ariba
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/AribaModule.h

    r7535 r9684  
    6767}
    6868
    69 /**
     69/** \addtogroup public
     70 * @{
    7071 * This class implements a container class for ariba base services. Each node
    7172 * is a running using this base-module. It also manages Bootstrap information
     
    272273} // namespace ariba
    273274
     275/** @}*/
     276
    274277#endif /* ENVIRONMENT_H_ */
  • source/ariba/CommunicationListener.h

    r7535 r9684  
    5252}
    5353
    54 /**
     54/** \addtogroup public
     55 * @{
    5556 * Listener for communication events on links.
    5657 */
     
    136137} // namespace ariba
    137138
     139/** @} */
     140
    138141#endif /* COMMUNICATIONLISTENER_H_ */
  • source/ariba/DataMessage.h

    r7535 r9684  
    2121
    2222/**
     23 * \addtogroup public
     24 * @{
    2325 * This class wraps different representations of a message. In its current
    2426 * version is allows to specify binary data (as void*) with a size specifying
     
    148150} // namespace ariba
    149151
     152/** @} */
     153
    150154#endif /* DATAMESSAGE_H_ */
  • source/ariba/Identifiers.h

    r7468 r9684  
    4444#include "ariba/utility/types/LinkID.h"
    4545#include "ariba/utility/types/SpoVNetID.h"
     46/** \addtogroup public
     47 * @{
     48 */
    4649
    4750namespace ariba {
     
    5255} // namespace ariba
    5356
     57/** @} */
     58
    5459#endif /* IDENTIFIERS_H_ */
  • source/ariba/LinkProperties.h

    r7535 r9684  
    5454
    5555/**
     56 * \addtogroup public
     57 * @{
     58 *
    5659 * Link properties storage. Currently empty but will
    5760 * contain properties to create the link in the future
     
    8386} // namespace ariba
    8487
     88/** @} */
     89
    8590#endif /* LINKPROPERTIES_H_ */
  • source/ariba/Message.h

    r7535 r9684  
    4343#include "ariba/utility/messages.h"
    4444
     45/** \addtogroup public
     46 * @{
     47 */
     48
     49
    4550namespace ariba {
    4651        typedef uint16_t seqnum_t;
     52        //! \addtogroup public
    4753        typedef utility::Message Message;
    4854} // namespace ariba
    4955
     56/** @} */
     57
    5058#endif /* MESSAGE_H_ */
  • source/ariba/Module.h

    r2409 r9684  
    5050
    5151/**
     52 * \addtogroup public
     53 * @{
     54 *
    5255 * This class serves as base class for generic modules that
    5356 * can be initialized, started, stopped and configured using standard
     
    110113} // namespace ariba
    111114
     115/** @} */
     116
    112117#endif /* MODULE_H_ */
  • source/ariba/Name.cpp

    r6919 r9684  
    3838
    3939#include "Name.h"
     40
     41#include "ariba/utility/types/Identifier.h"
     42
     43using ariba::utility::Identifier;
    4044
    4145std::ostream& operator<<( std::ostream& s, const ariba::Name& n ) {
  • source/ariba/Name.h

    r7535 r9684  
    5656
    5757/**
     58 * \addtogroup public
     59 * @{
     60 *
    5861 * This class is a wrapper for canonical names.
    5962 * Currently only human readable names are supported.
     
    159162} // namespace ariba
    160163
     164/** @} */
     165
    161166#endif /* NAME_H_ */
  • source/ariba/Node.h

    r7535 r9684  
    6767
    6868/**
     69 * \addtogroup public
     70 * @{
     71 *
    6972 * This class should implement all ariba node functionality.
    7073 *
     
    338341} // namespace ariba
    339342
     343/** @} */
     344
    340345#endif /* NODE_H_ */
  • source/ariba/NodeListener.h

    r3056 r9684  
    5050
    5151/**
     52 * \addtogroup public
     53 * @{
     54 *
    5255 * This class is used to inform a listener about node changes.
    5356 *
     
    98101} // namespace ariba
    99102
     103/** @} */
     104
    100105#endif /* NODELISTENER_H_ */
  • source/ariba/SideportListener.h

    r7468 r9684  
    6161
    6262/**
     63 * \addtogroup public
     64 * @{
     65 *
    6366 * A sideport class to gather advanced information about nodes, links,
    6467 * their endpoints and get information about all link activity on a node.
     
    265268} // namespace ariba
    266269
     270/** @} */
     271
    267272#endif // SIDEPORTLISTENER_H_
  • source/ariba/SpoVNetProperties.h

    r7535 r9684  
    5757
    5858/**
     59 * \addtogroup public
     60 * @{
     61 *
    5962 * This class implements a container that holds all properties of a
    6063 * SpoVNet instance. It may evolve with new features when new features
     
    117120} // namespace ariba
    118121
     122/** @} */
     123
    119124#endif /* SPOVNETPROPERTIES_H_ */
  • source/ariba/communication/BaseCommunication.h

    r6941 r9684  
    131131
    132132        /// 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 );
    137134
    138135        /// Drops a link
    139         void dropLink(const LinkID link);
     136        void dropLink( LinkID link );
    140137
    141138        /**
     
    146143         * @return A sequence number for this message
    147144         */
    148         seqnum_t sendMessage(const LinkID lid, const Message* message);
     145        seqnum_t sendMessage( LinkID lid, const Message* message );
    149146
    150147        /**
     
    154151         * @return The end-point descriptor of the link's end-point
    155152         */
    156         const EndpointDescriptor& getEndpointDescriptor(const LinkID link =
    157                         LinkID::UNSPECIFIED) const;
     153        const EndpointDescriptor& getEndpointDescriptor(
     154                        LinkID link = LinkID::UNSPECIFIED) const;
    158155
    159156        /**
     
    212209        class LinkDescriptor {
    213210        public:
    214 
    215211                /// 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) {}
    221213
    222214                ~LinkDescriptor() {
     
    226218
    227219                bool isUnspecified() const {
    228                         return (this == &UNSPECIFIED());
     220                        return id.isUnspecified();
    229221                }
    230222
    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
    241230                const address_v* localLocator;
    242 
    243                 /// used underlay addresses for the link
    244                 LinkID remoteLink;
    245231                const address_v* remoteLocator;
    246232
    247233                /// the remote end-point descriptor
    248234                EndpointDescriptor remoteEndpoint;
    249 
    250                 /// flag, whether this link is up
    251                 bool up;
    252235        };
    253236
     
    259242
    260243        /// Link management: add a link
    261         void addLink( LinkDescriptor* link );
     244        LinkDescriptor& addLink( LinkID link );
    262245
    263246        /// Link management: remove a link
    264         void removeLink(const LinkID& localLink);
     247        void removeLink( LinkID link);
    265248
    266249        /// 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;
    271251
    272252        /// The local end-point descriptor
     
    307287        /// convenience: send message to peer
    308288        void send( Message* message, const EndpointDescriptor& endpoint );
     289
    309290        void send( Message* message, const LinkDescriptor& descriptor );
    310291
    311292        /// state of the base communication
    312293        bool started;
    313 
    314294};
    315295
  • source/ariba/communication/messages/AribaBaseMsg.cpp

    r6919 r9684  
    4444vsznDefault(AribaBaseMsg);
    4545
    46 AribaBaseMsg::AribaBaseMsg( type_ _type,
    47         const LinkID& localLink, const LinkID& remoteLink ) :
    48         type((uint8_t)_type),
    49         localLink(localLink),remoteLink(remoteLink) {
     46AribaBaseMsg::AribaBaseMsg( type_ _type, LinkID link ) :
     47        type((uint8_t)_type), link(link){
    5048}
    5149
  • source/ariba/communication/messages/AribaBaseMsg.h

    r5284 r9684  
    4141
    4242#include <string>
    43 #include <boost/cstdint.hpp>
     43#include <stdint.h>
     44
    4445#include "ariba/utility/messages.h"
    4546#include "ariba/utility/serialization.h"
     47
    4648#include "ariba/utility/types/LinkID.h"
    4749#include "ariba/utility/types/Address.h"
     
    7274        };
    7375
    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 );
    7877        virtual ~AribaBaseMsg();
    7978
     
    8483        }
    8584
    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;
    9287        }
    9388
     
    10196
    10297private:
    103         uint8_t type;           // the link message type
     98        // link message type
     99        uint8_t type;
    104100
    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;
    108103
    109         // remote and local endpoint descriptors
     104        // remote and local endpoint descriptors (link reply/request only)
    110105        EndpointDescriptor localDescriptor;
    111106        EndpointDescriptor remoteDescriptor;
     
    115110
    116111sznBeginDefault( 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) {
    119114                X && localDescriptor && remoteDescriptor;
     115        }
    120116        X && Payload();
    121117} sznEnd();
  • source/ariba/utility/serialization/Data.hpp

    r8620 r9684  
    351351        }
    352352public:
    353         finline DefaultDataModel() {
     353        DefaultDataModel() {
    354354                bufferPtr = NULL;
    355355                bufferLen = -1;
  • source/ariba/utility/types/LinkID.cpp

    r3690 r9684  
    3939#include "LinkID.h"
    4040
     41#include <boost/unordered_map.hpp>
     42
    4143namespace ariba {
    4244namespace utility {
    4345
    44 const LinkID LinkID::UNSPECIFIED; // for this link isvalid is always false!
     46/// the unspecified link id
     47const LinkID LinkID::UNSPECIFIED;
    4548
    46 LinkID::LinkID() : isvalid(false) {
     49const char* UNSPECIFIED_LINK    = "<LINKID-UNSPECIFIED>";
     50const char* UNKNOWN_LINK                = "<LINKID-UNKNOWN>";
     51const char* NULL_INFO                   = "<NO-INFO-AVAILABLE>";
     52
     53boost::unordered_map<uint16_t, const char*> link_ids;
     54
     55bool LinkID::isValid( const LinkID& id ) {
     56        return link_ids.count(id.local_id)!=0;
    4757}
    4858
    49 LinkID::LinkID(const Identifier& identifier) : Identifier(identifier), isvalid(true) {
     59const 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;
    5068}
    5169
    52 LinkID::~LinkID() {
     70/// create a new locally unique link id
     71LinkID 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);
    5379}
    5480
    55 LinkID::LinkID(const LinkID& rh) : Identifier(rh) {
     81/// free a locally unique link id
     82void LinkID::destroy( const LinkID& id ) {
     83        link_ids.erase(id.local_id);
    5684}
    5785
    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() );
     86std::ostream& operator<<(std::ostream& s, const LinkID& id ) {
     87        return s << id.toString();
    7288}
    7389
  • source/ariba/utility/types/LinkID.h

    r3690 r9684  
    4040#define LINKID_H_
    4141
     42#include <stdlib.h>
     43#include <stdint.h>
     44#include <stdio.h>
     45
    4246#include <vector>
    43 #include "ariba/utility/types/Identifier.h"
     47#include <string>
     48
     49#include "ariba/utility/serialization.h"
    4450
    4551using std::vector;
    46 using ariba::utility::Identifier;
    4752
    4853namespace ariba {
     
    5055
    5156/**
    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.
    5361 */
    54 class LinkID : public Identifier {
     62class LinkID {
     63private:
     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
    55104public:
     105        /// the unspecified link id
    56106        static const LinkID UNSPECIFIED;
    57107
    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; }
    69230};
    70231
     232std::ostream& operator<<(std::ostream& s, const LinkID& id );
     233
    71234typedef vector<LinkID> LinkIDs;
    72235
    73236}} // namespace ariba, utility
    74237
     238sznBeginDefault( ariba::utility::LinkID, X ) {
     239        if (X.isDeserializer()) local_id = 0;
     240        X && initiator_id && acceptor_id;
     241} sznEnd();
     242
     243
    75244#endif /* LINKID_H_ */
Note: See TracChangeset for help on using the changeset viewer.