Changeset 2095
- Timestamp:
- 03/29/12 13:29:03 (11 years ago)
- Files:
-
- trunk/libffado/src/dice/dice_eap.cpp (modified) (5 diffs)
- trunk/libffado/src/dice/dice_eap.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/dice/dice_eap.cpp
r2094 r2095 785 785 for (unsigned int i=0; i<m_router_nb_entries; ++i) { 786 786 printMessage(" %d: 0x%02x: %d;\n", i, tmp_entries[i]&0xff, (tmp_entries[i]&0xfff0000)>>16); 787 unsigned char dest = tmp_entries[i]&0xff;788 787 } 789 788 return; … … 1665 1664 // decode into the routing map 1666 1665 for(unsigned int i=0; i < nb_routes; i++) { 1667 m_routes2 [tmp_entries[i]&0xff] = (tmp_entries[i]>>8)&0xff;1666 m_routes2.push_back(std::make_pair(tmp_entries[i]&0xff, (tmp_entries[i]>>8)&0xff)); 1668 1667 } 1669 1668 return true; … … 1714 1713 EAP::RouterConfig::setupRoute(unsigned char src, unsigned char dest) { 1715 1714 debugOutput(DEBUG_LEVEL_VERBOSE,"RouterConfig::setupRoute( 0x%02x, 0x%02x )\n", src, dest); 1716 m_routes2[dest] = src; 1717 return true; 1715 for (RouteVectorV2::iterator it=m_routes2.begin(); it!=m_routes2.end(); ++it) { 1716 if (it->first == dest) { 1717 it->second = src; 1718 return true; 1719 } 1720 } 1721 m_routes2.push_back(std::make_pair(dest, src)); 1722 return false; 1718 1723 } 1719 1724 … … 1721 1726 EAP::RouterConfig::removeRoute(unsigned char src, unsigned char dest) { 1722 1727 debugOutput(DEBUG_LEVEL_VERBOSE,"RouterConfig::removeRoute( 0x%02x, 0x%02x )\n", src, dest); 1723 if (m_routes2.count(dest) > 0) { 1724 if (src != m_routes2[dest]) { 1728 for (RouteVectorV2::iterator it=m_routes2.begin(); it!=m_routes2.end(); ++it) { 1729 if (it->first == dest) { 1730 if (it->second != src) { 1725 1731 return false; 1726 } 1727 return removeRoute(dest); 1732 } 1733 return removeRoute(dest); 1734 } 1728 1735 } 1729 1736 return true; … … 1733 1740 EAP::RouterConfig::removeRoute(unsigned char dest) { 1734 1741 debugOutput(DEBUG_LEVEL_VERBOSE,"RouterConfig::removeRoute( 0x%02x )\n", dest); 1735 m_routes2.erase(dest); 1736 if (m_routes2.count(dest) < 1) { 1737 return false; 1738 } 1739 return true; 1742 for (RouteVectorV2::iterator it=m_routes2.begin(); it!=m_routes2.end(); ++it) { 1743 if (it->first == dest) { 1744 m_routes2.erase(it); 1745 return true; 1746 } 1747 } 1748 return false; 1740 1749 } 1741 1750 1742 1751 unsigned char 1743 1752 EAP::RouterConfig::getSourceForDestination(unsigned char dest) { 1744 if (m_routes2.count(dest) > 0) { 1745 return m_routes2[dest]; 1753 for (RouteVectorV2::iterator it=m_routes2.begin(); it!=m_routes2.end(); ++it) { 1754 if (it->first == dest) { 1755 return it->second; 1756 } 1746 1757 } 1747 1758 return -1; trunk/libffado/src/dice/dice_eap.h
r2094 r2095 257 257 Sources can be routed to several destinations though. 258 258 */ 259 typedef std::map<unsigned char,unsigned char> RouteVectorV2; 259 // typedef std::map<unsigned char,unsigned char> RouteVectorV2; 260 typedef std::vector< std::pair<unsigned char,unsigned char> > RouteVectorV2; 260 261 RouteVectorV2 m_routes2; 261 262 private: