2 EBL commands for Network Devices
4 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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
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.
21 OUT EFI_IP_ADDRESS
*Address
24 Address
->v4
.Addr
[0] = (UINT8
)AsciiStrDecimalToUintn (String
);
25 String
= AsciiStrStr(String
, ".") + 1;
26 Address
->v4
.Addr
[1] = (UINT8
)AsciiStrDecimalToUintn (String
);
27 String
= AsciiStrStr(String
, ".") + 1;
28 Address
->v4
.Addr
[2] = (UINT8
)AsciiStrDecimalToUintn (String
);
29 String
= AsciiStrStr(String
, ".") + 1;
30 Address
->v4
.Addr
[3] = (UINT8
)AsciiStrDecimalToUintn (String
);
41 EFI_STATUS Status
= EFI_INVALID_PARAMETER
;
48 // Get current MAC address
49 Status
= EblGetCurrentMacAddress (&Mac
);
50 if (EFI_ERROR (Status
)) {
54 AsciiPrint ("MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n", Mac
.Addr
[0], Mac
.Addr
[1], Mac
.Addr
[2], Mac
.Addr
[3], Mac
.Addr
[4], Mac
.Addr
[5]);
56 // Get current IP address
57 Status
= EblGetCurrentIpAddress (&Ip
);
58 if (EFI_ERROR(Status
)) {
59 AsciiPrint("IP Address is not configured.\n");
64 AsciiPrint("IP Address: %d.%d.%d.%d\n", Ip
.v4
.Addr
[0], Ip
.v4
.Addr
[1],Ip
.v4
.Addr
[2], Ip
.v4
.Addr
[3]);
66 } else if ((Argv
[1][0] == 'r') && (Argc
== 2)) {
67 // Get new address via dhcp
68 Status
= EblPerformDHCP (TRUE
);
69 } else if ((Argv
[1][0] == 's') && (Argc
== 3)) {
71 Status
= ParseIp (Argv
[2], &Ip
);
72 if (EFI_ERROR (Status
)) {
76 Status
= EblSetStationIp (&Ip
, NULL
);
83 GLOBAL_REMOVE_IF_UNREFERENCED
const EBL_COMMAND_TABLE mCmdNetworkTemplate
[] =
87 " ; print current ip address\n\r [r]; request DHCP address\n\r [s] ipaddr; set static IP address",
95 Initialize the commands in this in this file
98 EblInitializeNetworkCmd (
102 EblAddCommands (mCmdNetworkTemplate
, sizeof (mCmdNetworkTemplate
)/sizeof (EBL_COMMAND_TABLE
));