diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-09 12:42:25 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-09 12:42:25 -0700 |
| commit | d5e0f7e3e453482bf6e7d6d8cb76a68ecc26b287 (patch) | |
| tree | e0274527ce9afeb54917767e377d800cf943e27c /node/OutboundMulticast.hpp | |
| parent | 620e64c58f1332d6b9948108dcd1ebf99223074d (diff) | |
| download | infinitytier-d5e0f7e3e453482bf6e7d6d8cb76a68ecc26b287.tar.gz infinitytier-d5e0f7e3e453482bf6e7d6d8cb76a68ecc26b287.zip | |
Reorg multicast packet, and a whole bunch of refactoring around the pushing of certificates of membership.
Diffstat (limited to 'node/OutboundMulticast.hpp')
| -rw-r--r-- | node/OutboundMulticast.hpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/node/OutboundMulticast.hpp b/node/OutboundMulticast.hpp index 548171ab..14d5a5bc 100644 --- a/node/OutboundMulticast.hpp +++ b/node/OutboundMulticast.hpp @@ -41,8 +41,8 @@ namespace ZeroTier { -class Switch; class CertificateOfMembership; +class RuntimeEnvironment; /** * An outbound multicast packet @@ -65,10 +65,10 @@ public: * @param timestamp Creation time * @param self My ZeroTier address * @param nwid Network ID - * @param com Certificate of membership to attach or NULL to omit + * @param com Certificate of membership or NULL if none available * @param limit Multicast limit for desired number of packets to send * @param gatherLimit Number to lazily/implicitly gather with this frame or 0 for none - * @param src Source MAC address of frame + * @param src Source MAC address of frame or NULL to imply compute from sender ZT address * @param dest Destination multicast group (MAC + ADI) * @param etherType 16-bit Ethernet type ID * @param payload Data @@ -107,49 +107,48 @@ public: /** * Just send without checking log * - * @param sw Switch instance to send packets + * @param RR Runtime environment * @param toAddr Destination address */ - void sendOnly(Switch &sw,const Address &toAddr); + void sendOnly(const RuntimeEnvironment *RR,const Address &toAddr); /** * Just send and log but do not check sent log * - * @param sw Switch instance to send packets + * @param RR Runtime environment * @param toAddr Destination address */ - inline void sendAndLog(Switch &sw,const Address &toAddr) + inline void sendAndLog(const RuntimeEnvironment *RR,const Address &toAddr) { _alreadySentTo.push_back(toAddr); - sendOnly(sw,toAddr); + sendOnly(RR,toAddr); } /** * Try to send this to a given peer if it hasn't been sent to them already * - * @param sw Switch instance to send packets + * @param RR Runtime environment * @param toAddr Destination address * @return True if address is new and packet was sent to switch, false if duplicate */ - inline bool sendIfNew(Switch &sw,const Address &toAddr) + inline bool sendIfNew(const RuntimeEnvironment *RR,const Address &toAddr) { for(std::vector<Address>::iterator a(_alreadySentTo.begin());a!=_alreadySentTo.end();++a) { if (*a == toAddr) return false; } - sendAndLog(sw,toAddr); + sendAndLog(RR,toAddr); return true; } private: uint64_t _timestamp; uint64_t _nwid; - MAC _source; - MulticastGroup _destination; unsigned int _limit; - unsigned int _etherType; - Packet _packet; // packet contains basic structure of MULTICAST_FRAME and payload, is re-used with new IV and addressing each time + Packet _packetNoCom; + Packet _packetWithCom; std::vector<Address> _alreadySentTo; + bool _haveCom; }; } // namespace ZeroTier |
