Ignore:
Timestamp:
Jun 19, 2013, 11:05:49 AM (11 years ago)
Author:
hock@…
Message:

Reintegrate branch: 20130111-hock-message_classes

improvements:

  • new message classes (reboost, zero-copy)
  • "fast path" for direct links (skip overlay layer)
  • link-properties accessible from the application
  • SystemQueue can call boost::bind functions
  • protlib compatibility removed (32bit overhead saved in every message)
  • addressing2
  • AddressDiscovery discoveres only addresses on which we're actually listening
  • ariba serialization usage reduced (sill used in OverlayMsg)
  • Node::connect, easier and cleaner interface to start-up ariba from the application
  • ariba configs via JSON, XML, etc (boost::property_tree)
  • keep-alive overhead greatly reduced
  • (relayed) overlay links can actually be closed now
  • lost messages are detected in most cases
  • notification to the application when link is transformed into direct-link
  • overlay routing: send message to second best hop if it would be dropped otherwise
  • SequenceNumbers (only mechanisms, so for: upward compatibility)
  • various small fixes


regressions:

  • bluetooth is not yet working again
  • bootstrap modules deactivated
  • liblog4xx is not working (use cout-logging)

This patch brings great performance and stability improvements at cost of backward compatibility.
Also bluetooth and the bootstrap modules have not been ported to the new interfaces, yet.

Location:
source/ariba/overlay/messages
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/overlay/messages/JoinReply.cpp

    r3690 r12060  
    4444vsznDefault(JoinReply);
    4545
    46 JoinReply::JoinReply(const SpoVNetID _spovnetid, const OverlayParameterSet _param, bool _joinAllowed, const EndpointDescriptor _bootstrapEp)
    47         : spovnetid( _spovnetid ), param( _param ), joinAllowed( _joinAllowed ), bootstrapEp( _bootstrapEp ){
     46JoinReply::JoinReply(const SpoVNetID _spovnetid, const OverlayParameterSet _param, bool _joinAllowed)
     47        : spovnetid( _spovnetid ), param( _param ), joinAllowed( _joinAllowed )
     48{
    4849}
    4950
     
    6465}
    6566
    66 const EndpointDescriptor& JoinReply::getBootstrapEndpoint(){
    67         return bootstrapEp;
    68 }
     67//const EndpointDescriptor& JoinReply::getBootstrapEndpoint(){
     68//      return bootstrapEp;
     69//}
    6970
    7071}} // ariba::overlay
  • source/ariba/overlay/messages/JoinReply.h

    r5870 r12060  
    4040#define JOIN_REPLY_H__
    4141
    42 #include "ariba/utility/messages.h"
     42//#include "ariba/utility/messages.h"
     43#include "ariba/utility/messages/Message.h"
    4344#include "ariba/utility/serialization.h"
    4445#include "ariba/utility/types/SpoVNetID.h"
    4546#include "ariba/utility/types/NodeID.h"
    4647#include "ariba/utility/types/OverlayParameterSet.h"
    47 #include "ariba/communication/EndpointDescriptor.h"
     48//#include "ariba/communication/EndpointDescriptor.h"
    4849
    4950using ariba::utility::OverlayParameterSet;
     
    5152using ariba::utility::SpoVNetID;
    5253using ariba::utility::NodeID;
    53 using ariba::communication::EndpointDescriptor;
     54//using ariba::communication::EndpointDescriptor;
    5455
    5556namespace ariba {
     
    6465        OverlayParameterSet param; //< overlay parameters
    6566        bool joinAllowed; //< join successfull or access denied
    66         EndpointDescriptor bootstrapEp; //< the endpoint for bootstrapping the overlay interface
     67//      EndpointDescriptor bootstrapEp; //< the endpoint for bootstrapping the overlay interface
    6768
    6869public:
     
    7071                const SpoVNetID _spovnetid = SpoVNetID::UNSPECIFIED,
    7172                const OverlayParameterSet _param = OverlayParameterSet::DEFAULT,
    72                 bool _joinAllowed = false,
    73                 const EndpointDescriptor _bootstrapEp = EndpointDescriptor::UNSPECIFIED()
     73                bool _joinAllowed = false  /*,
     74                const EndpointDescriptor _bootstrapEp = EndpointDescriptor::UNSPECIFIED()*/
    7475        );
    7576
     
    7980        const OverlayParameterSet& getParam();
    8081        bool getJoinAllowed();
    81         const EndpointDescriptor& getBootstrapEndpoint();
     82//      const EndpointDescriptor& getBootstrapEndpoint();
    8283};
    8384
     
    8687sznBeginDefault( ariba::overlay::JoinReply, X ) {
    8788        uint8_t ja = joinAllowed;
    88         X && &spovnetid && param && bootstrapEp && ja;
     89        X && &spovnetid && param;
     90//      X && bootstrapEp;
     91        X && ja;
    8992        if (X.isDeserializer()) joinAllowed = ja;
    9093} sznEnd();
  • source/ariba/overlay/messages/OverlayMsg.h

    r10653 r12060  
    4747#include "ariba/utility/types/NodeID.h"
    4848#include "ariba/utility/types/LinkID.h"
    49 #include "ariba/communication/EndpointDescriptor.h"
    50 
     49// #include <ariba/utility/misc/sha1.h>
     50#include "ariba/overlay/SequenceNumber.h"
    5151
    5252namespace ariba {
     
    5757using ariba::utility::ServiceID;
    5858using ariba::utility::Message;
    59 using ariba::communication::EndpointDescriptor;
     59//using ariba::communication::EndpointDescriptor;
    6060using_serialization;
    6161
     
    6464 * between nodes.
    6565 *
    66  * @author Sebastian Mies <mies@tm.uka.de>
     66 * @author Sebastian Mies <mies@tm.uka.de>, Mario Hock
    6767 */
    6868class OverlayMsg: public Message { VSERIALIZEABLE;
     
    7575                maskTransfer    = 0x10, ///< bit mask for transfer messages
    7676                typeData        = 0x11, ///< message contains data for higher layers
     77                typeMessageLost = 0x12, ///< message contains info about a dropped message
    7778
    7879                // join signaling
     
    8788                typeLinkUpdate  = 0x33, ///< update message for link association
    8889                typeLinkDirect  = 0x34, ///< direct connection has been established
    89                 typeLinkAlive   = 0x35, ///< keep-alive message
     90                typeKeepAlive   = 0x35, ///< keep-alive message
     91                typeKeepAliveReply   = 0x36, ///< keep-alive message (replay)
     92                typeLinkClose   = 0x37,
    9093
    9194                /// DHT routed messages
     
    100103                maskDHTResponse = 0x50, ///< bit mask for dht responses
    101104                typeDHTData     = 0x51, ///< DHT get data
     105       
     106        /// misc message types
     107        typePing        = 0x44,
     108        typePong        = 0x45,
    102109
    103110                // topology signaling
     
    105112                typeSignalingEnd = 0xFF    ///< end of the signaling types
    106113        };
     114   
     115    /// message flags (uint8_t)
     116    enum flags_
     117    {
     118        flagRelayed         = 1 << 0,
     119        flagRegisterRelay   = 1 << 1,
     120        flagRouteRecord     = 1 << 2,
     121        flagSeqNum1         = 1 << 3,
     122        flagSeqNum2         = 1 << 4,
     123        flagAutoLink        = 1 << 5,
     124        flagLinkMessage     = 1 << 6,
     125        flagHasMoreFlags    = 1 << 7
     126    };
    107127
    108128        /// default constructor
     
    114134                const LinkID& _sourceLink      = LinkID::UNSPECIFIED,
    115135                const LinkID& _destinationLink = LinkID::UNSPECIFIED )
    116         :       type(type), flags(0), hops(0), ttl(10),
     136    :   type(type), flags(0), extended_flags(0), hops(0), ttl(10), priority(0),
    117137                service(_service),
    118138                sourceNode(_sourceNode), destinationNode(_destinationNode),
     
    125145        // copy constructor
    126146        OverlayMsg(const OverlayMsg& rhs)
    127         :       type(rhs.type), flags(rhs.flags), hops(rhs.hops), ttl(rhs.ttl),
    128                 service(rhs.service),
     147    :   type(rhs.type), flags(rhs.flags), extended_flags(rhs.extended_flags),
     148        hops(rhs.hops), ttl(rhs.ttl),
     149                priority(rhs.priority), service(rhs.service),
    129150                sourceNode(rhs.sourceNode), destinationNode(rhs.destinationNode),
    130151                sourceLink(rhs.sourceLink), destinationLink(rhs.destinationLink),
     
    149170        }
    150171
     172        /// priority ------------------------------------------------------------------
     173       
     174        uint8_t getPriority() const {
     175            return priority;
     176        }
     177       
     178        void setPriority(uint8_t priority) {
     179            this->priority = priority;
     180        }
     181       
    151182        /// flags ------------------------------------------------------------------
    152183
    153184        bool isRelayed() const {
    154                 return (flags & 0x01)!=0;
     185        return (flags & flagRelayed)!=0;
    155186        }
    156187
    157188        void setRelayed( bool relayed = true ) {
    158                 if (relayed) flags |= 1; else flags &= ~1;
     189        if (relayed) flags |= flagRelayed; else flags &= ~flagRelayed;
    159190        }
    160191
    161192        bool isRegisterRelay() const {
    162                 return (flags & 0x02)!=0;
     193                return (flags & flagRegisterRelay)!=0;
    163194        }
    164195
    165196        void setRegisterRelay( bool relayed = true ) {
    166                 if (relayed) flags |= 0x02; else flags &= ~0x02;
     197        if (relayed) flags |= flagRegisterRelay; else flags &= ~flagRegisterRelay;
    167198        }
    168199
    169200        bool isRouteRecord() const {
    170                 return (flags & 0x04)!=0;
     201                return (flags & flagRouteRecord)!=0;
    171202        }
    172203
    173204        void setRouteRecord( bool route_record = true ) {
    174                 if (route_record) flags |= 0x04; else flags &= ~0x04;
     205        if (route_record) flags |= flagRouteRecord; else flags &= ~flagRouteRecord;
    175206        }
    176207
    177208        bool isAutoLink() const {
    178                 return (flags & 0x80) == 0x80;
     209        return (flags & flagAutoLink) == flagAutoLink;
    179210        }
    180211
    181212        void setAutoLink(bool auto_link = true ) {
    182                 if (auto_link) flags |= 0x80; else flags &= ~0x80;
     213        if (auto_link) flags |= flagAutoLink; else flags &= ~flagAutoLink;
    183214        }
    184215
    185216        bool isLinkMessage() const {
    186                 return (flags & 0x40)!=0;
     217                return (flags & flagLinkMessage)!=0;
    187218        }
    188219
    189220        void setLinkMessage(bool link_info = true ) {
    190                 if (link_info) flags |= 0x40; else flags &= ~0x40;
    191         }
    192 
    193         bool containsSourceEndpoint() const {
    194                 return (flags & 0x20)!=0;
    195         }
    196 
    197         void setContainsSourceEndpoint(bool contains_endpoint) {
    198                 if (contains_endpoint) flags |= 0x20; else flags &= ~0x20;
    199         }
     221        if (link_info) flags |= flagLinkMessage; else flags &= ~flagLinkMessage;
     222        }
     223       
     224        bool hasExtendedFlags() const {
     225        return (flags & flagHasMoreFlags) == flagHasMoreFlags;
     226    }
    200227
    201228        /// number of hops and time to live ----------------------------------------
     
    264291                this->destinationLink = link;
    265292                setLinkMessage();
    266         }
    267 
    268         void setSourceEndpoint( const EndpointDescriptor& endpoint ) {
    269                 sourceEndpoint = endpoint;
    270                 setContainsSourceEndpoint(true);
    271         }
    272 
    273         const EndpointDescriptor& getSourceEndpoint() const {
    274                 return sourceEndpoint;
    275293        }
    276294
     
    284302                destinationLink = dummyLink;
    285303                hops = 0;
     304                routeRecord.clear();
    286305        }
    287306
     
    294313                        routeRecord.push_back(node);
    295314        }
     315       
     316        /// sequence numbers
     317        bool hasShortSeqNum() const
     318    {
     319        return (flags & (flagSeqNum1 | flagSeqNum2)) == flagSeqNum1;
     320    }
     321   
     322    bool hasLongSeqNum() const
     323    {
     324        return (flags & (flagSeqNum1 | flagSeqNum2)) == flagSeqNum2;
     325    }
     326   
     327    void setSeqNum(const SequenceNumber& sequence_number)
     328    {
     329        this->seqnum = sequence_number;
     330       
     331        // short seqnum
     332        if ( sequence_number.isShortSeqNum() )
     333        {
     334            flags |= flagSeqNum1;
     335            flags &= ~flagSeqNum2;
     336        }
     337        // longseqnum
     338        else if ( sequence_number.isShortSeqNum() )
     339        {
     340            flags &= ~flagSeqNum1;
     341            flags |= flagSeqNum2;
     342        }
     343        // no seqnum
     344        else
     345        {
     346            flags &= ~flagSeqNum1;
     347            flags &= ~flagSeqNum2;
     348        }
     349    }
     350   
     351    const SequenceNumber& getSeqNum() const
     352    {
     353        return seqnum;
     354    }
     355   
    296356
    297357private:
    298         uint8_t type, flags, hops, ttl;
     358        uint8_t type, flags, extended_flags, hops, ttl, priority;
    299359        ServiceID service;
    300360        NodeID sourceNode;
     
    302362        LinkID sourceLink;
    303363        LinkID destinationLink;
    304         EndpointDescriptor sourceEndpoint;
     364//      EndpointDescriptor sourceEndpoint;
    305365        vector<NodeID> routeRecord;
     366    SequenceNumber seqnum;
    306367};
    307368
     
    311372sznBeginDefault( ariba::overlay::OverlayMsg, X ){
    312373        // header
    313         X && type && flags && hops && ttl;
     374        X && type && flags;
     375   
     376    if ( hasExtendedFlags() )
     377        X && extended_flags;
     378   
     379    X && hops && ttl;
    314380
    315381        // addresses
    316382        X && &service && &sourceNode && &destinationNode;
     383       
     384        // priority
     385        X && priority;
    317386
    318387        // message is associated with a end-to-end link
     
    320389                X && &sourceLink && &destinationLink;
    321390
    322         // message is associated with a source end-point
    323         if (containsSourceEndpoint())
    324                 X && sourceEndpoint;
    325 
     391   
     392    /* seqnum */
     393    // serialize
     394    if ( X.isSerializer() )
     395    {
     396        if ( hasShortSeqNum() )
     397        {
     398            uint32_t short_seqnum;
     399            short_seqnum = seqnum.getShortSeqNum();
     400            X && short_seqnum;
     401        }
     402        if ( hasLongSeqNum() )
     403        {
     404            uint64_t long_seqnum;
     405            long_seqnum = seqnum.getLongSeqNum();
     406            X && long_seqnum;
     407        }
     408    }
     409    // deserialize
     410    else
     411    {
     412        if ( hasShortSeqNum() )
     413        {
     414            uint32_t short_seqnum;
     415            X && short_seqnum;
     416            seqnum = ariba::overlay::SequenceNumber(short_seqnum);
     417        }
     418        if ( hasLongSeqNum() )
     419        {
     420            uint64_t long_seqnum;
     421            X && long_seqnum;
     422            seqnum = ariba::overlay::SequenceNumber(long_seqnum);
     423        }       
     424    }
     425   
     426   
    326427        // message should record its route
    327428        if (isRouteRecord()) {
     
    333434
    334435        // payload
    335         X && Payload();
     436//      X && Payload();
    336437} sznEnd();
    337438
Note: See TracChangeset for help on using the changeset viewer.