• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Support routines for PxeBc.
3 Copyright (c) 2007 - 2016, 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   @param  Ttl        The time to live field of the IP header.
42   @param  ToS        The type of service field of the IP header.
43 
44   @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.
45   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,
46                                 RARP, etc.) is not finished yet.
47   @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
48   @retval EFI_ALREADY_STARTED   The EFI UDPv4 Protocol instance is already started/configured
49                                 and must be stopped/reset before it can be reconfigured.
50   @retval EFI_ACCESS_DENIED     UdpConfigData. AllowDuplicatePort is FALSE
51                                 and UdpConfigData.StationPort is already used by
52                                 other instance.
53   @retval EFI_OUT_OF_RESOURCES  The EFI UDPv4 Protocol driver cannot allocate memory for this
54                                 EFI UDPv4 Protocol instance.
55   @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred and this instance
56                                 was not opened.
57   @retval Others                Please examine the function Udp4->Routes(Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway) returns.
58 
59 **/
60 EFI_STATUS
61 PxeBcConfigureUdpWriteInstance (
62   IN EFI_UDP4_PROTOCOL  *Udp4,
63   IN EFI_IPv4_ADDRESS   *StationIp,
64   IN EFI_IPv4_ADDRESS   *SubnetMask,
65   IN EFI_IPv4_ADDRESS   *Gateway,
66   IN OUT UINT16         *SrcPort,
67   IN     UINT8          Ttl,
68   IN     UINT8          ToS
69   );
70 /**
71   Convert number to ASCII value.
72 
73   @param  Number              Numeric value to convert to decimal ASCII value.
74   @param  Buffer              Buffer to place ASCII version of the Number.
75   @param  Length              Length of Buffer.
76 
77 **/
78 VOID
79 CvtNum (
80   IN UINTN  Number,
81   IN UINT8  *Buffer,
82   IN UINTN   Length
83   );
84 
85 
86 /**
87   Convert unsigned int number to decimal number.
88 
89   @param      Number         The unsigned int number will be converted.
90   @param      Buffer         Pointer to the buffer to store the decimal number after transform.
91   @param[in]  BufferSize     The maxsize of the buffer.
92 
93   @return the length of the number after transform.
94 
95 **/
96 UINTN
97 UtoA10 (
98   IN UINTN Number,
99   IN CHAR8 *Buffer,
100   IN UINTN BufferSize
101 
102   );
103 
104 
105 /**
106   Convert ASCII numeric string to a UINTN value.
107 
108   @param  Buffer  Pointer to the 8-byte unsigned int value.
109 
110   @return UINTN value of the ASCII string.
111 
112 **/
113 UINT64
114 AtoU64 (
115   IN UINT8 *Buffer
116   );
117 
118 
119 #endif
120 
121