wfd_if.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. #ifndef __WFD_IF_H__
  2. #define __WFD_IF_H__
  3. #include <pthread.h>
  4. #include "types.h"
  5. #include "netsetting_if.h"
  6. typedef struct MIRACAST_MessageBody_t_ {
  7. UINT32 dMessage;
  8. void *dParam;
  9. } MIRACAST_MessageBody_t;
  10. typedef enum
  11. {
  12. MIRACAST_FINDING,
  13. MIRACAST_FIND_DEVICES,
  14. MIRACAST_FIND_RETRY,
  15. MIRACAST_CONNECTING,
  16. MIRACAST_CONNECT_SUCCESS,
  17. MIRACAST_CONNECT_INACTIVE,
  18. MIRACAST_CONNECT_RETRY,
  19. MIRACAST_CONNECT_FAIL,
  20. MIRACAST_HDCP_FAIL,
  21. MIRACAST_DISCONNECT_RECEIVED,
  22. MIRACAST_EXIT_SUCCESS,
  23. MIRACAST_NO_DONGLE,
  24. }MIRACAST_Message_t;
  25. typedef int (*MIRACAST_ModCbk_pf)(MIRACAST_Message_t message, void *arg);
  26. typedef struct MIRACAST_ModualCfg_t_
  27. {
  28. MIRACAST_ModCbk_pf pfCallBack;
  29. } MIRACAST_ModualCfg_t;
  30. //typedef void (*cb_handler_t)(int event_id, void *arg);
  31. typedef struct _WIFI_WFD_Info_t
  32. {
  33. char pszDeviceName[32];
  34. char pszMAC[17];
  35. INT32 sdTcpPort;
  36. INT32 sdMaxThroughput;
  37. INT32 sdDeviceType;
  38. char pszPeerAddr[20];
  39. //cb_handler_t callback;
  40. }WIFI_WFD_Info_t;
  41. #if 0
  42. extern WIFI_WFD_Info_t *info;
  43. static inline void send_event(int event_id, void *arg)
  44. {
  45. if(info->callback)
  46. info->callback(event_id, arg);
  47. }
  48. #endif
  49. typedef struct WFD_Config_t
  50. {
  51. pthread_t tid;
  52. INT32 sdTcpPort;
  53. char peerIpAddr[17];
  54. }WFD_Config_t;
  55. typedef struct WFD_AV_FMT_t
  56. {
  57. char wfd_video_resolution[15];
  58. char wfd_audio_codec[15];
  59. }WFD_AV_FMT_t, *p_WFD_AV_FMT_t;
  60. typedef enum
  61. {
  62. WFD_CBK_SOURCE_KNOCK,
  63. WFD_CBK_LINK_SUCCESS,
  64. WFD_CBK_LINK_SUCCESS_NO_VIDEO,
  65. WFD_CBK_LINK_DISCONNECTED,
  66. WFD_CBK_SOURCE_SOURCE_TEARDOWN
  67. } WFD_CallbackType_e;
  68. #ifdef CONFIG_SUPPORT_MTK7601
  69. typedef unsigned char UCHAR;
  70. typedef unsigned short USHORT;
  71. typedef unsigned int UINT;
  72. /* START ---- For persistent group table ---- */
  73. #define IWSC_MAX_SUB_MASK_LIST_COUNT 3
  74. #define P2P_DEVICE_NAME_LEN 32
  75. #define OID_P2P_OFFSET 0x0000
  76. #define OID_802_11_P2P_PERSISTENT_TABLE (0x0846 + OID_P2P_OFFSET)
  77. #define OID_GET_SET_TOGGLE 0x8000
  78. #define NDIS_802_11_LENGTH_SSID 32
  79. #define MAC_ADDR_LEN 6
  80. #define MAX_P2P_TABLE_SIZE 9
  81. #define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x01)
  82. #define P2P_IF "p2p0"
  83. typedef struct _NDIS_802_11_SSID {
  84. UINT SsidLength; /* length of SSID field below, in bytes; */
  85. /* this can be zero. */
  86. UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; /* SSID information field */
  87. } NDIS_802_11_SSID, *PNDIS_802_11_SSID;
  88. typedef struct _WSC_CREDENTIAL {
  89. NDIS_802_11_SSID SSID; /* mandatory */
  90. USHORT AuthType; /* mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk */
  91. USHORT EncrType; /* mandatory, 1: none, 2: wep, 4: tkip, 8: aes */
  92. UCHAR Key[64]; /* mandatory, Maximum 64 byte */
  93. USHORT KeyLength;
  94. UCHAR MacAddr[MAC_ADDR_LEN]; /* mandatory, AP MAC address */
  95. UCHAR KeyIndex; /* optional, default is 1 */
  96. UCHAR bFromUPnP; /* TRUE: This credential is from external UPnP registrar */
  97. UCHAR Rsvd[2]; /* Make alignment */
  98. USHORT IpConfigMethod;
  99. UINT32 RegIpv4Addr;
  100. UINT32 Ipv4SubMask;
  101. UINT32 EnrIpv4Addr;
  102. UINT32 AvaIpv4SubmaskList[IWSC_MAX_SUB_MASK_LIST_COUNT];
  103. } WSC_CREDENTIAL, *PWSC_CREDENTIAL;
  104. typedef struct _RT_P2P_PERSISTENT_ENTRY
  105. {
  106. BOOLEAN bValid;
  107. UCHAR MyRule; /* My rule is GO or Client */
  108. UCHAR Addr[MAC_ADDR_LEN]; /* this addr is to distinguish this persistent entry is for which mac addr */
  109. UCHAR DeviceName[P2P_DEVICE_NAME_LEN+1];
  110. WSC_CREDENTIAL Profile; /* profile's bssid is always the GO's bssid. */
  111. } RT_P2P_PERSISTENT_ENTRY, *PRT_P2P_PERSISTENT_ENTRY;
  112. typedef struct {
  113. char wfd_if_name[8];
  114. RT_P2P_PERSISTENT_ENTRY wfd_profiles[MAX_P2P_TABLE_SIZE];
  115. } ralink_private_t;
  116. #endif
  117. #define MIRACASE_DEV_NAME "RDA_Miracast" /*Max Length of Device name is 13 (the max length of DEV_NAME+MAC is 32)*/
  118. enum HDCP_VERSION
  119. {
  120. HDCP_VERSION_2_0,
  121. HDCP_VERSION_2_1,
  122. HDCP_VERSION_2_2,
  123. };
  124. #ifdef CONFIG_SUPPORT_MIRACAST_HDCP
  125. #ifdef CONFIG_SUPPORT_STORE_HDCP2X_TO_FLASH
  126. #define MIRACASE_SUPPORT_HDCP HDCP_VERSION_2_2
  127. #else
  128. #define MIRACASE_SUPPORT_HDCP HDCP_VERSION_2_1
  129. #endif
  130. #else
  131. #define MIRACASE_SUPPORT_HDCP 0
  132. #endif
  133. typedef struct
  134. {
  135. Dongle_e eDongle;
  136. char* P2PName;
  137. char* Dev_Name;
  138. char bHDCP;
  139. } Miracast_Info_t;
  140. void WFD_send_event(MIRACAST_Message_t message, void *arg);
  141. //API
  142. void Miracast_SetChannel(int channel);
  143. void Miracast_Startup(MIRACAST_ModCbk_pf pfCallBack,Miracast_Info_t *pMiracastInfo);
  144. BOOL Miracast_Check();
  145. void Miracast_Exit(void);
  146. typedef int (*WFD_CBK_Func)(WFD_CallbackType_e eSCCBKType, UINT32 dparam);
  147. void WFD_Init_AP_CBKFunc(WFD_CBK_Func pfEventCallBack);
  148. #endif