+++ /dev/null
-/** @file\r
- EBL commands for Network Devices\r
-\r
- Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
- (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
-\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "Ebl.h"\r
-\r
-EFI_STATUS\r
-ParseIp (\r
- IN CHAR8 *String,\r
- OUT EFI_IP_ADDRESS *Address\r
- )\r
-{\r
- Address->v4.Addr[0] = (UINT8)AsciiStrDecimalToUintn (String);\r
- String = AsciiStrStr(String, ".") + 1;\r
- Address->v4.Addr[1] = (UINT8)AsciiStrDecimalToUintn (String);\r
- String = AsciiStrStr(String, ".") + 1;\r
- Address->v4.Addr[2] = (UINT8)AsciiStrDecimalToUintn (String);\r
- String = AsciiStrStr(String, ".") + 1;\r
- Address->v4.Addr[3] = (UINT8)AsciiStrDecimalToUintn (String);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-EblIpCmd (\r
- IN UINTN Argc,\r
- IN CHAR8 **Argv\r
- )\r
-{\r
- EFI_STATUS Status = EFI_INVALID_PARAMETER;\r
- EFI_MAC_ADDRESS Mac;\r
- EFI_IP_ADDRESS Ip;\r
-\r
- if (Argc == 1) {\r
- // Get current IP/MAC\r
-\r
- // Get current MAC address\r
- Status = EblGetCurrentMacAddress (&Mac);\r
- if (EFI_ERROR (Status)) {\r
- goto Exit;\r
- }\r
-\r
- 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]);\r
-\r
- // Get current IP address\r
- Status = EblGetCurrentIpAddress (&Ip);\r
- if (EFI_ERROR(Status)) {\r
- AsciiPrint("IP Address is not configured.\n");\r
- Status = EFI_SUCCESS;\r
- goto Exit;\r
- }\r
-\r
- AsciiPrint("IP Address: %d.%d.%d.%d\n", Ip.v4.Addr[0], Ip.v4.Addr[1],Ip.v4.Addr[2], Ip.v4.Addr[3]);\r
-\r
- } else if ((Argv[1][0] == 'r') && (Argc == 2)) {\r
- // Get new address via dhcp\r
- Status = EblPerformDHCP (TRUE);\r
- } else if ((Argv[1][0] == 's') && (Argc == 3)) {\r
- // Set static IP\r
- Status = ParseIp (Argv[2], &Ip);\r
- if (EFI_ERROR (Status)) {\r
- goto Exit;\r
- }\r
-\r
- Status = EblSetStationIp (&Ip, NULL);\r
- }\r
-\r
-Exit:\r
- return Status;\r
-}\r
-\r
-GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdNetworkTemplate[] =\r
-{\r
- {\r
- "ip",\r
- " ; print current ip address\n\r [r]; request DHCP address\n\r [s] ipaddr; set static IP address",\r
- NULL,\r
- EblIpCmd\r
- }\r
-};\r
-\r
-\r
-/**\r
- Initialize the commands in this in this file\r
-**/\r
-VOID\r
-EblInitializeNetworkCmd (\r
- VOID\r
- )\r
-{\r
- EblAddCommands (mCmdNetworkTemplate, sizeof (mCmdNetworkTemplate)/sizeof (EBL_COMMAND_TABLE));\r
-}\r
-\r