add security check.
[edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcSupport.h
blobb006e38042cc05d794ac84c025dddcfde6de89f9
1 /** @file
2 Support routines for PxeBc.
3 Copyright (c) 2007 - 2009, Intel Corporation.<BR>
4 All rights reserved. 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
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.
12 **/
14 #ifndef __EFI_PXEBC_SUPPORT_H__
15 #define __EFI_PXEBC_SUPPORT_H__
17 /**
18 This function gets system guid and serial number from the smbios table.
20 @param SystemGuid The pointer of returned system guid.
21 @param SystemSerialNumber The pointer of returned system serial number.
23 @retval EFI_SUCCESS Successfully get the system guid and system serial
24 number.
25 @retval EFI_NOT_FOUND Not find the SMBIOS table.
27 **/
28 EFI_STATUS
29 GetSmbiosSystemGuidAndSerialNumber (
30 IN EFI_GUID *SystemGuid,
31 OUT CHAR8 **SystemSerialNumber
35 /**
36 The common notify function associated with various PxeBc events.
38 @param Event The event signaled.
39 @param Context The context.
41 **/
42 VOID
43 EFIAPI
44 PxeBcCommonNotify (
45 IN EFI_EVENT Event,
46 IN VOID *Context
50 /**
51 This function initialize(or configure) the Udp4Write instance.
53 @param Udp4 Pointer to the EFI_UDP4_PROTOCOL instance.
54 @param StationIp Pointer to the station ip address.
55 @param SubnetMask Pointer to the subnetmask of the station ip address.
56 @param Gateway Pointer to the gateway ip address.
57 @param SrcPort Pointer to the srouce port of the station.
59 @retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully.
60 @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
61 RARP, etc.) is not finished yet.
62 @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
63 @retval EFI_ALREADY_STARTED The EFI UDPv4 Protocol instance is already started/configured
64 and must be stopped/reset before it can be reconfigured.
65 @retval EFI_ACCESS_DENIED UdpConfigData. AllowDuplicatePort is FALSE
66 and UdpConfigData.StationPort is already used by
67 other instance.
68 @retval EFI_OUT_OF_RESOURCES The EFI UDPv4 Protocol driver cannot allocate memory for this
69 EFI UDPv4 Protocol instance.
70 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred and this instance
71 was not opened.
72 @retval Others Please examine the function Udp4->Routes(Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway) returns.
74 **/
75 EFI_STATUS
76 PxeBcConfigureUdpWriteInstance (
77 IN EFI_UDP4_PROTOCOL *Udp4,
78 IN EFI_IPv4_ADDRESS *StationIp,
79 IN EFI_IPv4_ADDRESS *SubnetMask,
80 IN EFI_IPv4_ADDRESS *Gateway,
81 IN OUT UINT16 *SrcPort
83 /**
84 Convert number to ASCII value.
86 @param Number Numeric value to convert to decimal ASCII value.
87 @param Buffer Buffer to place ASCII version of the Number.
88 @param Length Length of Buffer.
90 **/
91 VOID
92 CvtNum (
93 IN UINTN Number,
94 IN UINT8 *Buffer,
95 IN UINTN Length
99 /**
100 Convert unsigned int number to decimal number.
102 @param Number The unsigned int number will be converted.
103 @param Buffer Pointer to the buffer to store the decimal number after transform.
105 @return the length of the number after transform.
108 UINTN
109 UtoA10 (
110 IN UINTN Number,
111 IN CHAR8 *Buffer
116 Convert ASCII numeric string to a UINTN value.
118 @param Buffer Pointer to the 8-byte unsigned int value.
120 @return UINTN value of the ASCII string.
123 UINT64
124 AtoU64 (
125 IN UINT8 *Buffer
129 #endif