You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Ip4.h 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. /** @file
  2. This file defines the EFI IPv4 (Internet Protocol version 4)
  3. Protocol interface. It is split into the following three main
  4. sections:
  5. - EFI IPv4 Service Binding Protocol
  6. - EFI IPv4 Variable (deprecated in UEFI 2.4B)
  7. - EFI IPv4 Protocol.
  8. The EFI IPv4 Protocol provides basic network IPv4 packet I/O services,
  9. which includes support foR a subset of the Internet Control Message
  10. Protocol (ICMP) and may include support for the Internet Group Management
  11. Protocol (IGMP).
  12. Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
  13. This program and the accompanying materials are licensed and made available under
  14. the terms and conditions of the BSD License that accompanies this distribution.
  15. The full text of the license may be found at
  16. http://opensource.org/licenses/bsd-license.php.
  17. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  18. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  19. @par Revision Reference:
  20. This Protocol is introduced in UEFI Specification 2.0.
  21. **/
  22. #ifndef __EFI_IP4_PROTOCOL_H__
  23. #define __EFI_IP4_PROTOCOL_H__
  24. FILE_LICENCE ( BSD3 );
  25. #include <ipxe/efi/Protocol/ManagedNetwork.h>
  26. #define EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID \
  27. { \
  28. 0xc51711e7, 0xb4bf, 0x404a, {0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } \
  29. }
  30. #define EFI_IP4_PROTOCOL_GUID \
  31. { \
  32. 0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \
  33. }
  34. typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL;
  35. ///
  36. /// EFI_IP4_ADDRESS_PAIR is deprecated in the UEFI 2.4B and should not be used any more.
  37. /// The definition in here is only present to provide backwards compatability.
  38. ///
  39. typedef struct {
  40. EFI_HANDLE InstanceHandle;
  41. EFI_IPv4_ADDRESS Ip4Address;
  42. EFI_IPv4_ADDRESS SubnetMask;
  43. } EFI_IP4_ADDRESS_PAIR;
  44. ///
  45. /// EFI_IP4_VARIABLE_DATA is deprecated in the UEFI 2.4B and should not be used any more.
  46. /// The definition in here is only present to provide backwards compatability.
  47. ///
  48. typedef struct {
  49. EFI_HANDLE DriverHandle;
  50. UINT32 AddressCount;
  51. EFI_IP4_ADDRESS_PAIR AddressPairs[1];
  52. } EFI_IP4_VARIABLE_DATA;
  53. typedef struct {
  54. ///
  55. /// The default IPv4 protocol packets to send and receive. Ignored
  56. /// when AcceptPromiscuous is TRUE.
  57. ///
  58. UINT8 DefaultProtocol;
  59. ///
  60. /// Set to TRUE to receive all IPv4 packets that get through the receive filters.
  61. /// Set to FALSE to receive only the DefaultProtocol IPv4
  62. /// packets that get through the receive filters.
  63. ///
  64. BOOLEAN AcceptAnyProtocol;
  65. ///
  66. /// Set to TRUE to receive ICMP error report packets. Ignored when
  67. /// AcceptPromiscuous or AcceptAnyProtocol is TRUE.
  68. ///
  69. BOOLEAN AcceptIcmpErrors;
  70. ///
  71. /// Set to TRUE to receive broadcast IPv4 packets. Ignored when
  72. /// AcceptPromiscuous is TRUE.
  73. /// Set to FALSE to stop receiving broadcast IPv4 packets.
  74. ///
  75. BOOLEAN AcceptBroadcast;
  76. ///
  77. /// Set to TRUE to receive all IPv4 packets that are sent to any
  78. /// hardware address or any protocol address.
  79. /// Set to FALSE to stop receiving all promiscuous IPv4 packets
  80. ///
  81. BOOLEAN AcceptPromiscuous;
  82. ///
  83. /// Set to TRUE to use the default IPv4 address and default routing table.
  84. ///
  85. BOOLEAN UseDefaultAddress;
  86. ///
  87. /// The station IPv4 address that will be assigned to this EFI IPv4Protocol instance.
  88. ///
  89. EFI_IPv4_ADDRESS StationAddress;
  90. ///
  91. /// The subnet address mask that is associated with the station address.
  92. ///
  93. EFI_IPv4_ADDRESS SubnetMask;
  94. ///
  95. /// TypeOfService field in transmitted IPv4 packets.
  96. ///
  97. UINT8 TypeOfService;
  98. ///
  99. /// TimeToLive field in transmitted IPv4 packets.
  100. ///
  101. UINT8 TimeToLive;
  102. ///
  103. /// State of the DoNotFragment bit in transmitted IPv4 packets.
  104. ///
  105. BOOLEAN DoNotFragment;
  106. ///
  107. /// Set to TRUE to send and receive unformatted packets. The other
  108. /// IPv4 receive filters are still applied. Fragmentation is disabled for RawData mode.
  109. ///
  110. BOOLEAN RawData;
  111. ///
  112. /// The timer timeout value (number of microseconds) for the
  113. /// receive timeout event to be associated with each assembled
  114. /// packet. Zero means do not drop assembled packets.
  115. ///
  116. UINT32 ReceiveTimeout;
  117. ///
  118. /// The timer timeout value (number of microseconds) for the
  119. /// transmit timeout event to be associated with each outgoing
  120. /// packet. Zero means do not drop outgoing packets.
  121. ///
  122. UINT32 TransmitTimeout;
  123. } EFI_IP4_CONFIG_DATA;
  124. typedef struct {
  125. EFI_IPv4_ADDRESS SubnetAddress;
  126. EFI_IPv4_ADDRESS SubnetMask;
  127. EFI_IPv4_ADDRESS GatewayAddress;
  128. } EFI_IP4_ROUTE_TABLE;
  129. typedef struct {
  130. UINT8 Type;
  131. UINT8 Code;
  132. } EFI_IP4_ICMP_TYPE;
  133. typedef struct {
  134. ///
  135. /// Set to TRUE after this EFI IPv4 Protocol instance has been successfully configured.
  136. ///
  137. BOOLEAN IsStarted;
  138. ///
  139. /// The maximum packet size, in bytes, of the packet which the upper layer driver could feed.
  140. ///
  141. UINT32 MaxPacketSize;
  142. ///
  143. /// Current configuration settings.
  144. ///
  145. EFI_IP4_CONFIG_DATA ConfigData;
  146. ///
  147. /// Set to TRUE when the EFI IPv4 Protocol instance has a station address and subnet mask.
  148. ///
  149. BOOLEAN IsConfigured;
  150. ///
  151. /// Number of joined multicast groups.
  152. ///
  153. UINT32 GroupCount;
  154. ///
  155. /// List of joined multicast group addresses.
  156. ///
  157. EFI_IPv4_ADDRESS *GroupTable;
  158. ///
  159. /// Number of entries in the routing table.
  160. ///
  161. UINT32 RouteCount;
  162. ///
  163. /// Routing table entries.
  164. ///
  165. EFI_IP4_ROUTE_TABLE *RouteTable;
  166. ///
  167. /// Number of entries in the supported ICMP types list.
  168. ///
  169. UINT32 IcmpTypeCount;
  170. ///
  171. /// Array of ICMP types and codes that are supported by this EFI IPv4 Protocol driver
  172. ///
  173. EFI_IP4_ICMP_TYPE *IcmpTypeList;
  174. } EFI_IP4_MODE_DATA;
  175. #pragma pack(1)
  176. typedef struct {
  177. UINT8 HeaderLength:4;
  178. UINT8 Version:4;
  179. UINT8 TypeOfService;
  180. UINT16 TotalLength;
  181. UINT16 Identification;
  182. UINT16 Fragmentation;
  183. UINT8 TimeToLive;
  184. UINT8 Protocol;
  185. UINT16 Checksum;
  186. EFI_IPv4_ADDRESS SourceAddress;
  187. EFI_IPv4_ADDRESS DestinationAddress;
  188. } EFI_IP4_HEADER;
  189. #pragma pack()
  190. typedef struct {
  191. UINT32 FragmentLength;
  192. VOID *FragmentBuffer;
  193. } EFI_IP4_FRAGMENT_DATA;
  194. typedef struct {
  195. EFI_TIME TimeStamp;
  196. EFI_EVENT RecycleSignal;
  197. UINT32 HeaderLength;
  198. EFI_IP4_HEADER *Header;
  199. UINT32 OptionsLength;
  200. VOID *Options;
  201. UINT32 DataLength;
  202. UINT32 FragmentCount;
  203. EFI_IP4_FRAGMENT_DATA FragmentTable[1];
  204. } EFI_IP4_RECEIVE_DATA;
  205. typedef struct {
  206. EFI_IPv4_ADDRESS SourceAddress;
  207. EFI_IPv4_ADDRESS GatewayAddress;
  208. UINT8 Protocol;
  209. UINT8 TypeOfService;
  210. UINT8 TimeToLive;
  211. BOOLEAN DoNotFragment;
  212. } EFI_IP4_OVERRIDE_DATA;
  213. typedef struct {
  214. EFI_IPv4_ADDRESS DestinationAddress;
  215. EFI_IP4_OVERRIDE_DATA *OverrideData; //OPTIONAL
  216. UINT32 OptionsLength; //OPTIONAL
  217. VOID *OptionsBuffer; //OPTIONAL
  218. UINT32 TotalDataLength;
  219. UINT32 FragmentCount;
  220. EFI_IP4_FRAGMENT_DATA FragmentTable[1];
  221. } EFI_IP4_TRANSMIT_DATA;
  222. typedef struct {
  223. ///
  224. /// This Event will be signaled after the Status field is updated
  225. /// by the EFI IPv4 Protocol driver. The type of Event must be
  226. /// EFI_NOTIFY_SIGNAL. The Task Priority Level (TPL) of
  227. /// Event must be lower than or equal to TPL_CALLBACK.
  228. ///
  229. EFI_EVENT Event;
  230. ///
  231. /// The status that is returned to the caller at the end of the operation
  232. /// to indicate whether this operation completed successfully.
  233. ///
  234. EFI_STATUS Status;
  235. union {
  236. ///
  237. /// When this token is used for receiving, RxData is a pointer to the EFI_IP4_RECEIVE_DATA.
  238. ///
  239. EFI_IP4_RECEIVE_DATA *RxData;
  240. ///
  241. /// When this token is used for transmitting, TxData is a pointer to the EFI_IP4_TRANSMIT_DATA.
  242. ///
  243. EFI_IP4_TRANSMIT_DATA *TxData;
  244. } Packet;
  245. } EFI_IP4_COMPLETION_TOKEN;
  246. /**
  247. Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
  248. The GetModeData() function returns the current operational mode data for this
  249. driver instance. The data fields in EFI_IP4_MODE_DATA are read only. This
  250. function is used optionally to retrieve the operational mode data of underlying
  251. networks or drivers.
  252. @param This The pointer to the EFI_IP4_PROTOCOL instance.
  253. @param Ip4ModeData The pointer to the EFI IPv4 Protocol mode data structure.
  254. @param MnpConfigData The pointer to the managed network configuration data structure.
  255. @param SnpModeData The pointer to the simple network mode data structure.
  256. @retval EFI_SUCCESS The operation completed successfully.
  257. @retval EFI_INVALID_PARAMETER This is NULL.
  258. @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
  259. **/
  260. typedef
  261. EFI_STATUS
  262. (EFIAPI *EFI_IP4_GET_MODE_DATA)(
  263. IN CONST EFI_IP4_PROTOCOL *This,
  264. OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
  265. OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
  266. OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
  267. );
  268. /**
  269. Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
  270. The Configure() function is used to set, change, or reset the operational
  271. parameters and filter settings for this EFI IPv4 Protocol instance. Until these
  272. parameters have been set, no network traffic can be sent or received by this
  273. instance. Once the parameters have been reset (by calling this function with
  274. IpConfigData set to NULL), no more traffic can be sent or received until these
  275. parameters have been set again. Each EFI IPv4 Protocol instance can be started
  276. and stopped independently of each other by enabling or disabling their receive
  277. filter settings with the Configure() function.
  278. When IpConfigData.UseDefaultAddress is set to FALSE, the new station address will
  279. be appended as an alias address into the addresses list in the EFI IPv4 Protocol
  280. driver. While set to TRUE, Configure() will trigger the EFI_IP4_CONFIG_PROTOCOL
  281. to retrieve the default IPv4 address if it is not available yet. Clients could
  282. frequently call GetModeData() to check the status to ensure that the default IPv4
  283. address is ready.
  284. If operational parameters are reset or changed, any pending transmit and receive
  285. requests will be cancelled. Their completion token status will be set to EFI_ABORTED
  286. and their events will be signaled.
  287. @param This The pointer to the EFI_IP4_PROTOCOL instance.
  288. @param IpConfigData The pointer to the EFI IPv4 Protocol configuration data structure.
  289. @retval EFI_SUCCESS The driver instance was successfully opened.
  290. @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
  291. RARP, etc.) is not finished yet.
  292. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
  293. This is NULL.
  294. IpConfigData.StationAddress is not a unicast IPv4 address.
  295. IpConfigData.SubnetMask is not a valid IPv4 subnet
  296. @retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:
  297. A configuration protocol (DHCP, BOOTP, RARP, etc.) could
  298. not be located when clients choose to use the default IPv4
  299. address. This EFI IPv4 Protocol implementation does not
  300. support this requested filter or timeout setting.
  301. @retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.
  302. @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the
  303. IPv4 address or subnet mask can be changed. The interface must
  304. also be stopped when switching to/from raw packet mode.
  305. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4
  306. Protocol driver instance is not opened.
  307. **/
  308. typedef
  309. EFI_STATUS
  310. (EFIAPI *EFI_IP4_CONFIGURE)(
  311. IN EFI_IP4_PROTOCOL *This,
  312. IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL
  313. );
  314. /**
  315. Joins and leaves multicast groups.
  316. The Groups() function is used to join and leave multicast group sessions. Joining
  317. a group will enable reception of matching multicast packets. Leaving a group will
  318. disable the multicast packet reception.
  319. If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.
  320. @param This The pointer to the EFI_IP4_PROTOCOL instance.
  321. @param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
  322. @param GroupAddress The pointer to the IPv4 multicast address.
  323. @retval EFI_SUCCESS The operation completed successfully.
  324. @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
  325. - This is NULL.
  326. - JoinFlag is TRUE and GroupAddress is NULL.
  327. - GroupAddress is not NULL and *GroupAddress is
  328. not a multicast IPv4 address.
  329. @retval EFI_NOT_STARTED This instance has not been started.
  330. @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
  331. RARP, etc.) is not finished yet.
  332. @retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
  333. @retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.
  334. @retval EFI_ALREADY_STARTED The group address is already in the group table (when
  335. JoinFlag is TRUE).
  336. @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
  337. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  338. **/
  339. typedef
  340. EFI_STATUS
  341. (EFIAPI *EFI_IP4_GROUPS)(
  342. IN EFI_IP4_PROTOCOL *This,
  343. IN BOOLEAN JoinFlag,
  344. IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
  345. );
  346. /**
  347. Adds and deletes routing table entries.
  348. The Routes() function adds a route to or deletes a route from the routing table.
  349. Routes are determined by comparing the SubnetAddress with the destination IPv4
  350. address arithmetically AND-ed with the SubnetMask. The gateway address must be
  351. on the same subnet as the configured station address.
  352. The default route is added with SubnetAddress and SubnetMask both set to 0.0.0.0.
  353. The default route matches all destination IPv4 addresses that do not match any
  354. other routes.
  355. A GatewayAddress that is zero is a nonroute. Packets are sent to the destination
  356. IP address if it can be found in the ARP cache or on the local subnet. One automatic
  357. nonroute entry will be inserted into the routing table for outgoing packets that
  358. are addressed to a local subnet (gateway address of 0.0.0.0).
  359. Each EFI IPv4 Protocol instance has its own independent routing table. Those EFI
  360. IPv4 Protocol instances that use the default IPv4 address will also have copies
  361. of the routing table that was provided by the EFI_IP4_CONFIG_PROTOCOL, and these
  362. copies will be updated whenever the EIF IPv4 Protocol driver reconfigures its
  363. instances. As a result, client modification to the routing table will be lost.
  364. @param This The pointer to the EFI_IP4_PROTOCOL instance.
  365. @param DeleteRoute Set to TRUE to delete this route from the routing table. Set to
  366. FALSE to add this route to the routing table. SubnetAddress
  367. and SubnetMask are used as the key to each route entry.
  368. @param SubnetAddress The address of the subnet that needs to be routed.
  369. @param SubnetMask The subnet mask of SubnetAddress.
  370. @param GatewayAddress The unicast gateway IPv4 address for this route.
  371. @retval EFI_SUCCESS The operation completed successfully.
  372. @retval EFI_NOT_STARTED The driver instance has not been started.
  373. @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
  374. RARP, etc.) is not finished yet.
  375. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
  376. - This is NULL.
  377. - SubnetAddress is NULL.
  378. - SubnetMask is NULL.
  379. - GatewayAddress is NULL.
  380. - *SubnetAddress is not a valid subnet address.
  381. - *SubnetMask is not a valid subnet mask.
  382. - *GatewayAddress is not a valid unicast IPv4 address.
  383. @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
  384. @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
  385. @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
  386. DeleteRoute is FALSE).
  387. **/
  388. typedef
  389. EFI_STATUS
  390. (EFIAPI *EFI_IP4_ROUTES)(
  391. IN EFI_IP4_PROTOCOL *This,
  392. IN BOOLEAN DeleteRoute,
  393. IN EFI_IPv4_ADDRESS *SubnetAddress,
  394. IN EFI_IPv4_ADDRESS *SubnetMask,
  395. IN EFI_IPv4_ADDRESS *GatewayAddress
  396. );
  397. /**
  398. Places outgoing data packets into the transmit queue.
  399. The Transmit() function places a sending request in the transmit queue of this
  400. EFI IPv4 Protocol instance. Whenever the packet in the token is sent out or some
  401. errors occur, the event in the token will be signaled and the status is updated.
  402. @param This The pointer to the EFI_IP4_PROTOCOL instance.
  403. @param Token The pointer to the transmit token.
  404. @retval EFI_SUCCESS The data has been queued for transmission.
  405. @retval EFI_NOT_STARTED This instance has not been started.
  406. @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
  407. RARP, etc.) is not finished yet.
  408. @retval EFI_INVALID_PARAMETER One or more pameters are invalid.
  409. @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
  410. was already in the transmit queue.
  411. @retval EFI_NOT_READY The completion token could not be queued because the transmit
  412. queue is full.
  413. @retval EFI_NOT_FOUND Not route is found to destination address.
  414. @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
  415. @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
  416. short to transmit.
  417. @retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is
  418. greater than MTU (or greater than the maximum packet size if
  419. Token.Packet.TxData.OverrideData.
  420. DoNotFragment is TRUE.)
  421. **/
  422. typedef
  423. EFI_STATUS
  424. (EFIAPI *EFI_IP4_TRANSMIT)(
  425. IN EFI_IP4_PROTOCOL *This,
  426. IN EFI_IP4_COMPLETION_TOKEN *Token
  427. );
  428. /**
  429. Places a receiving request into the receiving queue.
  430. The Receive() function places a completion token into the receive packet queue.
  431. This function is always asynchronous.
  432. The Token.Event field in the completion token must be filled in by the caller
  433. and cannot be NULL. When the receive operation completes, the EFI IPv4 Protocol
  434. driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event
  435. is signaled.
  436. @param This The pointer to the EFI_IP4_PROTOCOL instance.
  437. @param Token The pointer to a token that is associated with the receive data descriptor.
  438. @retval EFI_SUCCESS The receive completion token was cached.
  439. @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
  440. @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, RARP, etc.)
  441. is not finished yet.
  442. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
  443. - This is NULL.
  444. - Token is NULL.
  445. - Token.Event is NULL.
  446. @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
  447. resources (usually memory).
  448. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  449. The EFI IPv4 Protocol instance has been reset to startup defaults.
  450. @retval EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already
  451. in the receive queue.
  452. @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
  453. @retval EFI_ICMP_ERROR An ICMP error packet was received.
  454. **/
  455. typedef
  456. EFI_STATUS
  457. (EFIAPI *EFI_IP4_RECEIVE)(
  458. IN EFI_IP4_PROTOCOL *This,
  459. IN EFI_IP4_COMPLETION_TOKEN *Token
  460. );
  461. /**
  462. Abort an asynchronous transmit or receive request.
  463. The Cancel() function is used to abort a pending transmit or receive request.
  464. If the token is in the transmit or receive request queues, after calling this
  465. function, Token->Status will be set to EFI_ABORTED and then Token->Event will
  466. be signaled. If the token is not in one of the queues, which usually means the
  467. asynchronous operation has completed, this function will not signal the token
  468. and EFI_NOT_FOUND is returned.
  469. @param This The pointer to the EFI_IP4_PROTOCOL instance.
  470. @param Token The pointer to a token that has been issued by
  471. EFI_IP4_PROTOCOL.Transmit() or
  472. EFI_IP4_PROTOCOL.Receive(). If NULL, all pending
  473. tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is
  474. defined in EFI_IP4_PROTOCOL.Transmit().
  475. @retval EFI_SUCCESS The asynchronous I/O request was aborted and
  476. Token->Event was signaled. When Token is NULL, all
  477. pending requests were aborted and their events were signaled.
  478. @retval EFI_INVALID_PARAMETER This is NULL.
  479. @retval EFI_NOT_STARTED This instance has not been started.
  480. @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
  481. RARP, etc.) is not finished yet.
  482. @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
  483. not found in the transmit or receive queue. It has either completed
  484. or was not issued by Transmit() and Receive().
  485. **/
  486. typedef
  487. EFI_STATUS
  488. (EFIAPI *EFI_IP4_CANCEL)(
  489. IN EFI_IP4_PROTOCOL *This,
  490. IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL
  491. );
  492. /**
  493. Polls for incoming data packets and processes outgoing data packets.
  494. The Poll() function polls for incoming data packets and processes outgoing data
  495. packets. Network drivers and applications can call the EFI_IP4_PROTOCOL.Poll()
  496. function to increase the rate that data packets are moved between the communications
  497. device and the transmit and receive queues.
  498. In some systems the periodic timer event may not poll the underlying communications
  499. device fast enough to transmit and/or receive all data packets without missing
  500. incoming packets or dropping outgoing packets. Drivers and applications that are
  501. experiencing packet loss should try calling the EFI_IP4_PROTOCOL.Poll() function
  502. more often.
  503. @param This The pointer to the EFI_IP4_PROTOCOL instance.
  504. @retval EFI_SUCCESS Incoming or outgoing data was processed.
  505. @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
  506. @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
  507. RARP, etc.) is not finished yet.
  508. @retval EFI_INVALID_PARAMETER This is NULL.
  509. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  510. @retval EFI_NOT_READY No incoming or outgoing data is processed.
  511. @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
  512. Consider increasing the polling rate.
  513. **/
  514. typedef
  515. EFI_STATUS
  516. (EFIAPI *EFI_IP4_POLL)(
  517. IN EFI_IP4_PROTOCOL *This
  518. );
  519. ///
  520. /// The EFI IPv4 Protocol implements a simple packet-oriented interface that can be
  521. /// used by drivers, daemons, and applications to transmit and receive network packets.
  522. ///
  523. struct _EFI_IP4_PROTOCOL {
  524. EFI_IP4_GET_MODE_DATA GetModeData;
  525. EFI_IP4_CONFIGURE Configure;
  526. EFI_IP4_GROUPS Groups;
  527. EFI_IP4_ROUTES Routes;
  528. EFI_IP4_TRANSMIT Transmit;
  529. EFI_IP4_RECEIVE Receive;
  530. EFI_IP4_CANCEL Cancel;
  531. EFI_IP4_POLL Poll;
  532. };
  533. extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid;
  534. extern EFI_GUID gEfiIp4ProtocolGuid;
  535. #endif