Ignore:
Timestamp:
Jul 26, 2009, 5:17:30 PM (15 years ago)
Author:
Christoph Mayer
Message:

sideport und sdp bootstrap

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/SideportListener.cpp

    r5316 r5358  
    4141#include "ariba/overlay/BaseOverlay.h"
    4242#include "ariba/overlay/LinkDescriptor.h"
     43#include "ariba/utility/addressing/endpoint_set.hpp"
    4344
    4445using ariba::overlay::LinkDescriptor;
     
    8283
    8384bool SideportListener::isRelayedNode(const NodeID& node){
     85        if( overlay == NULL ) return false;
    8486
    8587        BOOST_FOREACH( LinkDescriptor* link, overlay->links ){
    86 
    87                 if( (!link->localRelay.isUnspecified()) && link->remoteRelay == node && link->up) {
     88                if( (!link->localRelay.isUnspecified()) && link->remoteRelay == node && link->up)
    8889                        return true;
    89                 }
    90 
    9190        }
    9291
     
    9594
    9695bool SideportListener::isRelayingNode(const NodeID& node){
     96        if( overlay == NULL ) return false;
    9797
    9898        BOOST_FOREACH( LinkDescriptor* link, overlay->links ){
    99 
    100                 if( (!link->localRelay.isUnspecified()) && link->localRelay == node && link->up) {
     99                if( (!link->localRelay.isUnspecified()) && link->localRelay == node && link->up)
    101100                        return true;
    102                 }
    103 
    104101        }
    105102
     
    108105
    109106SideportListener::Protocol SideportListener::getReachabilityProtocol(const NodeID& node){
    110         return (SideportListener::Protocol)(ipv4 | tcp);
     107        int ret = SideportListener::undefined;
     108        if( overlay == NULL ) return (Protocol)ret;
     109
     110        using namespace ariba::addressing;
     111
     112        BOOST_FOREACH( LinkDescriptor* link, overlay->links ){
     113                if(link->remoteNode == node){
     114                        if(overlay->bc == NULL) continue;
     115
     116                        BaseCommunication::LinkDescriptor& bclink =
     117                                overlay->bc->queryLocalLink(link->communicationId);
     118
     119                        if(bclink.isUnspecified()) continue;
     120                        if(bclink.localLocator == NULL) continue;
     121
     122                        const address_v* locator = bclink.remoteLocator;
     123
     124                        if( locator->instanceof<tcpip_endpoint>() ){
     125
     126                                tcpip_endpoint tcpip = *locator;
     127
     128                                ret |= SideportListener::tcp;
     129
     130                                if( tcpip.address().is_v4() )
     131                                        ret |= SideportListener::ipv4;
     132
     133                                if( tcpip.address().is_v6() )
     134                                        ret |= SideportListener::ipv6;
     135
     136                        }else if( locator->instanceof<rfcomm_endpoint>() ){
     137                                ret |= SideportListener::rfcomm;
     138                        }
     139                }
     140        }
     141
     142        return (Protocol)ret;
     143        //return (SideportListener::Protocol)(ipv4 | tcp);
    111144}
    112145
Note: See TracChangeset for help on using the changeset viewer.