Changeset 4751
- Timestamp:
- Jul 6, 2009, 8:14:42 AM (15 years ago)
- Location:
- source/ariba
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/SideportListener.cpp
r4738 r4751 80 80 // 2 = relayed node --> node that we cannot access directly 81 81 static map<NodeID,short> relayingnodes; 82 static map<NodeID,SideportListener::Protocol> protocolnodes; 82 83 83 84 bool SideportListener::isRelayingNode(const NodeID& node){ … … 95 96 96 97 relayingnodes.insert( std::make_pair( node, rand()%3 ) ); 98 } 99 100 SideportListener::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 117 SideportListener::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()) ); 97 123 } 98 124 -
source/ariba/SideportListener.h
r4738 r4751 125 125 * is set to unspecified. 126 126 * 127 * @param The remote node to query all links or unspecified127 * @param node The remote node to query all links or unspecified 128 128 * for all local starting links 129 129 * @return A vector of link ids. … … 136 136 * Is this node acting as a relay for us 137 137 * 138 * @param The node in question138 * @param node The node in question 139 139 * @return true, if this node is relaying for us 140 140 */ … … 144 144 * Is this node only reachable for us through a relay? 145 145 * 146 * @param The node in question146 * @param node The node in question 147 147 * @return true, if we reach this node only over a relay 148 148 */ 149 149 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); 150 171 151 172 protected:
Note:
See TracChangeset
for help on using the changeset viewer.