rndis.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /*
  2. * RNDIS Definitions for Remote NDIS
  3. *
  4. * Authors: Benedikt Spranger, Pengutronix
  5. * Robert Schwebel, Pengutronix
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2, as published by the Free Software Foundation.
  10. *
  11. * This software was originally developed in conformance with
  12. * Microsoft's Remote NDIS Specification License Agreement.
  13. */
  14. #ifndef _LINUX_RNDIS_H
  15. #define _LINUX_RNDIS_H
  16. #include "ndis.h"
  17. #define RNDIS_MAXIMUM_FRAME_SIZE 1518
  18. #define RNDIS_MAX_TOTAL_SIZE 1558
  19. /* Remote NDIS Versions */
  20. #define RNDIS_MAJOR_VERSION 1
  21. #define RNDIS_MINOR_VERSION 0
  22. /* Status Values */
  23. #define RNDIS_STATUS_SUCCESS 0x00000000U /* Success */
  24. #define RNDIS_STATUS_FAILURE 0xC0000001U /* Unspecified error */
  25. #define RNDIS_STATUS_INVALID_DATA 0xC0010015U /* Invalid data */
  26. #define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBU /* Unsupported request */
  27. #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BU /* Device connected */
  28. #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CU /* Device disconnected */
  29. /* For all not specified status messages:
  30. * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx
  31. */
  32. /* Message Set for Connectionless (802.3) Devices */
  33. #define REMOTE_NDIS_PACKET_MSG 0x00000001U
  34. #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */
  35. #define REMOTE_NDIS_HALT_MSG 0x00000003U
  36. #define REMOTE_NDIS_QUERY_MSG 0x00000004U
  37. #define REMOTE_NDIS_SET_MSG 0x00000005U
  38. #define REMOTE_NDIS_RESET_MSG 0x00000006U
  39. #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007U
  40. #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008U
  41. /* Message completion */
  42. #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002U
  43. #define REMOTE_NDIS_QUERY_CMPLT 0x80000004U
  44. #define REMOTE_NDIS_SET_CMPLT 0x80000005U
  45. #define REMOTE_NDIS_RESET_CMPLT 0x80000006U
  46. #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008U
  47. /* Device Flags */
  48. #define RNDIS_DF_CONNECTIONLESS 0x00000001U
  49. #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U
  50. #define RNDIS_MEDIUM_802_3 0x00000000U
  51. /* from drivers/net/sk98lin/h/skgepnmi.h */
  52. #define OID_PNP_CAPABILITIES 0xFD010100
  53. #define OID_PNP_SET_POWER 0xFD010101
  54. #define OID_PNP_QUERY_POWER 0xFD010102
  55. #define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103
  56. #define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
  57. #define OID_PNP_ENABLE_WAKE_UP 0xFD010106
  58. typedef struct rndis_init_msg_type
  59. {
  60. __le32 MessageType;
  61. __le32 MessageLength;
  62. __le32 RequestID;
  63. __le32 MajorVersion;
  64. __le32 MinorVersion;
  65. __le32 MaxTransferSize;
  66. } rndis_init_msg_type;
  67. typedef struct rndis_init_cmplt_type
  68. {
  69. __le32 MessageType;
  70. __le32 MessageLength;
  71. __le32 RequestID;
  72. __le32 Status;
  73. __le32 MajorVersion;
  74. __le32 MinorVersion;
  75. __le32 DeviceFlags;
  76. __le32 Medium;
  77. __le32 MaxPacketsPerTransfer;
  78. __le32 MaxTransferSize;
  79. __le32 PacketAlignmentFactor;
  80. __le32 AFListOffset;
  81. __le32 AFListSize;
  82. } rndis_init_cmplt_type;
  83. typedef struct rndis_halt_msg_type
  84. {
  85. __le32 MessageType;
  86. __le32 MessageLength;
  87. __le32 RequestID;
  88. } rndis_halt_msg_type;
  89. typedef struct rndis_query_msg_type
  90. {
  91. __le32 MessageType;
  92. __le32 MessageLength;
  93. __le32 RequestID;
  94. __le32 OID;
  95. __le32 InformationBufferLength;
  96. __le32 InformationBufferOffset;
  97. __le32 DeviceVcHandle;
  98. } rndis_query_msg_type;
  99. typedef struct rndis_query_cmplt_type
  100. {
  101. __le32 MessageType;
  102. __le32 MessageLength;
  103. __le32 RequestID;
  104. __le32 Status;
  105. __le32 InformationBufferLength;
  106. __le32 InformationBufferOffset;
  107. } rndis_query_cmplt_type;
  108. typedef struct rndis_set_msg_type
  109. {
  110. __le32 MessageType;
  111. __le32 MessageLength;
  112. __le32 RequestID;
  113. __le32 OID;
  114. __le32 InformationBufferLength;
  115. __le32 InformationBufferOffset;
  116. __le32 DeviceVcHandle;
  117. } rndis_set_msg_type;
  118. typedef struct rndis_set_cmplt_type
  119. {
  120. __le32 MessageType;
  121. __le32 MessageLength;
  122. __le32 RequestID;
  123. __le32 Status;
  124. } rndis_set_cmplt_type;
  125. typedef struct rndis_reset_msg_type
  126. {
  127. __le32 MessageType;
  128. __le32 MessageLength;
  129. __le32 Reserved;
  130. } rndis_reset_msg_type;
  131. typedef struct rndis_reset_cmplt_type
  132. {
  133. __le32 MessageType;
  134. __le32 MessageLength;
  135. __le32 Status;
  136. __le32 AddressingReset;
  137. } rndis_reset_cmplt_type;
  138. typedef struct rndis_indicate_status_msg_type
  139. {
  140. __le32 MessageType;
  141. __le32 MessageLength;
  142. __le32 Status;
  143. __le32 StatusBufferLength;
  144. __le32 StatusBufferOffset;
  145. } rndis_indicate_status_msg_type;
  146. typedef struct rndis_keepalive_msg_type
  147. {
  148. __le32 MessageType;
  149. __le32 MessageLength;
  150. __le32 RequestID;
  151. } rndis_keepalive_msg_type;
  152. typedef struct rndis_keepalive_cmplt_type
  153. {
  154. __le32 MessageType;
  155. __le32 MessageLength;
  156. __le32 RequestID;
  157. __le32 Status;
  158. } rndis_keepalive_cmplt_type;
  159. struct rndis_packet_msg_type
  160. {
  161. __le32 MessageType;
  162. __le32 MessageLength;
  163. __le32 DataOffset;
  164. __le32 DataLength;
  165. __le32 OOBDataOffset;
  166. __le32 OOBDataLength;
  167. __le32 NumOOBDataElements;
  168. __le32 PerPacketInfoOffset;
  169. __le32 PerPacketInfoLength;
  170. __le32 VcHandle;
  171. __le32 Reserved;
  172. } __attribute__ ((packed));
  173. struct rndis_config_parameter
  174. {
  175. __le32 ParameterNameOffset;
  176. __le32 ParameterNameLength;
  177. __le32 ParameterType;
  178. __le32 ParameterValueOffset;
  179. __le32 ParameterValueLength;
  180. };
  181. /* implementation specific */
  182. enum rndis_state
  183. {
  184. RNDIS_UNINITIALIZED,
  185. RNDIS_INITIALIZED,
  186. RNDIS_DATA_INITIALIZED,
  187. };
  188. typedef struct rndis_resp_t
  189. {
  190. struct list_head list;
  191. u8 *buf;
  192. u32 length;
  193. int send;
  194. } rndis_resp_t;
  195. typedef struct rndis_params
  196. {
  197. u8 confignr;
  198. u8 used;
  199. u16 saved_filter;
  200. enum rndis_state state;
  201. u32 medium;
  202. u32 speed;
  203. u32 media_state;
  204. const u8 *host_mac;
  205. u16 *filter;
  206. struct net_device *dev;
  207. u32 vendorID;
  208. const char *vendorDescr;
  209. void (*resp_avail)(void *v);
  210. void *v;
  211. struct list_head resp_queue;
  212. } rndis_params;
  213. /* RNDIS Message parser and other useless functions */
  214. int rndis_msg_parser (u8 configNr, u8 *buf);
  215. int rndis_register(void (*resp_avail)(void *v), void *v);
  216. void rndis_deregister (int configNr);
  217. int rndis_set_param_dev (u8 configNr, struct net_device *dev,
  218. u16 *cdc_filter);
  219. int rndis_set_param_vendor (u8 configNr, u32 vendorID,
  220. const char *vendorDescr);
  221. int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed);
  222. void rndis_add_hdr (struct sk_buff *skb);
  223. int rndis_rm_hdr(struct gether *port, struct sk_buff *skb,
  224. struct sk_buff_head *list);
  225. u8 *rndis_get_next_response (int configNr, u32 *length);
  226. void rndis_free_response (int configNr, u8 *buf);
  227. void rndis_uninit (int configNr);
  228. int rndis_signal_connect (int configNr);
  229. int rndis_signal_disconnect (int configNr);
  230. int rndis_state (int configNr);
  231. extern void rndis_set_host_mac (int configNr, const u8 *addr);
  232. int rndis_init(void);
  233. void rndis_exit (void);
  234. #endif /* _LINUX_RNDIS_H */