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