VL2.hpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. namespace ZeroTier {
  22. class Path;
  23. class Peer;
  24. class RuntimeEnvironment;
  25. class VL1;
  26. class Network;
  27. class MAC;
  28. class VL2
  29. {
  30. friend class VL1;
  31. public:
  32. explicit VL2(const RuntimeEnvironment *renv);
  33. /**
  34. * Called when a packet comes from a local Ethernet tap
  35. *
  36. * @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call
  37. * @param network Which network's TAP did this packet come from?
  38. * @param from Originating MAC address
  39. * @param to Destination MAC address
  40. * @param etherType Ethernet packet type
  41. * @param vlanId VLAN ID or 0 if none
  42. * @param data Ethernet payload
  43. * @param len Frame length
  44. */
  45. 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);
  46. protected:
  47. bool m_FRAME(void *tPtr, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  48. bool m_EXT_FRAME(void *tPtr, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  49. bool m_MULTICAST_LIKE(void *tPtr, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  50. bool m_NETWORK_CREDENTIALS(void *tPtr, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  51. bool m_NETWORK_CONFIG_REQUEST(void *tPtr, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  52. bool m_NETWORK_CONFIG(void *tPtr, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  53. bool m_MULTICAST_GATHER(void *tPtr, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  54. bool m_MULTICAST_FRAME_deprecated(void *tPtr, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  55. bool m_MULTICAST(void *tPtr, const SharedPtr<Path> &path, SharedPtr<Peer> &peer, Buf &pkt, int packetSize);
  56. private:
  57. };
  58. } // namespace ZeroTier
  59. #endif