rndis.h 5.3 KB

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