rndis.h 6.6 KB

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