virtual_mgmt.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (c) 2021 Intel Corporation.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief Virtual Interface Management interface public header
  9. */
  10. #ifndef ZEPHYR_INCLUDE_NET_VIRTUAL_MGMT_H_
  11. #define ZEPHYR_INCLUDE_NET_VIRTUAL_MGMT_H_
  12. #include <net/virtual.h>
  13. #include <net/net_mgmt.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /**
  18. * @brief Virtual interface library
  19. * @defgroup virtual_mgmt Virtual Interface Library
  20. * @ingroup networking
  21. * @{
  22. */
  23. /** @cond INTERNAL_HIDDEN */
  24. #define _NET_VIRTUAL_INTERFACE_LAYER NET_MGMT_LAYER_L2
  25. #define _NET_VIRTUAL_INTERFACE_CODE 0x209
  26. #define _NET_VIRTUAL_INTERFACE_BASE \
  27. (NET_MGMT_IFACE_BIT | \
  28. NET_MGMT_LAYER(_NET_VIRTUAL_INTERFACE_LAYER) | \
  29. NET_MGMT_LAYER_CODE(_NET_VIRTUAL_INTERFACE_CODE))
  30. #define _NET_VIRTUAL_INTERFACE_EVENT \
  31. (_NET_VIRTUAL_INTERFACE_BASE | NET_MGMT_EVENT_BIT)
  32. struct virtual_interface_req_params {
  33. sa_family_t family;
  34. union {
  35. struct in_addr peer4addr;
  36. struct in6_addr peer6addr;
  37. int mtu;
  38. };
  39. };
  40. enum net_request_virtual_interface_cmd {
  41. NET_REQUEST_VIRTUAL_INTERFACE_CMD_SET_PEER_ADDR = 1,
  42. NET_REQUEST_VIRTUAL_INTERFACE_CMD_GET_PEER_ADDR,
  43. NET_REQUEST_VIRTUAL_INTERFACE_CMD_SET_MTU,
  44. NET_REQUEST_VIRTUAL_INTERFACE_CMD_GET_MTU,
  45. };
  46. #define NET_REQUEST_VIRTUAL_INTERFACE_SET_PEER_ADDRESS \
  47. (_NET_VIRTUAL_INTERFACE_BASE | \
  48. NET_REQUEST_VIRTUAL_INTERFACE_CMD_SET_PEER_ADDR)
  49. NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_SET_PEER_ADDRESS);
  50. #define NET_REQUEST_VIRTUAL_INTERFACE_SET_MTU \
  51. (_NET_VIRTUAL_INTERFACE_BASE | \
  52. NET_REQUEST_VIRTUAL_INTERFACE_CMD_SET_MTU)
  53. NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_SET_MTU);
  54. #define NET_REQUEST_VIRTUAL_INTERFACE_GET_PEER_ADDRESS \
  55. (_NET_VIRTUAL_INTERFACE_BASE | \
  56. NET_REQUEST_VIRTUAL_INTERFACE_CMD_GET_PEER_ADDR)
  57. NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_GET_PEER_ADDRESS);
  58. #define NET_REQUEST_VIRTUAL_INTERFACE_GET_MTU \
  59. (_NET_VIRTUAL_INTERFACE_BASE | \
  60. NET_REQUEST_VIRTUAL_INTERFACE_CMD_GET_MTU)
  61. NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_GET_MTU);
  62. struct net_if;
  63. /** @endcond */
  64. /**
  65. * @}
  66. */
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif /* ZEPHYR_INCLUDE_NET_VIRTUAL_MGMT_H_ */