summaryrefslogtreecommitdiff
path: root/node/Switch.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-07 19:31:11 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-07 19:31:11 -0700
commit49f031ccb4d518e8a715777f5d848759bae0def8 (patch)
tree6f5d2fe9a753d36ac1da657142fc50645804466d /node/Switch.hpp
parent9e55f882d3ca5a5615c21ebaec0702aaaf436e2b (diff)
downloadinfinitytier-49f031ccb4d518e8a715777f5d848759bae0def8.tar.gz
infinitytier-49f031ccb4d518e8a715777f5d848759bae0def8.zip
Tons of refactoring, change to desperation algorithm to use max of core or link, porting over core loop code from old Node.cpp to new CAPI version, etc.
Diffstat (limited to 'node/Switch.hpp')
-rw-r--r--node/Switch.hpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/node/Switch.hpp b/node/Switch.hpp
index 965636a7..7cc0bbb6 100644
--- a/node/Switch.hpp
+++ b/node/Switch.hpp
@@ -82,8 +82,9 @@ public:
* @param fromAddr Internet IP address of origin
* @param linkDesperation Link desperation of path over which packet was received
* @param data Packet data
+ * @param len Packet length
*/
- void onRemotePacket(const InetAddress &fromAddr,int linkDesperation,const Buffer<4096> &data);
+ void onRemotePacket(const InetAddress &fromAddr,int linkDesperation,const void *data,unsigned int len);
/**
* Called when a packet comes from a local Ethernet tap
@@ -92,9 +93,11 @@ public:
* @param from Originating MAC address
* @param to Destination MAC address
* @param etherType Ethernet packet type
+ * @param vlanId VLAN ID or 0 if none
* @param data Ethernet payload
+ * @param len Frame length
*/
- void onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,const MAC &to,unsigned int etherType,const Buffer<4096> &data);
+ void onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,const MAC &to,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len);
/**
* Send a packet to a ZeroTier address (destination in packet)
@@ -164,9 +167,13 @@ public:
/**
* Perform retries and other periodic timer tasks
*
+ * This can return a very long delay if there are no pending timer
+ * tasks. The caller should cap this comparatively vs. other values.
+ *
+ * @param now Current time
* @return Number of milliseconds until doTimerTasks() should be run again
*/
- unsigned long doTimerTasks();
+ unsigned long doTimerTasks(uint64_t now);
/**
* @param etherType Ethernet type ID
@@ -176,9 +183,9 @@ public:
throw();
private:
- void _handleRemotePacketFragment(const InetAddress &fromAddr,int linkDesperation,const Buffer<4096> &data);
- void _handleRemotePacketHead(const InetAddress &fromAddr,int linkDesperation,const Buffer<4096> &data);
- void _handleBeacon(const InetAddress &fromAddr,int linkDesperation,const Buffer<4096> &data);
+ void _handleRemotePacketFragment(const InetAddress &fromAddr,int linkDesperation,const void *data,unsigned int len);
+ void _handleRemotePacketHead(const InetAddress &fromAddr,int linkDesperation,const void *data,unsigned int len);
+ void _handleBeacon(const InetAddress &fromAddr,int linkDesperation,const Buffer<ZT_PROTO_BEACON_LENGTH> &data);
Address _sendWhoisRequest(
const Address &addr,