1 /** @file
2   Support routines for PxeBc.
3 Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 **/
13 
14 #ifndef __EFI_PXEBC_SUPPORT_H__
15 #define __EFI_PXEBC_SUPPORT_H__
16 
17 
18 /**
19   The common notify function associated with various PxeBc events.
20 
21   @param  Event     The event signaled.
22   @param  Context   The context.
23 
24 **/
25 VOID
26 EFIAPI
27 PxeBcCommonNotify (
28   IN EFI_EVENT           Event,
29   IN VOID                *Context
30   );
31 
32 
33 /**
34   This function initialize(or configure) the Udp4Write instance.
35 
36   @param  Udp4       Pointer to the EFI_UDP4_PROTOCOL instance.
37   @param  StationIp  Pointer to the station ip address.
38   @param  SubnetMask Pointer to the subnetmask of the station ip address.
39   @param  Gateway    Pointer to the gateway ip address.
40   @param  SrcPort    Pointer to the srouce port of the station.
41 
42   @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.
43   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,
44                                 RARP, etc.) is not finished yet.
45   @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
46   @retval EFI_ALREADY_STARTED   The EFI UDPv4 Protocol instance is already started/configured
47                                 and must be stopped/reset before it can be reconfigured.
48   @retval EFI_ACCESS_DENIED     UdpConfigData. AllowDuplicatePort is FALSE
49                                 and UdpConfigData.StationPort is already used by
50                                 other instance.
51   @retval EFI_OUT_OF_RESOURCES  The EFI UDPv4 Protocol driver cannot allocate memory for this
52                                 EFI UDPv4 Protocol instance.
53   @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred and this instance
54                                 was not opened.
55   @retval Others                Please examine the function Udp4->Routes(Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway) returns.
56 
57 **/
58 EFI_STATUS
59 PxeBcConfigureUdpWriteInstance (
60   IN EFI_UDP4_PROTOCOL  *Udp4,
61   IN EFI_IPv4_ADDRESS   *StationIp,
62   IN EFI_IPv4_ADDRESS   *SubnetMask,
63   IN EFI_IPv4_ADDRESS   *Gateway,
64   IN OUT UINT16         *SrcPort
65   );
66 /**
67   Convert number to ASCII value.
68 
69   @param  Number              Numeric value to convert to decimal ASCII value.
70   @param  Buffer              Buffer to place ASCII version of the Number.
71   @param  Length              Length of Buffer.
72 
73 **/
74 VOID
75 CvtNum (
76   IN UINTN  Number,
77   IN UINT8  *Buffer,
78   IN UINTN   Length
79   );
80 
81 
82 /**
83   Convert unsigned int number to decimal number.
84 
85   @param      Number         The unsigned int number will be converted.
86   @param      Buffer         Pointer to the buffer to store the decimal number after transform.
87   @param[in]  BufferSize     The maxsize of the buffer.
88 
89   @return the length of the number after transform.
90 
91 **/
92 UINTN
93 UtoA10 (
94   IN UINTN Number,
95   IN CHAR8 *Buffer,
96   IN UINTN BufferSize
97 
98   );
99 
100 
101 /**
102   Convert ASCII numeric string to a UINTN value.
103 
104   @param  Buffer  Pointer to the 8-byte unsigned int value.
105 
106   @return UINTN value of the ASCII string.
107 
108 **/
109 UINT64
110 AtoU64 (
111   IN UINT8 *Buffer
112   );
113 
114 
115 #endif
116 
117