Ip4Output.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /** @file
  2. Copyright (c) 2005 - 2006, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. #ifndef __EFI_IP4_OUTPUT_H__
  6. #define __EFI_IP4_OUTPUT_H__
  7. /**
  8. The default callback function for system generated packet.
  9. It will free the packet.
  10. @param Ip4Instance The IP4 child that issued the transmission. It most
  11. like is NULL.
  12. @param Packet The packet that transmitted.
  13. @param IoStatus The result of the transmission, succeeded or failed.
  14. @param LinkFlag Not used when transmission. check IP4_FRAME_CALLBACK
  15. for reference.
  16. @param Context The context provided by us
  17. **/
  18. VOID
  19. Ip4SysPacketSent (
  20. IP4_PROTOCOL *Ip4Instance,
  21. NET_BUF *Packet,
  22. EFI_STATUS IoStatus,
  23. UINT32 LinkFlag,
  24. VOID *Context
  25. );
  26. /**
  27. Transmit an IP4 packet. The packet comes either from the IP4
  28. child's consumer (IpInstance != NULL) or the IP4 driver itself
  29. (IpInstance == NULL). It will route the packet, fragment it,
  30. then transmit all the fragments through some interface.
  31. @param[in] IpSb The IP4 service instance to transmit the packet
  32. @param[in] IpInstance The IP4 child that issues the transmission. It is
  33. NULL if the packet is from the system.
  34. @param[in] Packet The user data to send, excluding the IP header.
  35. @param[in] Head The caller supplied header. The caller should set
  36. the following header fields: Tos, TotalLen, Id, tl,
  37. Fragment, Protocol, Src and Dst. All the fields are
  38. in host byte order. This function will fill in the
  39. Ver, HeadLen, Fragment, and checksum. The Fragment
  40. only need to include the DF flag. Ip4Output will
  41. compute the MF and offset for you.
  42. @param[in] Option The original option to append to the IP headers
  43. @param[in] OptLen The length of the option
  44. @param[in] GateWay The next hop address to transmit packet to.
  45. 255.255.255.255 means broadcast.
  46. @param[in] Callback The callback function to issue when transmission
  47. completed.
  48. @param[in] Context The opaque context for the callback
  49. @retval EFI_NO_MAPPING There is no interface to the destination.
  50. @retval EFI_NOT_FOUND There is no route to the destination
  51. @retval EFI_SUCCESS The packet is successfully transmitted.
  52. @retval Others Failed to transmit the packet.
  53. **/
  54. EFI_STATUS
  55. Ip4Output (
  56. IN IP4_SERVICE *IpSb,
  57. IN IP4_PROTOCOL *IpInstance OPTIONAL,
  58. IN NET_BUF *Packet,
  59. IN IP4_HEAD *Head,
  60. IN UINT8 *Option,
  61. IN UINT32 OptLen,
  62. IN IP4_ADDR GateWay,
  63. IN IP4_FRAME_CALLBACK Callback,
  64. IN VOID *Context
  65. );
  66. /**
  67. Cancel the Packet and all its fragments.
  68. @param IpIf The interface from which the Packet is sent
  69. @param Packet The Packet to cancel
  70. @param IoStatus The status returns to the sender.
  71. **/
  72. VOID
  73. Ip4CancelPacket (
  74. IN IP4_INTERFACE *IpIf,
  75. IN NET_BUF *Packet,
  76. IN EFI_STATUS IoStatus
  77. );
  78. /**
  79. Prepend an IP4 head to the Packet. It will copy the options and
  80. build the IP4 header fields. Used for IP4 fragmentation.
  81. @param Packet The packet to prepend IP4 header to
  82. @param Head The caller supplied header. The caller should set
  83. the following header fields: Tos, TotalLen, Id,
  84. Fragment, Ttl, Protocol, Src and Dst. All the fields
  85. are in host byte order. This function will fill in
  86. the Ver, HeadLen, and checksum.
  87. @param Option The original IP4 option to copy from
  88. @param OptLen The length of the IP4 option
  89. @retval EFI_BAD_BUFFER_SIZE There is no enough room in the head space of
  90. Packet.
  91. @retval EFI_SUCCESS The IP4 header is successfully added to the packet.
  92. **/
  93. EFI_STATUS
  94. Ip4PrependHead (
  95. IN OUT NET_BUF *Packet,
  96. IN IP4_HEAD *Head,
  97. IN UINT8 *Option,
  98. IN UINT32 OptLen
  99. );
  100. extern UINT16 mIp4Id;
  101. #endif