Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ManagedNetwork.h 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. /** @file
  2. EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.
  3. EFI_MANAGED_NETWORK_PROTOCOL as defined in UEFI 2.0.
  4. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
  5. This program and the accompanying materials are licensed and made available under
  6. the terms and conditions of the BSD License that accompanies this distribution.
  7. The full text of the license may be found at
  8. http://opensource.org/licenses/bsd-license.php.
  9. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  11. @par Revision Reference:
  12. This Protocol is introduced in UEFI Specification 2.0
  13. **/
  14. #ifndef __EFI_MANAGED_NETWORK_PROTOCOL_H__
  15. #define __EFI_MANAGED_NETWORK_PROTOCOL_H__
  16. FILE_LICENCE ( BSD3 );
  17. #include <ipxe/efi/Protocol/SimpleNetwork.h>
  18. #define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \
  19. { \
  20. 0xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } \
  21. }
  22. #define EFI_MANAGED_NETWORK_PROTOCOL_GUID \
  23. { \
  24. 0x7ab33a91, 0xace5, 0x4326, { 0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 } \
  25. }
  26. typedef struct _EFI_MANAGED_NETWORK_PROTOCOL EFI_MANAGED_NETWORK_PROTOCOL;
  27. typedef struct {
  28. ///
  29. /// Timeout value for a UEFI one-shot timer event. A packet that has not been removed
  30. /// from the MNP receive queue will be dropped if its receive timeout expires.
  31. ///
  32. UINT32 ReceivedQueueTimeoutValue;
  33. ///
  34. /// Timeout value for a UEFI one-shot timer event. A packet that has not been removed
  35. /// from the MNP transmit queue will be dropped if its receive timeout expires.
  36. ///
  37. UINT32 TransmitQueueTimeoutValue;
  38. ///
  39. /// Ethernet type II 16-bit protocol type in host byte order. Valid
  40. /// values are zero and 1,500 to 65,535.
  41. ///
  42. UINT16 ProtocolTypeFilter;
  43. ///
  44. /// Set to TRUE to receive packets that are sent to the network
  45. /// device MAC address. The startup default value is FALSE.
  46. ///
  47. BOOLEAN EnableUnicastReceive;
  48. ///
  49. /// Set to TRUE to receive packets that are sent to any of the
  50. /// active multicast groups. The startup default value is FALSE.
  51. ///
  52. BOOLEAN EnableMulticastReceive;
  53. ///
  54. /// Set to TRUE to receive packets that are sent to the network
  55. /// device broadcast address. The startup default value is FALSE.
  56. ///
  57. BOOLEAN EnableBroadcastReceive;
  58. ///
  59. /// Set to TRUE to receive packets that are sent to any MAC address.
  60. /// The startup default value is FALSE.
  61. ///
  62. BOOLEAN EnablePromiscuousReceive;
  63. ///
  64. /// Set to TRUE to drop queued packets when the configuration
  65. /// is changed. The startup default value is FALSE.
  66. ///
  67. BOOLEAN FlushQueuesOnReset;
  68. ///
  69. /// Set to TRUE to timestamp all packets when they are received
  70. /// by the MNP. Note that timestamps may be unsupported in some
  71. /// MNP implementations. The startup default value is FALSE.
  72. ///
  73. BOOLEAN EnableReceiveTimestamps;
  74. ///
  75. /// Set to TRUE to disable background polling in this MNP
  76. /// instance. Note that background polling may not be supported in
  77. /// all MNP implementations. The startup default value is FALSE,
  78. /// unless background polling is not supported.
  79. ///
  80. BOOLEAN DisableBackgroundPolling;
  81. } EFI_MANAGED_NETWORK_CONFIG_DATA;
  82. typedef struct {
  83. EFI_TIME Timestamp;
  84. EFI_EVENT RecycleEvent;
  85. UINT32 PacketLength;
  86. UINT32 HeaderLength;
  87. UINT32 AddressLength;
  88. UINT32 DataLength;
  89. BOOLEAN BroadcastFlag;
  90. BOOLEAN MulticastFlag;
  91. BOOLEAN PromiscuousFlag;
  92. UINT16 ProtocolType;
  93. VOID *DestinationAddress;
  94. VOID *SourceAddress;
  95. VOID *MediaHeader;
  96. VOID *PacketData;
  97. } EFI_MANAGED_NETWORK_RECEIVE_DATA;
  98. typedef struct {
  99. UINT32 FragmentLength;
  100. VOID *FragmentBuffer;
  101. } EFI_MANAGED_NETWORK_FRAGMENT_DATA;
  102. typedef struct {
  103. EFI_MAC_ADDRESS *DestinationAddress; //OPTIONAL
  104. EFI_MAC_ADDRESS *SourceAddress; //OPTIONAL
  105. UINT16 ProtocolType; //OPTIONAL
  106. UINT32 DataLength;
  107. UINT16 HeaderLength; //OPTIONAL
  108. UINT16 FragmentCount;
  109. EFI_MANAGED_NETWORK_FRAGMENT_DATA FragmentTable[1];
  110. } EFI_MANAGED_NETWORK_TRANSMIT_DATA;
  111. typedef struct {
  112. ///
  113. /// This Event will be signaled after the Status field is updated
  114. /// by the MNP. The type of Event must be
  115. /// EFI_NOTIFY_SIGNAL. The Task Priority Level (TPL) of
  116. /// Event must be lower than or equal to TPL_CALLBACK.
  117. ///
  118. EFI_EVENT Event;
  119. ///
  120. /// The status that is returned to the caller at the end of the operation
  121. /// to indicate whether this operation completed successfully.
  122. ///
  123. EFI_STATUS Status;
  124. union {
  125. ///
  126. /// When this token is used for receiving, RxData is a pointer to the EFI_MANAGED_NETWORK_RECEIVE_DATA.
  127. ///
  128. EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData;
  129. ///
  130. /// When this token is used for transmitting, TxData is a pointer to the EFI_MANAGED_NETWORK_TRANSMIT_DATA.
  131. ///
  132. EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData;
  133. } Packet;
  134. } EFI_MANAGED_NETWORK_COMPLETION_TOKEN;
  135. /**
  136. Returns the operational parameters for the current MNP child driver.
  137. @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
  138. @param MnpConfigData The pointer to storage for MNP operational parameters.
  139. @param SnpModeData The pointer to storage for SNP operational parameters.
  140. @retval EFI_SUCCESS The operation completed successfully.
  141. @retval EFI_INVALID_PARAMETER This is NULL.
  142. @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.
  143. @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. The default
  144. values are returned in MnpConfigData if it is not NULL.
  145. @retval Other The mode data could not be read.
  146. **/
  147. typedef
  148. EFI_STATUS
  149. (EFIAPI *EFI_MANAGED_NETWORK_GET_MODE_DATA)(
  150. IN EFI_MANAGED_NETWORK_PROTOCOL *This,
  151. OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
  152. OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
  153. );
  154. /**
  155. Sets or clears the operational parameters for the MNP child driver.
  156. @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
  157. @param MnpConfigData The pointer to configuration data that will be assigned to the MNP
  158. child driver instance. If NULL, the MNP child driver instance is
  159. reset to startup defaults and all pending transmit and receive
  160. requests are flushed.
  161. @retval EFI_SUCCESS The operation completed successfully.
  162. @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
  163. @retval EFI_OUT_OF_RESOURCES Required system resources (usually memory) could not be
  164. allocated.
  165. @retval EFI_UNSUPPORTED The requested feature is unsupported in this [MNP]
  166. implementation.
  167. @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
  168. @retval Other The MNP child driver instance has been reset to startup defaults.
  169. **/
  170. typedef
  171. EFI_STATUS
  172. (EFIAPI *EFI_MANAGED_NETWORK_CONFIGURE)(
  173. IN EFI_MANAGED_NETWORK_PROTOCOL *This,
  174. IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL
  175. );
  176. /**
  177. Translates an IP multicast address to a hardware (MAC) multicast address.
  178. @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
  179. @param Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address.
  180. Set to FALSE if IpAddress is an IPv4 multicast address.
  181. @param IpAddress The pointer to the multicast IP address (in network byte order) to convert.
  182. @param MacAddress The pointer to the resulting multicast MAC address.
  183. @retval EFI_SUCCESS The operation completed successfully.
  184. @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:
  185. - This is NULL.
  186. - IpAddress is NULL.
  187. - *IpAddress is not a valid multicast IP address.
  188. - MacAddress is NULL.
  189. @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
  190. @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.
  191. @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
  192. @retval Other The address could not be converted.
  193. **/
  194. typedef
  195. EFI_STATUS
  196. (EFIAPI *EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC)(
  197. IN EFI_MANAGED_NETWORK_PROTOCOL *This,
  198. IN BOOLEAN Ipv6Flag,
  199. IN EFI_IP_ADDRESS *IpAddress,
  200. OUT EFI_MAC_ADDRESS *MacAddress
  201. );
  202. /**
  203. Enables and disables receive filters for multicast address.
  204. @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
  205. @param JoinFlag Set to TRUE to join this multicast group.
  206. Set to FALSE to leave this multicast group.
  207. @param MacAddress The pointer to the multicast MAC group (address) to join or leave.
  208. @retval EFI_SUCCESS The requested operation completed successfully.
  209. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
  210. - This is NULL.
  211. - JoinFlag is TRUE and MacAddress is NULL.
  212. - *MacAddress is not a valid multicast MAC address.
  213. @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
  214. @retval EFI_ALREADY_STARTED The supplied multicast group is already joined.
  215. @retval EFI_NOT_FOUND The supplied multicast group is not joined.
  216. @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
  217. @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.
  218. @retval Other The requested operation could not be completed.
  219. **/
  220. typedef
  221. EFI_STATUS
  222. (EFIAPI *EFI_MANAGED_NETWORK_GROUPS)(
  223. IN EFI_MANAGED_NETWORK_PROTOCOL *This,
  224. IN BOOLEAN JoinFlag,
  225. IN EFI_MAC_ADDRESS *MacAddress OPTIONAL
  226. );
  227. /**
  228. Places asynchronous outgoing data packets into the transmit queue.
  229. @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
  230. @param Token The pointer to a token associated with the transmit data descriptor.
  231. @retval EFI_SUCCESS The transmit completion token was cached.
  232. @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
  233. @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
  234. @retval EFI_ACCESS_DENIED The transmit completion token is already in the transmit queue.
  235. @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources
  236. (usually memory).
  237. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  238. @retval EFI_NOT_READY The transmit request could not be queued because the transmit queue is full.
  239. **/
  240. typedef
  241. EFI_STATUS
  242. (EFIAPI *EFI_MANAGED_NETWORK_TRANSMIT)(
  243. IN EFI_MANAGED_NETWORK_PROTOCOL *This,
  244. IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
  245. );
  246. /**
  247. Places an asynchronous receiving request into the receiving queue.
  248. @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
  249. @param Token The pointer to a token associated with the receive data descriptor.
  250. @retval EFI_SUCCESS The receive completion token was cached.
  251. @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
  252. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
  253. - This is NULL.
  254. - Token is NULL.
  255. - Token.Event is NULL.
  256. @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources
  257. (usually memory).
  258. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  259. @retval EFI_ACCESS_DENIED The receive completion token was already in the receive queue.
  260. @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
  261. **/
  262. typedef
  263. EFI_STATUS
  264. (EFIAPI *EFI_MANAGED_NETWORK_RECEIVE)(
  265. IN EFI_MANAGED_NETWORK_PROTOCOL *This,
  266. IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
  267. );
  268. /**
  269. Aborts an asynchronous transmit or receive request.
  270. @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
  271. @param Token The pointer to a token that has been issued by
  272. EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or
  273. EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If
  274. NULL, all pending tokens are aborted.
  275. @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event
  276. was signaled. When Token is NULL, all pending requests were
  277. aborted and their events were signaled.
  278. @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
  279. @retval EFI_INVALID_PARAMETER This is NULL.
  280. @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
  281. not found in the transmit or receive queue. It has either completed
  282. or was not issued by Transmit() and Receive().
  283. **/
  284. typedef
  285. EFI_STATUS
  286. (EFIAPI *EFI_MANAGED_NETWORK_CANCEL)(
  287. IN EFI_MANAGED_NETWORK_PROTOCOL *This,
  288. IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL
  289. );
  290. /**
  291. Polls for incoming data packets and processes outgoing data packets.
  292. @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
  293. @retval EFI_SUCCESS Incoming or outgoing data was processed.
  294. @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
  295. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  296. @retval EFI_NOT_READY No incoming or outgoing data was processed. Consider increasing
  297. the polling rate.
  298. @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
  299. Consider increasing the polling rate.
  300. **/
  301. typedef
  302. EFI_STATUS
  303. (EFIAPI *EFI_MANAGED_NETWORK_POLL)(
  304. IN EFI_MANAGED_NETWORK_PROTOCOL *This
  305. );
  306. ///
  307. /// The MNP is used by network applications (and drivers) to
  308. /// perform raw (unformatted) asynchronous network packet I/O.
  309. ///
  310. struct _EFI_MANAGED_NETWORK_PROTOCOL {
  311. EFI_MANAGED_NETWORK_GET_MODE_DATA GetModeData;
  312. EFI_MANAGED_NETWORK_CONFIGURE Configure;
  313. EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC McastIpToMac;
  314. EFI_MANAGED_NETWORK_GROUPS Groups;
  315. EFI_MANAGED_NETWORK_TRANSMIT Transmit;
  316. EFI_MANAGED_NETWORK_RECEIVE Receive;
  317. EFI_MANAGED_NETWORK_CANCEL Cancel;
  318. EFI_MANAGED_NETWORK_POLL Poll;
  319. };
  320. extern EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid;
  321. extern EFI_GUID gEfiManagedNetworkProtocolGuid;
  322. #endif