Changeset 4751 for source


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

sideport protocol information

Location:
source/ariba
Files:
2 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
  • source/ariba/SideportListener.h

    r4738 r4751  
    125125         * is set to unspecified.
    126126         *
    127          * @param The remote node to query all links or unspecified
     127         * @param node The remote node to query all links or unspecified
    128128         *                      for all local starting links
    129129         * @return A vector of link ids.
     
    136136         * Is this node acting as a relay for us
    137137         *
    138          * @param The node in question
     138         * @param node The node in question
    139139         * @return true, if this node is relaying for us
    140140         */
     
    144144         * Is this node only reachable for us through a relay?
    145145         *
    146          * @param The node in question
     146         * @param node The node in question
    147147         * @return true, if we reach this node only over a relay
    148148         */
    149149        bool isRelayedNode(const NodeID& node);
     150
     151
     152        /**
     153         * Protocols for some layer, can be combined
     154         */
     155        enum Protocol {
     156                undefined = 0x0,
     157                rfcomm = 0x1,
     158                ipv4 = 0x2,
     159                ipv6 = 0x4,
     160                udp = 0x8,
     161                tcp = 0x16,
     162        };
     163
     164        /**
     165         * Through which protocol is a node reachable.
     166         *
     167         * @param node The node for which to return protocol reachability
     168         * @return Combination of protocols
     169         */
     170        Protocol getReachabilityProtocol(const NodeID& node);
    150171
    151172protected:
Note: See TracChangeset for help on using the changeset viewer.