diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-09-23 13:49:56 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-09-23 13:49:56 -0700 |
| commit | 367ffde00cf6eecbca0f9fff391dcaf7faf72c6e (patch) | |
| tree | a3e345de1a0a5998ca7eec6fe9e2ff2283da6c80 /node/Switch.hpp | |
| parent | 4464fa5d392dd930bf847c2dc1c5886398e5d8dd (diff) | |
| download | infinitytier-367ffde00cf6eecbca0f9fff391dcaf7faf72c6e.tar.gz infinitytier-367ffde00cf6eecbca0f9fff391dcaf7faf72c6e.zip | |
Plumb through localInterfaceId to track local interfaces corresponding with remote addresses.
Diffstat (limited to 'node/Switch.hpp')
| -rw-r--r-- | node/Switch.hpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/node/Switch.hpp b/node/Switch.hpp index 55e2c362..a8d89f41 100644 --- a/node/Switch.hpp +++ b/node/Switch.hpp @@ -79,11 +79,12 @@ public: /** * Called when a packet is received from the real network * + * @param localInterfaceId Local interface ID or -1 for unspecified * @param fromAddr Internet IP address of origin * @param data Packet data * @param len Packet length */ - void onRemotePacket(const InetAddress &fromAddr,const void *data,unsigned int len); + void onRemotePacket(int localInterfaceId,const InetAddress &fromAddr,const void *data,unsigned int len); /** * Called when a packet comes from a local Ethernet tap @@ -140,9 +141,10 @@ public: * Attempt NAT traversal to peer at a given physical address * * @param peer Peer to contact + * @param localInterfaceId Local interface ID or -1 if unspecified * @param atAddr Address of peer */ - void rendezvous(const SharedPtr<Peer> &peer,const InetAddress &atAddr); + void rendezvous(const SharedPtr<Peer> &peer,int localInterfaceId,const InetAddress &atAddr); /** * Request WHOIS on a given address @@ -179,8 +181,8 @@ public: unsigned long doTimerTasks(uint64_t now); private: - void _handleRemotePacketFragment(const InetAddress &fromAddr,const void *data,unsigned int len); - void _handleRemotePacketHead(const InetAddress &fromAddr,const void *data,unsigned int len); + void _handleRemotePacketFragment(int localInterfaceId,const InetAddress &fromAddr,const void *data,unsigned int len); + void _handleRemotePacketHead(int localInterfaceId,const InetAddress &fromAddr,const void *data,unsigned int len); Address _sendWhoisRequest(const Address &addr,const Address *peersAlreadyConsulted,unsigned int numPeersAlreadyConsulted); bool _trySend(const Packet &packet,bool encrypt,uint64_t nwid); @@ -260,15 +262,17 @@ private: struct ContactQueueEntry { ContactQueueEntry() {} - ContactQueueEntry(const SharedPtr<Peer> &p,uint64_t ft,const InetAddress &a) : + ContactQueueEntry(const SharedPtr<Peer> &p,uint64_t ft,int liid,const InetAddress &a) : peer(p), fireAtTime(ft), inaddr(a), + localInterfaceId(liid), strategyIteration(0) {} SharedPtr<Peer> peer; uint64_t fireAtTime; InetAddress inaddr; + int localInterfaceId; unsigned int strategyIteration; }; std::list<ContactQueueEntry> _contactQueue; |
