Ignore:
Timestamp:
Jul 6, 2009, 8:14:42 AM (15 years ago)
Author:
Christoph Mayer
Message:

sideport protocol information

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/SideportListener.cpp

    r4738 r4751  
    8080// 2 = relayed node   --> node that we cannot access directly
    8181static map<NodeID,short> relayingnodes;
     82static map<NodeID,SideportListener::Protocol> protocolnodes;
    8283
    8384bool SideportListener::isRelayingNode(const NodeID& node){
     
    9596
    9697        relayingnodes.insert( std::make_pair( node, rand()%3 ) );
     98}
     99
     100SideportListener::Protocol generateRandomProtocol(){
     101
     102        if( (rand() % 3) == 0 ){
     103                return SideportListener::rfcomm;
     104        }
     105
     106        int ret = SideportListener::undefined;
     107
     108        if( (rand() % 2) == 0 ) ret |= SideportListener::ipv4;
     109        else                                    ret |= SideportListener::ipv6;
     110
     111        if( (rand() % 2) == 0 ) ret |= SideportListener::udp;
     112        else                                    ret |= SideportListener::tcp;
     113
     114        return (SideportListener::Protocol)ret;
     115}
     116
     117SideportListener::Protocol SideportListener::getReachabilityProtocol(const NodeID& node){
     118
     119        map<NodeID,Protocol>::iterator i = protocolnodes.find(node);
     120        if(i != protocolnodes.end()) return i->second;
     121
     122        protocolnodes.insert( std::make_pair(node, generateRandomProtocol()) );
    97123}
    98124
Note: See TracChangeset for help on using the changeset viewer.