Packet decoder work for EXT_FRAME for bridging - GitHub issue #68

This commit is contained in:
Adam Ierymenko 2014-06-10 21:41:34 -07:00
parent d44e1349d8
commit c30f9832b0
5 changed files with 100 additions and 50 deletions

View file

@ -371,21 +371,6 @@ public:
t->put(from,to,etherType,data,len);
}
/**
* Inject a frame into tap with local MAC as destination MAC (if it's created)
*
* @param from Origin MAC
* @param etherType Ethernet frame type
* @param data Frame data
* @param len Frame length
*/
inline void tapPut(const MAC &from,unsigned int etherType,const void *data,unsigned int len)
{
EthernetTap *t = _tap;
if (t)
t->put(from,t->mac(),etherType,data,len);
}
/**
* @return Tap device name or empty string if still initializing
*/
@ -401,6 +386,7 @@ public:
* @return Ethernet MAC address for this network's local interface
*/
inline const MAC &mac() const
throw()
{
return _mac;
}
@ -416,6 +402,20 @@ public:
return std::set<InetAddress>();
}
/**
* Shortcut for config()->permitsBridging(), returns false if no config
*
* @param peer Peer address to check
* @return True if peer can bridge other Ethernet nodes into this network or network is in permissive bridging mode
*/
inline bool permitsBridging(const Address &peer) const
{
Mutex::Lock _l(_lock);
if (_config)
return _config->permitsBridging(peer);
return false;
}
/**
* @param mac MAC address
* @return ZeroTier address of bridge to this MAC or null address if not found