1 /** @file
2   Dhcp6 internal functions declaration.
3 
4   Copyright (c) 2009 - 2012, 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_DHCP6_IO_H__
17 #define __EFI_DHCP6_IO_H__
18 
19 
20 /**
21   Clean up the specific nodes in the retry list.
22 
23   @param[in]  Instance        The pointer to the Dhcp6 instance.
24   @param[in]  Scope           The scope of cleanup nodes.
25 
26 **/
27 VOID
28 Dhcp6CleanupRetry (
29   IN DHCP6_INSTANCE         *Instance,
30   IN UINT32                 Scope
31   );
32 
33 /**
34   Clean up the session of the instance stateful exchange.
35 
36   @param[in, out]  Instance        The pointer to the Dhcp6 instance.
37   @param[in]       Status          The return status from udp.
38 
39 **/
40 VOID
41 Dhcp6CleanupSession (
42   IN OUT DHCP6_INSTANCE          *Instance,
43   IN     EFI_STATUS              Status
44   );
45 
46 /**
47   Create the solicit message and send it.
48 
49   @param[in]  Instance        The pointer to Dhcp6 instance.
50 
51   @retval EFI_SUCCESS           Create and send the solicit message successfully.
52   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
53   @retval Others                Failed to send the solicit message.
54 
55 **/
56 EFI_STATUS
57 Dhcp6SendSolicitMsg (
58   IN DHCP6_INSTANCE         *Instance
59   );
60 
61 /**
62   Create the request message and send it.
63 
64   @param[in]  Instance        The pointer to the Dhcp6 instance.
65 
66   @retval EFI_SUCCESS           Create and send the request message successfully.
67   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
68   @retval EFI_DEVICE_ERROR      An unexpected error.
69   @retval Others                Failed to send the request message.
70 
71 **/
72 EFI_STATUS
73 Dhcp6SendRequestMsg (
74   IN DHCP6_INSTANCE         *Instance
75   );
76 
77 /**
78   Create the renew/rebind message and send it.
79 
80   @param[in]  Instance        The pointer to the Dhcp6 instance.
81   @param[in]  RebindRequest   If TRUE, it is a Rebind type message.
82                               Otherwise, it is a Renew type message.
83 
84   @retval EFI_SUCCESS           Create and send the renew/rebind message successfully.
85   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
86   @retval EFI_DEVICE_ERROR      An unexpected error.
87   @retval Others                Failed to send the renew/rebind message.
88 
89 **/
90 EFI_STATUS
91 Dhcp6SendRenewRebindMsg (
92   IN DHCP6_INSTANCE         *Instance,
93   IN BOOLEAN                RebindRequest
94   );
95 
96 /**
97   Create the decline message and send it.
98 
99   @param[in]  Instance        The pointer to the Dhcp6 instance.
100   @param[in]  DecIa           The pointer to the decline Ia.
101 
102   @retval EFI_SUCCESS           Create and send the decline message successfully.
103   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
104   @retval EFI_DEVICE_ERROR      An unexpected error.
105   @retval Others                Failed to send the decline message.
106 
107 **/
108 EFI_STATUS
109 Dhcp6SendDeclineMsg (
110   IN DHCP6_INSTANCE            *Instance,
111   IN EFI_DHCP6_IA              *DecIa
112   );
113 
114 /**
115   Create the release message and send it.
116 
117   @param[in]  Instance        The pointer to the Dhcp6 instance.
118   @param[in]  RelIa           The pointer to the release Ia.
119 
120   @retval EFI_SUCCESS           Create and send the release message successfully.
121   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
122   @retval EFI_DEVICE_ERROR      An unexpected error.
123   @retval Others                Failed to send the release message.
124 
125 **/
126 EFI_STATUS
127 Dhcp6SendReleaseMsg (
128   IN DHCP6_INSTANCE            *Instance,
129   IN EFI_DHCP6_IA              *RelIa
130   );
131 
132 /**
133   Start the information request process.
134 
135   @param[in]  Instance          The pointer to the Dhcp6 instance.
136   @param[in]  SendClientId      If TRUE, the client identifier option will be included in
137                                 information request message. Otherwise, the client identifier
138                                 option will not be included.
139   @param[in]  OptionRequest     The pointer to the option request option.
140   @param[in]  OptionCount       The number options in the OptionList.
141   @param[in]  OptionList        The array pointers to the appended options.
142   @param[in]  Retransmission    The pointer to the retransmission control.
143   @param[in]  TimeoutEvent      The event of timeout.
144   @param[in]  ReplyCallback     The callback function when the reply was received.
145   @param[in]  CallbackContext   The pointer to the parameter passed to the callback.
146 
147   @retval EFI_SUCCESS           Start the info-request process successfully.
148   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
149   @retval EFI_NO_MAPPING        No source address is available for use.
150   @retval Others                Failed to start the info-request process.
151 
152 **/
153 EFI_STATUS
154 Dhcp6StartInfoRequest (
155   IN DHCP6_INSTANCE            *Instance,
156   IN BOOLEAN                   SendClientId,
157   IN EFI_DHCP6_PACKET_OPTION   *OptionRequest,
158   IN UINT32                    OptionCount,
159   IN EFI_DHCP6_PACKET_OPTION   *OptionList[]    OPTIONAL,
160   IN EFI_DHCP6_RETRANSMISSION  *Retransmission,
161   IN EFI_EVENT                 TimeoutEvent     OPTIONAL,
162   IN EFI_DHCP6_INFO_CALLBACK   ReplyCallback,
163   IN VOID                      *CallbackContext OPTIONAL
164   );
165 
166 /**
167   Create the information request message and send it.
168 
169   @param[in]  Instance        The pointer to the Dhcp6 instance.
170   @param[in]  InfCb           The pointer to the information request control block.
171   @param[in]  SendClientId    If TRUE, the client identifier option will be included in
172                               information request message. Otherwise, the client identifier
173                               option will not be included.
174   @param[in]  OptionRequest   The pointer to the option request option.
175   @param[in]  OptionCount     The number options in the OptionList.
176   @param[in]  OptionList      The array pointers to the appended options.
177   @param[in]  Retransmission  The pointer to the retransmission control.
178 
179   @retval EFI_SUCCESS           Create and send the info-request message successfully.
180   @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.
181   @retval Others                Failed to send the info-request message.
182 
183 **/
184 EFI_STATUS
185 Dhcp6SendInfoRequestMsg (
186   IN DHCP6_INSTANCE            *Instance,
187   IN DHCP6_INF_CB              *InfCb,
188   IN BOOLEAN                   SendClientId,
189   IN EFI_DHCP6_PACKET_OPTION   *OptionRequest,
190   IN UINT32                    OptionCount,
191   IN EFI_DHCP6_PACKET_OPTION   *OptionList[],
192   IN EFI_DHCP6_RETRANSMISSION  *Retransmission
193   );
194 
195 /**
196   The receive callback function for the Dhcp6 exchange process.
197 
198   @param[in]  Udp6Wrap        The pointer to the received net buffer.
199   @param[in]  EndPoint        The pointer to the udp end point.
200   @param[in]  IoStatus        The return status from udp io.
201   @param[in]  Context         The opaque parameter to the function.
202 
203 **/
204 VOID
205 EFIAPI
206 Dhcp6ReceivePacket (
207   IN NET_BUF                *Udp6Wrap,
208   IN UDP_END_POINT          *EndPoint,
209   IN EFI_STATUS             IoStatus,
210   IN VOID                   *Context
211   );
212 
213 /**
214   The timer routine of the Dhcp6 instance for each second.
215 
216   @param[in]  Event           The timer event.
217   @param[in]  Context         The opaque parameter to the function.
218 
219 **/
220 VOID
221 EFIAPI
222 Dhcp6OnTimerTick (
223   IN EFI_EVENT              Event,
224   IN VOID                   *Context
225   );
226 
227 #endif
228