rndis.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2012-12-24 heyuanjie87 first version
  9. */
  10. #ifndef __RNDIS_H__
  11. #define __RNDIS_H__
  12. #include <rtthread.h>
  13. #define USB_ETH_MTU 1500+14
  14. #define RNDIS_MESSAGE_BUFFER_SIZE 128
  15. #define RESPONSE_AVAILABLE 0x00000001
  16. /* Remote NDIS version numbers */
  17. #define RNDIS_MAJOR_VERSION 1
  18. #define RNDIS_MINOR_VERSION 0
  19. /* common status values */
  20. #define RNDIS_STATUS_SUCCESS 0X00000000
  21. #define RNDIS_STATUS_FAILURE 0XC0000001
  22. #define RNDIS_STATUS_INVALID_DATA 0XC0010015
  23. #define RNDIS_STATUS_NOT_SUPPORTED 0XC00000BB
  24. #define RNDIS_STATUS_MEDIA_CONNECT 0X4001000B
  25. #define RNDIS_STATUS_MEDIA_DISCONNECT 0X4001000C
  26. /* Remote NDIS message types */
  27. #define REMOTE_NDIS_PACKET_MSG 0x00000001
  28. #define REMOTE_NDIS_INITIALIZE_MSG 0X00000002
  29. #define REMOTE_NDIS_HALT_MSG 0X00000003
  30. #define REMOTE_NDIS_QUERY_MSG 0X00000004
  31. #define REMOTE_NDIS_SET_MSG 0X00000005
  32. #define REMOTE_NDIS_RESET_MSG 0X00000006
  33. #define REMOTE_NDIS_INDICATE_STATUS_MSG 0X00000007
  34. #define REMOTE_NDIS_KEEPALIVE_MSG 0X00000008
  35. #define REMOTE_NDIS_INITIALIZE_CMPLT 0X80000002
  36. #define REMOTE_NDIS_QUERY_CMPLT 0X80000004
  37. #define REMOTE_NDIS_SET_CMPLT 0X80000005
  38. #define REMOTE_NDIS_RESET_CMPLT 0X80000006
  39. #define REMOTE_NDIS_KEEPALIVE_CMPLT 0X80000008
  40. /* device flags */
  41. #define RNDIS_DF_CONNECTIONLESS 0x00000001
  42. #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
  43. /* mediums */
  44. #define RNDIS_MEDIUM_802_3 0x00000000
  45. struct ucls_rndis
  46. {
  47. uep_t notify;
  48. rt_uint32_t filter;
  49. rt_bool_t header;
  50. rt_uint8_t rndis_state;
  51. rt_uint8_t media_state;
  52. rt_uint8_t ethaddr[6];
  53. };
  54. /* Remote NDIS generic message type */
  55. struct rndis_gen_msg
  56. {
  57. rt_uint32_t MessageType;
  58. rt_uint32_t MessageLength;
  59. };
  60. typedef struct rndis_gen_msg* rndis_gen_msg_t;
  61. struct rndis_packet_msg
  62. {
  63. rt_uint32_t MessageType;
  64. rt_uint32_t MessageLength;
  65. rt_uint32_t DataOffset;
  66. rt_uint32_t DataLength;
  67. rt_uint32_t OOBDataOffset;
  68. rt_uint32_t OOBDataLength;
  69. rt_uint32_t NumOOBDataElements;
  70. rt_uint32_t PerPacketInfoOffset;
  71. rt_uint32_t PerPacketInfoLength;
  72. rt_uint32_t VcHandle;
  73. rt_uint32_t Reserved;
  74. };
  75. typedef struct rndis_packet_msg* rndis_packet_msg_t;
  76. /* Remote NDIS Initialize Message */
  77. struct rndis_init_msg
  78. {
  79. rt_uint32_t MessageType;
  80. rt_uint32_t MessageLength;
  81. rt_uint32_t RequestId;
  82. rt_uint32_t MajorVersion;
  83. rt_uint32_t MinorVersion;
  84. rt_uint32_t MaxTransferSize;
  85. };
  86. typedef struct rndis_init_msg* rndis_init_msg_t;
  87. /* Response */
  88. struct rndis_init_cmplt
  89. {
  90. rt_uint32_t MessageType;
  91. rt_uint32_t MessageLength;
  92. rt_uint32_t RequestId;
  93. rt_uint32_t Status;
  94. rt_uint32_t MajorVersion;
  95. rt_uint32_t MinorVersion;
  96. rt_uint32_t DeviceFlags;
  97. rt_uint32_t Medium;
  98. rt_uint32_t MaxPacketsPerTransfer;
  99. rt_uint32_t MaxTransferSize;
  100. rt_uint32_t PacketAlignmentFactor;
  101. rt_uint32_t AfListOffset;
  102. rt_uint32_t AfListSize;
  103. };
  104. typedef struct rndis_init_cmplt* rndis_init_cmplt_t;
  105. /* Remote NDIS Halt Message */
  106. struct rndis_halt_msg
  107. {
  108. rt_uint32_t MessageType;
  109. rt_uint32_t MessageLength;
  110. rt_uint32_t RequestId;
  111. };
  112. /* Remote NDIS Query Message */
  113. struct rndis_query_msg
  114. {
  115. rt_uint32_t MessageType;
  116. rt_uint32_t MessageLength;
  117. rt_uint32_t RequestId;
  118. rt_uint32_t Oid;
  119. rt_uint32_t InformationBufferLength;
  120. rt_uint32_t InformationBufferOffset;
  121. rt_uint32_t DeviceVcHandle;
  122. };
  123. typedef struct rndis_query_msg* rndis_query_msg_t;
  124. /* Response */
  125. struct rndis_query_cmplt
  126. {
  127. rt_uint32_t MessageType;
  128. rt_uint32_t MessageLength;
  129. rt_uint32_t RequestId;
  130. rt_uint32_t Status;
  131. rt_uint32_t InformationBufferLength;
  132. rt_uint32_t InformationBufferOffset;
  133. };
  134. typedef struct rndis_query_cmplt* rndis_query_cmplt_t;
  135. /* Remote NDIS Set Message */
  136. struct rndis_set_msg
  137. {
  138. rt_uint32_t MessageType;
  139. rt_uint32_t MessageLength;
  140. rt_uint32_t RequestId;
  141. rt_uint32_t Oid;
  142. rt_uint32_t InformationBufferLength;
  143. rt_uint32_t InformationBufferOffset;
  144. rt_uint32_t DeviceVcHandle;
  145. };
  146. typedef struct rndis_set_msg* rndis_set_msg_t;
  147. /* Response */
  148. struct rndis_set_cmplt
  149. {
  150. rt_uint32_t MessageType;
  151. rt_uint32_t MessageLength;
  152. rt_uint32_t RequestId;
  153. rt_uint32_t Status;
  154. };
  155. typedef struct rndis_set_cmplt* rndis_set_cmplt_t;
  156. /* Remote NDIS Soft Reset Message */
  157. struct rndis_reset_msg
  158. {
  159. rt_uint32_t MessageType;
  160. rt_uint32_t MessageLength;
  161. rt_uint32_t Reserved;
  162. };
  163. /* Remote NDIS Soft Reset Response */
  164. struct rndis_reset_cmplt
  165. {
  166. rt_uint32_t MessageType;
  167. rt_uint32_t MessageLength;
  168. rt_uint32_t Status;
  169. rt_uint32_t AddressingReset;
  170. };
  171. /* Remote NDIS Indicate Status Message */
  172. struct rndis_indicate_status_msg
  173. {
  174. rt_uint32_t MessageType;
  175. rt_uint32_t MessageLength;
  176. rt_uint32_t Status;
  177. rt_uint32_t StatusBufferLength;
  178. rt_uint32_t StatusBufferOffset;
  179. };
  180. typedef struct rndis_indicate_status_msg* rndis_indicate_status_msg_t;
  181. struct rndis_keepalive_msg
  182. {
  183. rt_uint32_t MessageType;
  184. rt_uint32_t MessageLength;
  185. rt_uint32_t RequestID;
  186. };
  187. typedef struct rndis_keepalive_msg* rndis_keepalive_msg_t;
  188. /* Response: */
  189. struct rndis_keepalive_cmplt
  190. {
  191. rt_uint32_t MessageType;
  192. rt_uint32_t MessageLength;
  193. rt_uint32_t RequestId;
  194. rt_uint32_t Status;
  195. };
  196. typedef struct rndis_keepalive_cmplt* rndis_keepalive_cmplt_t;
  197. #endif