/* * Copyright (c)2013-2020 ZeroTier, Inc. * * Use of this software is governed by the Business Source License included * in the LICENSE.TXT file in the project's root directory. * * Change Date: 2024-01-01 * * On the date above, in accordance with the Business Source License, use * of this software will be governed by version 2.0 of the Apache License. */ /****/ #ifndef ZT_VL2_HPP #define ZT_VL2_HPP #include "Constants.hpp" #include "Buf.hpp" #include "Address.hpp" #include "Protocol.hpp" #include "Hashtable.hpp" #include "Mutex.hpp" #include "FCV.hpp" namespace ZeroTier { class Path; class Peer; class RuntimeEnvironment; class VL1; class Network; class MAC; class VL2 { friend class VL1; public: VL2(const RuntimeEnvironment *renv); ~VL2(); /** * Called when a packet comes from a local Ethernet tap * * @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call * @param network Which network's TAP did this packet come from? * @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(void *tPtr,const SharedPtr &network,const MAC &from,const MAC &to,unsigned int etherType,unsigned int vlanId,SharedPtr &data,unsigned int len); protected: bool _FRAME(void *tPtr,const SharedPtr &path,SharedPtr &peer,Buf &pkt,int packetSize); bool _EXT_FRAME(void *tPtr,const SharedPtr &path,SharedPtr &peer,Buf &pkt,int packetSize); bool _MULTICAST_LIKE(void *tPtr,const SharedPtr &path,SharedPtr &peer,Buf &pkt,int packetSize); bool _NETWORK_CREDENTIALS(void *tPtr,const SharedPtr &path,SharedPtr &peer,Buf &pkt,int packetSize); bool _NETWORK_CONFIG_REQUEST(void *tPtr,const SharedPtr &path,SharedPtr &peer,Buf &pkt,int packetSize); bool _NETWORK_CONFIG(void *tPtr,const SharedPtr &path,SharedPtr &peer,Buf &pkt,int packetSize); bool _MULTICAST_GATHER(void *tPtr,const SharedPtr &path,SharedPtr &peer,Buf &pkt,int packetSize); bool _MULTICAST_FRAME_deprecated(void *tPtr,const SharedPtr &path,SharedPtr &peer,Buf &pkt,int packetSize); bool _MULTICAST(void *tPtr,const SharedPtr &path,SharedPtr &peer,Buf &pkt,int packetSize); private: }; } // namespace ZeroTier #endif