1 /** @file
2   The internal functions and routines to transmit the IP6 packet.
3 
4   Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
5 
6   SPDX-License-Identifier: BSD-2-Clause-Patent
7 
8 **/
9 
10 #ifndef __EFI_IP6_OUTPUT_H__
11 #define __EFI_IP6_OUTPUT_H__
12 
13 extern UINT32 mIp6Id;
14 
15 /**
16   Output all the available source addresses to the list entry head SourceList. The
17   number of source addresses are also returned.
18 
19   @param[in]       IpSb             Points to a IP6 service binding instance.
20   @param[in]       Destination      The IPv6 destination address.
21   @param[out]      Source           The selected IPv6 source address according to
22                                     the Destination.
23 
24   @retval EFI_SUCCESS           The source addresses were copied to the list entry
25                                 head SourceList.
26   @retval EFI_NO_MAPPING        The IPv6 stack is not auto configured.
27 
28 **/
29 EFI_STATUS
30 Ip6SelectSourceAddress (
31   IN IP6_SERVICE            *IpSb,
32   IN EFI_IPv6_ADDRESS       *Destination,
33   OUT EFI_IPv6_ADDRESS      *Source
34   );
35 
36 /**
37   The default callback function for system generated packet.
38   It will free the packet.
39 
40   @param[in]  Packet        The packet that transmitted.
41   @param[in]  IoStatus      The result of the transmission: succeeded or failed.
42   @param[in]  LinkFlag      Not used when transmission. Check IP6_FRAME_CALLBACK
43                             for reference.
44   @param[in]  Context       The context provided by us.
45 
46 **/
47 VOID
48 Ip6SysPacketSent (
49   NET_BUF                   *Packet,
50   EFI_STATUS                IoStatus,
51   UINT32                    LinkFlag,
52   VOID                      *Context
53   );
54 
55 /**
56   Transmit an IP6 packet. The packet comes either from the IP6
57   child's consumer (IpInstance != NULL) or the IP6 driver itself
58   (IpInstance == NULL). It will route the packet, fragment it,
59   then transmit all the fragments through an interface.
60 
61   @param[in]  IpSb             The IP6 service instance to transmit the packet.
62   @param[in]  Interface        The IP6 interface to transmit the packet. Ignored
63                                if NULL.
64   @param[in]  IpInstance       The IP6 child that issues the transmission.  It is
65                                NULL if the packet is from the system.
66   @param[in]  Packet           The user data to send, excluding the IP header.
67   @param[in]  Head             The caller supplied header. The caller should set
68                                the  following header fields: NextHeader, HopLimit,
69                                Src, Dest, FlowLabel, PayloadLength. This function
70                                will fill in the Ver, TrafficClass.
71   @param[in]  ExtHdrs          The extension headers to append to the IPv6 basic
72                                header.
73   @param[in]  ExtHdrsLen       The length of the extension headers.
74   @param[in]  Callback         The callback function to issue when transmission
75                                completed.
76   @param[in]  Context          The opaque context for the callback.
77 
78   @retval EFI_INVALID_PARAMETER Any input parameter or the packet is invalid.
79   @retval EFI_NO_MAPPING        There is no interface to the destination.
80   @retval EFI_NOT_FOUND         There is no route to the destination.
81   @retval EFI_SUCCESS           The packet successfully transmitted.
82   @retval EFI_OUT_OF_RESOURCES  Failed to finish the operation due to lack of
83                                 resources.
84   @retval Others                Failed to transmit the packet.
85 
86 **/
87 EFI_STATUS
88 Ip6Output (
89   IN IP6_SERVICE            *IpSb,
90   IN IP6_INTERFACE          *Interface   OPTIONAL,
91   IN IP6_PROTOCOL           *IpInstance  OPTIONAL,
92   IN NET_BUF                *Packet,
93   IN EFI_IP6_HEADER         *Head,
94   IN UINT8                  *ExtHdrs,
95   IN UINT32                 ExtHdrsLen,
96   IN IP6_FRAME_CALLBACK     Callback,
97   IN VOID                   *Context
98   );
99 
100 /**
101   Remove all the frames on the interface that pass the FrameToCancel,
102   either queued on ARP queues, or that have already been delivered to
103   MNP and not yet recycled.
104 
105   @param[in]  Interface     Interface to remove the frames from.
106   @param[in]  IoStatus      The transmit status returned to the frames' callback.
107   @param[in]  FrameToCancel Function to select the frame to cancel; NULL to select all.
108   @param[in]  Context       Opaque parameters passed to FrameToCancel. Ignored if
109                             FrameToCancel is NULL.
110 
111 **/
112 VOID
113 Ip6CancelFrames (
114   IN IP6_INTERFACE          *Interface,
115   IN EFI_STATUS             IoStatus,
116   IN IP6_FRAME_TO_CANCEL    FrameToCancel   OPTIONAL,
117   IN VOID                   *Context        OPTIONAL
118   );
119 
120 /**
121   Cancel the Packet and all its fragments.
122 
123   @param[in]  IpIf                 The interface from which the Packet is sent.
124   @param[in]  Packet               The Packet to cancel.
125   @param[in]  IoStatus             The status returns to the sender.
126 
127 **/
128 VOID
129 Ip6CancelPacket (
130   IN IP6_INTERFACE    *IpIf,
131   IN NET_BUF          *Packet,
132   IN EFI_STATUS       IoStatus
133   );
134 
135 #endif
136