VL2.hpp 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c)2013-2020 ZeroTier, Inc.
  3. *
  4. * Use of this software is governed by the Business Source License included
  5. * in the LICENSE.TXT file in the project's root directory.
  6. *
  7. * Change Date: 2024-01-01
  8. *
  9. * On the date above, in accordance with the Business Source License, use
  10. * of this software will be governed by version 2.0 of the Apache License.
  11. */
  12. /****/
  13. #ifndef ZT_VL2_HPP
  14. #define ZT_VL2_HPP
  15. #include "Constants.hpp"
  16. #include "Buf.hpp"
  17. #include "Address.hpp"
  18. #include "Protocol.hpp"
  19. #include "Mutex.hpp"
  20. #include "FCV.hpp"
  21. #include "Containers.hpp"
  22. namespace ZeroTier {
  23. class Path;
  24. class Peer;
  25. class RuntimeEnvironment;
  26. class VL1;
  27. class Network;
  28. class MAC;
  29. class VL2
  30. {
  31. friend class VL1;
  32. public:
  33. explicit VL2(const RuntimeEnvironment *renv);
  34. /**
  35. * Called when a packet comes from a local Ethernet tap
  36. *
  37. * @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call
  38. * @param network Which network's TAP did this packet come from?
  39. * @param from Originating MAC address
  40. * @param to Destination MAC address
  41. * @param etherType Ethernet packet type
  42. * @param vlanId VLAN ID or 0 if none
  43. * @param data Ethernet payload
  44. * @param len Frame length
  45. */
  46. void onLocalEthernet(void *tPtr,const SharedPtr<Network> &network,const MAC &from,const MAC &to,unsigned int etherType,unsigned int vlanId,SharedPtr<Buf> &data,unsigned int len);
  47. protected:
  48. bool m_FRAME(void *tPtr, uint64_t packetId, unsigned int auth, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  49. bool m_EXT_FRAME(void *tPtr, uint64_t packetId, unsigned int auth, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  50. bool m_MULTICAST_LIKE(void *tPtr, uint64_t packetId, unsigned int auth, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  51. bool m_NETWORK_CREDENTIALS(void *tPtr, uint64_t packetId, unsigned int auth, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  52. bool m_NETWORK_CONFIG_REQUEST(void *tPtr, uint64_t packetId, unsigned int auth, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  53. bool m_NETWORK_CONFIG(void *tPtr, uint64_t packetId, unsigned int auth, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  54. bool m_MULTICAST_GATHER(void *tPtr, uint64_t packetId, unsigned int auth, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  55. bool m_MULTICAST_FRAME_deprecated(void *tPtr, uint64_t packetId, unsigned int auth, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  56. bool m_MULTICAST(void *tPtr, uint64_t packetId, unsigned int auth, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  57. private:
  58. };
  59. } // namespace ZeroTier
  60. #endif