Changeset 7468


Ignore:
Timestamp:
Jan 25, 2010, 10:50:57 AM (14 years ago)
Author:
Christoph Mayer
Message:

-timer delete fix (noch auskommentiert), -interface cleanup

Files:
22 edited

Legend:

Unmodified
Added
Removed
  • sample/pingpong/PingPong.cpp

    r6959 r7468  
    210210}
    211211
    212 bool PingPong::onLinkRequest(const NodeID& remote, const DataMessage& msg) {
     212bool PingPong::onLinkRequest(const NodeID& remote) {
    213213        logging_info( "node " << remote.toString() << " wants to build up a link with us ... allowing" );
    214214        return true;
  • sample/pingpong/PingPong.h

    r5316 r7468  
    3838protected:
    3939        // communication listener interface
    40         virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg =
    41                         DataMessage::UNSPECIFIED);
     40        virtual bool onLinkRequest(const NodeID& remote);
    4241        virtual void onMessage(const DataMessage& msg, const NodeID& remote,
    4342                const LinkID& lnk = LinkID::UNSPECIFIED);
  • sample/testdht/DHTTest.cpp

    r6796 r7468  
    164164
    165165
    166 bool DHTTest::onLinkRequest(const NodeID& remote, const DataMessage& msg) {
     166bool DHTTest::onLinkRequest(const NodeID& remote) {
    167167        logging_info( "node " << remote.toString() << " wants to build up a link with us ... allowing" );
    168168        return true;
  • sample/testdht/DHTTest.h

    r6760 r7468  
    3434protected:
    3535        // communication listener interface
    36         virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg =
    37                         DataMessage::UNSPECIFIED);
     36        virtual bool onLinkRequest(const NodeID& remote);
    3837        virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
    3938        virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
  • source/ariba/AribaModule.cpp

    r6919 r7468  
    6161AribaModule::AribaModule()
    6262        : started(false), base_comm(NULL), sideport_sniffer(NULL) {
    63 
    6463        endpoints = "tcp{41322};rfcomm{10};";
    65 
    66         //srand( time(NULL) );
    67         //uint16_t tcpport = (rand() + 1024) % 50000;
    68         //uint16_t udpport = (rand() + 1024) % 50000;
    6964}
    7065
     
    203198        if (key == "endpoints") return endpoints; // TODO: return local endpoints
    204199        else if (key == "bootstrap.hints") return getBootstrapHints();
     200        return "";
    205201}
    206202
  • source/ariba/CommunicationListener.cpp

    r6266 r7468  
    6161}
    6262
    63 bool CommunicationListener::onLinkRequest(const NodeID& remote,
    64         const DataMessage& msg) {
     63bool CommunicationListener::onLinkRequest(const NodeID& remote) {
    6564        return true;
    6665}
     
    7069}
    7170
    72 bool CommunicationListener::onEnableSideportListener() {
    73         return true;
     71void CommunicationListener::onKeyValue( const Data& key, const vector<Data>& value ) {
    7472}
    7573
    76 void CommunicationListener::onKeyValue( const Data& key, const vector<Data>& value ) {
    77 
    78 }
    79 
    80 
    81 // --- extended message functionality ---
    82 //void CommunicationListener::onLinkQoSChanged(const LinkID& l, const NodeID& r,
    83 //              const LinkProperties& p) {
    84 //}
    85 
    86 // --- extended message functionality ---
    87 // void CommunicationListener::onMessageSent(seqnum_t seq_num, bool failed,
    88 //              const DataMessage& msg) {
    89 // }
    90 
    9174} // namespace ariba
  • source/ariba/CommunicationListener.h

    r6266 r7468  
    7878        virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
    7979
    80         virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg = DataMessage::UNSPECIFIED);
     80        virtual bool onLinkRequest(const NodeID& remote);
    8181
    8282        // --- general receive method ---
     
    8585                        const LinkID& lnk = LinkID::UNSPECIFIED);
    8686
    87         // --- sniffing related method ---
    88 
    89         virtual bool onEnableSideportListener();
    90 
    9187        // --- dht functionality ---
    9288
    9389        virtual void onKeyValue( const Data& key, const vector<Data>& value );
    9490
    95         // --- extended message functionality ---
    96 
    97         // virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote,
    98         //                      const LinkProperties& prop);
    99 
    100         // --- extended message functionality ---
    101 
    102         //      virtual void onMessageSent(seqnum_t seq_num, bool failed,
    103         //              const DataMessage& msg = DataMessage::UNSPECIFIED);
    10491};
    10592
  • source/ariba/Identifiers.h

    r3055 r7468  
    4646
    4747namespace ariba {
    48 
    49 typedef utility::NodeID NodeID;
    50 typedef utility::LinkID LinkID;
    51 typedef utility::SpoVNetID SpoVNetID;
    52 typedef utility::ServiceID ServiceID;
    53 
     48        typedef utility::NodeID NodeID;
     49        typedef utility::LinkID LinkID;
     50        typedef utility::SpoVNetID SpoVNetID;
     51        typedef utility::ServiceID ServiceID;
    5452} // namespace ariba
    5553
  • source/ariba/LinkProperties.cpp

    r3037 r7468  
    4444
    4545LinkProperties::LinkProperties() {
    46         this->reliable = true;
    47 //      this->confidential = false;
    48 //      this->integrity = false;
    4946}
    5047
     
    5350
    5451string LinkProperties::toString() const {
    55         std::ostringstream buf;
    56         buf << "[reliable=" << (reliable ? "yes" : "no") << "]";
    57         return buf.str();
     52        return "";
    5853}
    5954
  • source/ariba/LinkProperties.h

    r3037 r7468  
    6060        string toString() const;
    6161        static const LinkProperties DEFAULT;
    62 
    63         bool reliable;
    64 
    65         //TODO: to be extended!
    66 //      bool confidential;
    67 //      bool integrity;
    68 
    69         //TODO: implement quality-of-service containers
    70 //      SpoQ qosUpstream;
    71 //      SpoQ qosDownstream;
    7262};
    7363
  • source/ariba/Makefile.am

    r6925 r7468  
    8383  LinkProperties.h \
    8484  Message.h \
     85  Module.h \
    8586  DataMessage.h \
    86   Module.h \
    8787  Name.h \
    8888  Node.h \
  • source/ariba/Message.h

    r2460 r7468  
    4646
    4747namespace ariba {
    48 typedef uint16_t seqnum_t;
    49 typedef utility::Message Message;
     48        typedef uint16_t seqnum_t;
     49        typedef utility::Message Message;
    5050} // namespace ariba
    5151
  • source/ariba/Node.cpp

    r6919 r7468  
    164164        // now that we have a listener, we can ask if sniffing is ok
    165165        if( ariba_mod.sideport_sniffer != NULL ){
    166 //              bool allow = listener->onEnableSideportListener();
    167166                base_overlay->registerSidePort(ariba_mod.sideport_sniffer);
    168167        }
     
    186185
    187186// @see Module.h
    188 void Node::initialize() {
    189 
    190 }
    191 
    192 // @see Module.h
    193 void Node::start() {
    194 
    195 }
    196 
    197 // @see Module.h
    198 void Node::stop() {
    199 
    200 }
    201 
    202 // @see Module.h
    203187string Node::getName() const {
    204188        return name.toString();
    205189}
    206190
    207 // @see Module.h
    208 void Node::setProperty(string key, string value) {
    209 
    210 }
    211 
    212 // @see Module.h
    213 const string Node::getProperty(string key) const {
    214 
    215 }
    216 
    217 // @see Module.h
    218 const vector<string> Node::getProperties() const {
    219 
    220 }
    221 
    222191} // namespace ariba
  • source/ariba/Node.h

    r6836 r7468  
    324324
    325325        /** @see Module.h */
    326         void initialize();
    327 
    328         /** @see Module.h */
    329         void start();
    330 
    331         /** @see Module.h */
    332         void stop();
    333 
    334         /** @see Module.h */
    335326        string getName() const;
    336327
    337         /** @see Module.h */
    338         void setProperty(string key, string value);
    339 
    340         /** @see Module.h */
    341         const string getProperty(string key) const;
    342 
    343         /** @see Module.h */
    344         const vector<string> getProperties() const;
    345328
    346329protected:
  • source/ariba/SideportListener.cpp

    r6944 r7468  
    5757string SideportListener::getEndpointDescription( const LinkID& link ) const {
    5858        if( overlay == NULL ) {
    59                 std::cerr << "Sideport: No overlay found." << std::endl;
    6059                return "";
    6160        }
    62         std::cerr << "WTF!!!" << std::endl;
    6361        return overlay->getEndpointDescriptor(link).toString();
    6462}
     
    6664string SideportListener::getEndpointDescription( const NodeID& node ) const {
    6765        if( overlay == NULL ) {
    68                 std::cerr << "Sideport: No overlay found." << std::endl;
    6966                return "";
    7067        }
     
    146143
    147144        BaseCommunication::LinkDescriptor& bclink =
    148                 overlay->bc->queryLocalLink(link->communicationId);
     145                        overlay->bc->queryLocalLink(link->communicationId);
    149146
    150147        if(bclink.isUnspecified() || bclink.remoteLocator == NULL) return (Protocol)ret;
  • source/ariba/SideportListener.h

    r5920 r7468  
    5353namespace ariba {
    5454
    55 // forward declerations
     55// forward declarations
    5656class Node;
    5757class AribaModule;
     
    164164        bool isRelayedNode(const NodeID& node);
    165165
    166 
    167166        /**
    168167         * Protocols for some layer, can be combined
  • source/ariba/SpoVNetProperties.cpp

    r3690 r7468  
    4444
    4545SpoVNetProperties::SpoVNetProperties() :
    46                 name( Name::random() ), type( CHORD_OVERLAY ), idLength( 192 ),
    47                 initiator( NodeID::UNSPECIFIED ), hidden( false ) {
    48 
    49         id = name.toSpoVNetId();
     46                type( CHORD_OVERLAY ){
    5047}
    5148
    5249SpoVNetProperties::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 ) {
     50                type( copy.type ){
    5651}
    5752
    5853SpoVNetProperties::~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;
    7554}
    7655
     
    7958}
    8059
    81 bool SpoVNetProperties::isHidden() const {
    82         return hidden;
    83 }
    84 
    8560std::string SpoVNetProperties::toString() const {
    8661        std::ostringstream buf;
    8762        buf << "spovnet"
    88                 << " name=" << name.toString()
    89                 << " id=" << id.toString()
    90                 << " overlay_type=" << type
    91                 << " id_length=" << idLength
    92                 << " initiator=" << initiator
    93                 << " hidden=" << hidden;
     63                << " overlay_type=" << type;
    9464        return buf.str();
    9565}
  • source/ariba/SpoVNetProperties.h

    r5316 r7468  
    8383
    8484        /**
    85          * Constructs a new SpoVnet property object.
    86          *
    87          * TODO: replace with setters! for downwards compatibility
    88          */
    89         /*
    90         SpoVNetProperties(const Name& name, SpoVNetID id, OverlayType type,
    91                         uint16_t idLength, const NodeID& initiator, bool hidden = false) :
    92                 name(name), id(id), type(type), idLength(idLength),
    93                                 initiator(initiator), hidden(hidden) {
    94         }*/
    95 
    96         /**
    9785         * Copy constructor.
    9886         */
     
    10391         */
    10492        virtual ~SpoVNetProperties();
    105 
    106         /**
    107          * Returns the canonical SpoVNet name
    108          */
    109         const Name& getName() const;
    110 
    111         /**
    112          * Returns the SpoVNet id
    113          */
    114         const SpoVNetID& getId() const;
    115 
    116         /**
    117          * Returns the node id of the initiator of the spovnet.
    118          * If the node id is unspecified, the initiator wanted to be anonymous.
    119          */
    120         const NodeID& getInitiator() const;
    121 
    122         /**
    123          * Returns the node identifier length in bites
    124          */
    125         uint16_t getIdentifierLength() const;
    126 
    127         void setIdentifierLength( uint16_t length ) {
    128                 this->idLength = length;
    129         }
    13093
    13194        /**
     
    139102
    140103        /**
    141          * Returns true, if the spovnet is hidden
    142          */
    143         bool isHidden() const;
    144 
    145         void setHidden( bool is_hidden ) {
    146                 this->hidden = is_hidden;
    147         }
    148 
    149         /**
    150104         * Returns a human readable string representation of the SpoVNet properties
    151105         *
     
    155109
    156110private:
    157         Name name;
    158         SpoVNetID id;
    159         uint8_t  type;
    160         uint16_t idLength;
    161         NodeID initiator;
    162         bool hidden;
     111        uint8_t type;
    163112};
    164113
  • source/ariba/utility/system/SystemQueue.cpp

    r6919 r7468  
    9595}
    9696
     97void SystemQueue::dropAll( const SystemEventListener* mlistener){
     98#ifndef UNDERLAY_OMNET
     99        directScheduler.dropAll(mlistener);
     100        delayScheduler.dropAll(mlistener);
     101#endif
     102}
     103
    97104bool SystemQueue::isEmpty() {
    98105#ifndef UNDERLAY_OMNET
     
    192199}
    193200
     201void SystemQueue::QueueThread::dropAll( const SystemEventListener* mlistener) {
     202        boost::mutex::scoped_lock lock( queueMutex );
     203
     204        bool deleted = false;
     205        do{
     206                EventQueue::iterator i = eventsQueue.begin();
     207                EventQueue::iterator iend = eventsQueue.end();
     208
     209                for( ; i != iend; i++){
     210                        if((*i).getListener() == mlistener){
     211                                eventsQueue.erase(i);
     212                                deleted = true;
     213                                break;
     214                        }
     215                }
     216        }while(deleted);
     217}
     218
    194219void SystemQueue::QueueThread::threadFunc( QueueThread* obj ) {
    195220
  • source/ariba/utility/system/SystemQueue.h

    r6919 r7468  
    125125
    126126        /**
     127         * Drop all queued events for that listener
     128         */
     129        void dropAll( const SystemEventListener* mlistener);
     130
     131        /**
    127132         * Check wheter this queue has items or not.
    128133         *
     
    182187                void enter();
    183188                void leave();
     189                void dropAll( const SystemEventListener* mlistener);
    184190
    185191        protected:
  • source/ariba/utility/system/Timer.cpp

    r4987 r7468  
    100100        running = false;
    101101        reset(); // cause the sleep to abort
     102        //SystemQueue::instance().dropAll(this);
    102103}
    103104
  • source/ariba/utility/system/Timer.h

    r4987 r7468  
    4040#define __TIMER_H
    4141
     42#include <stdint.h>
    4243#include "ariba/utility/system/SystemEventListener.h"
    4344#include "ariba/utility/system/SystemQueue.h"
Note: See TracChangeset for help on using the changeset viewer.