wlan_prot.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-08-14 tyx the first version
  9. */
  10. #ifndef __WLAN_PROT_H__
  11. #define __WLAN_PROT_H__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #ifndef RT_WLAN_PROT_NAME_LEN
  16. #define RT_WLAN_PROT_NAME_LEN (8)
  17. #endif
  18. #ifndef RT_WLAN_PROT_MAX
  19. #define RT_WLAN_PROT_MAX (1)
  20. #endif
  21. #define RT_LWAN_ID_PREFIX (0x5054)
  22. #define RT_WLAN_PROT_LWIP ("lwip")
  23. typedef enum
  24. {
  25. RT_WLAN_PROT_EVT_INIT_DONE = 0,
  26. RT_WLAN_PROT_EVT_CONNECT,
  27. RT_WLAN_PROT_EVT_DISCONNECT,
  28. RT_WLAN_PROT_EVT_AP_START,
  29. RT_WLAN_PROT_EVT_AP_STOP,
  30. RT_WLAN_PROT_EVT_AP_ASSOCIATED,
  31. RT_WLAN_PROT_EVT_AP_DISASSOCIATED,
  32. RT_WLAN_PROT_EVT_MAX,
  33. } rt_wlan_prot_event_t;
  34. struct rt_wlan_prot;
  35. struct rt_wlan_prot_ops
  36. {
  37. rt_err_t (*prot_recv)(struct rt_wlan_device *wlan, void *buff, int len);
  38. struct rt_wlan_prot *(*dev_reg_callback)(struct rt_wlan_prot *prot, struct rt_wlan_device *wlan);
  39. void (*dev_unreg_callback)(struct rt_wlan_prot *prot, struct rt_wlan_device *wlan);
  40. };
  41. struct rt_wlan_prot
  42. {
  43. char name[RT_WLAN_PROT_NAME_LEN];
  44. rt_uint32_t id;
  45. const struct rt_wlan_prot_ops *ops;
  46. };
  47. typedef void (*rt_wlan_prot_event_handler)(struct rt_wlan_prot *port, struct rt_wlan_device *wlan, int event);
  48. rt_err_t rt_wlan_prot_attach(const char *dev_name, const char *prot_name);
  49. rt_err_t rt_wlan_prot_attach_dev(struct rt_wlan_device *wlan, const char *prot_name);
  50. rt_err_t rt_wlan_prot_detach(const char *dev_name);
  51. rt_err_t rt_wlan_prot_detach_dev(struct rt_wlan_device *wlan);
  52. rt_err_t rt_wlan_prot_regisetr(struct rt_wlan_prot *prot);
  53. rt_err_t rt_wlan_prot_transfer_dev(struct rt_wlan_device *wlan, void *buff, int len);
  54. rt_err_t rt_wlan_dev_transfer_prot(struct rt_wlan_device *wlan, void *buff, int len);
  55. rt_err_t rt_wlan_prot_event_register(struct rt_wlan_prot *prot, rt_wlan_prot_event_t event, rt_wlan_prot_event_handler handler);
  56. rt_err_t rt_wlan_prot_event_unregister(struct rt_wlan_prot *prot, rt_wlan_prot_event_t event);
  57. int rt_wlan_prot_ready(struct rt_wlan_device *wlan, struct rt_wlan_buff *buff);
  58. void rt_wlan_prot_dump(void);
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #endif