Ignore:
Timestamp:
Mar 11, 2010, 9:28:24 AM (14 years ago)
Author:
Christoph Mayer
Message:

-branch merge back

Location:
source/ariba/communication
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/communication/BaseCommunication.cpp

    r7496 r7744  
    3838
    3939#include "BaseCommunication.h"
     40
    4041#include "networkinfo/AddressDiscovery.h"
     42#include "ariba/utility/types/PeerID.h"
    4143
    4244#ifdef UNDERLAY_OMNET
     
    5254namespace ariba {
    5355namespace communication {
     56
     57using ariba::utility::PeerID;
    5458
    5559use_logging_cpp(BaseCommunication);
     
    100104        currentSeqnum = 0;
    101105
     106        // set local peer id
     107        localDescriptor.getPeerId() = PeerID::random();
     108        logging_info( "Using PeerID: " << localDescriptor.getPeerId() );
     109
    102110        // creating transports
    103111        logging_info( "Creating transports ..." );
     
    114122
    115123        logging_info( "Searching for local locators ..." );
    116         if(localDescriptor.getEndpoints().to_string().length() == 0)
    117                 AddressDiscovery::discover_endpoints( localDescriptor.getEndpoints() );
     124        /**
     125         * DONT DO THAT: if(localDescriptor.getEndpoints().to_string().length() == 0)
     126         * since addresses are used to initialize transport addresses
     127         */
     128        AddressDiscovery::discover_endpoints( localDescriptor.getEndpoints() );
    118129        logging_info( "Done. Local endpoints = " << localDescriptor.toString() );
    119130
     
    177188        AribaBaseMsg baseMsg( AribaBaseMsg::typeLinkRequest, linkid );
    178189        baseMsg.getLocalDescriptor() = localDescriptor;
     190        baseMsg.getRemoteDescriptor().getPeerId() = descriptor.getPeerId();
    179191
    180192        // serialize and send message
     
    338350                        logging_debug( "Received link open request" );
    339351
     352                        /// not the correct peer id-> skip request
     353                        if (!msg->getRemoteDescriptor().getPeerId().isUnspecified()
     354                                && msg->getRemoteDescriptor().getPeerId() != localDescriptor.getPeerId()) {
     355                                logging_info("Received link request for "
     356                                        << msg->getRemoteDescriptor().getPeerId().toString()
     357                                        << "but i'm "
     358                                        << localDescriptor.getPeerId()
     359                                        << ": Ignoring!");
     360                                break;
     361                        }
     362
    340363                        /// only answer the first request
    341364                        if (!queryRemoteLink(msg->getLocalLink()).isUnspecified()) {
  • source/ariba/communication/EndpointDescriptor.h

    r6919 r7744  
    4343#include <set>
    4444#include "ariba/utility/serialization.h"
     45#include "ariba/utility/types/PeerID.h"
    4546#include "ariba/utility/addressing/endpoint_set.hpp"
    4647
     
    5152using namespace std;
    5253using namespace ariba::addressing;
     54using ariba::utility::PeerID;
    5355
    5456class EndpointDescriptor: public VSerializeable { VSERIALIZEABLE
     
    120122        }
    121123
     124        /// returns a reference to the peer id
     125        PeerID& getPeerId() {
     126                return peerId;
     127        }
     128
     129
     130        /// returns a reference to the constant peer id
     131        const PeerID& getPeerId() const {
     132                return peerId;
     133        }
    122134private:
    123135        endpoint_set endpoints;
     136        PeerID peerId;
    124137};
    125138
     
    127140
    128141sznBeginDefault( ariba::communication::EndpointDescriptor, X ){
    129         // serialize endpoints
     142
     143        // serialize peer id
     144        X && &peerId;
     145
     146        // serialize end-points
    130147        uint16_t len = endpoints.to_bytes_size();
    131148        X && len;
  • source/ariba/communication/networkinfo/AddressDiscovery.cpp

    r6919 r7744  
    107107                if (addr==NULL) continue;
    108108
     109                // ignore tun devices
     110                string device = string(i->ifa_name);
     111                if(device.find_first_of("tun") == 0) continue;
     112
    109113                if (addr->sa_family == AF_INET) {
    110114                        // look for ipv4
Note: See TracChangeset for help on using the changeset viewer.