TianoCore EDK2 master
Loading...
Searching...
No Matches
Ifconfig.c File Reference

Go to the source code of this file.

Data Structures

struct  _IFCONFIG_INTERFACE_CB
 
struct  _ARG_LIST
 
struct  _IFCONFIG4_PRIVATE_DATA
 
struct  _VAR_CHECK_ITEM
 

Macros

#define MACADDRMAXSIZE   32
 

Typedefs

typedef struct _IFCONFIG_INTERFACE_CB IFCONFIG_INTERFACE_CB
 
typedef struct _ARG_LIST ARG_LIST
 
typedef struct _IFCONFIG4_PRIVATE_DATA IFCONFIG_PRIVATE_DATA
 
typedef struct _VAR_CHECK_ITEM VAR_CHECK_ITEM
 

Enumerations

enum  IFCONFIG_OPCODE { IfConfigOpList = 1 , IfConfigOpSet = 2 , IfConfigOpClear = 3 }
 
enum  VAR_CHECK_CODE {
  VarCheckReserved = -1 , VarCheckOk = 0 , VarCheckDuplicate , VarCheckConflict ,
  VarCheckUnknown , VarCheckLackValue , VarCheckOutOfMem , VarCheckReserved = -1 ,
  VarCheckOk = 0 , VarCheckDuplicate , VarCheckConflict , VarCheckUnknown ,
  VarCheckLackValue , VarCheckOutOfMem
}
 
enum  VAR_CHECK_FLAG_TYPE {
  FlagTypeSingle = 0 , FlagTypeNeedVar , FlagTypeNeedSet , FlagTypeSkipUnknown ,
  FlagTypeSingle = 0 , FlagTypeNeedVar , FlagTypeNeedSet , FlagTypeSkipUnknown
}
 

Functions

VOID FreeArgList (ARG_LIST *List)
 
ARG_LISTSplitStrToList (IN CONST CHAR16 *String, IN CHAR16 Separator)
 
VAR_CHECK_CODE IfConfigRetriveCheckListByName (IN VAR_CHECK_ITEM *CheckList, IN CHAR16 *Name, IN BOOLEAN Init)
 
VOID EFIAPI IfConfigManualAddressNotify (IN EFI_EVENT Event, IN VOID *Context)
 
VOID IfConfigPrintMacAddr (IN UINT8 *Node, IN UINT32 Size)
 
EFI_STATUS IfConfigGetInterfaceInfo (IN CHAR16 *IfName, IN LIST_ENTRY *IfList)
 
SHELL_STATUS IfConfigShowInterfaceInfo (IN LIST_ENTRY *IfList)
 
SHELL_STATUS IfConfigClearInterfaceInfo (IN LIST_ENTRY *IfList, IN CHAR16 *IfName)
 
SHELL_STATUS IfConfigSetInterfaceInfo (IN LIST_ENTRY *IfList, IN ARG_LIST *VarArg)
 
SHELL_STATUS IfConfig (IN IFCONFIG_PRIVATE_DATA *Private)
 
VOID IfConfigCleanup (IN IFCONFIG_PRIVATE_DATA *Private)
 
SHELL_STATUS EFIAPI ShellCommandRunIfconfig (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

SHELL_PARAM_ITEM mIfConfigCheckList []
 
VAR_CHECK_ITEM mSetCheckList []
 
STATIC CONST CHAR16 PermanentString [10] = L"PERMANENT"
 

Detailed Description

The implementation for Shell command ifconfig based on IP4Config2 protocol.

(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Ifconfig.c.

Macro Definition Documentation

◆ MACADDRMAXSIZE

#define MACADDRMAXSIZE   32

Definition at line 36 of file Ifconfig.c.

Typedef Documentation

◆ ARG_LIST

typedef struct _ARG_LIST ARG_LIST

Definition at line 48 of file Ifconfig.c.

Enumeration Type Documentation

◆ IFCONFIG_OPCODE

enum IFCONFIG_OPCODE

Definition at line 13 of file Ifconfig.c.

◆ VAR_CHECK_CODE

enum VAR_CHECK_CODE

Definition at line 19 of file Ifconfig.c.

◆ VAR_CHECK_FLAG_TYPE

enum VAR_CHECK_FLAG_TYPE

Definition at line 29 of file Ifconfig.c.

Function Documentation

◆ FreeArgList()

VOID FreeArgList ( ARG_LIST List)

Free the ARG_LIST.

Parameters
ListPointer to ARG_LIST to free.

Definition at line 132 of file Ifconfig.c.

◆ IfConfig()

SHELL_STATUS IfConfig ( IN IFCONFIG_PRIVATE_DATA Private)

The ifconfig command main process.

Parameters
[in]PrivateThe pointer of IFCONFIG_PRIVATE_DATA.
Return values
SHELL_SUCCESSifconfig command processed successfully.
othersThe ifconfig command process failed.

Definition at line 1193 of file Ifconfig.c.

◆ IfConfigCleanup()

VOID IfConfigCleanup ( IN IFCONFIG_PRIVATE_DATA Private)

The ifconfig command cleanup process, free the allocated memory.

Parameters
[in]PrivateThe pointer of IFCONFIG_PRIVATE_DATA.

Definition at line 1242 of file Ifconfig.c.

◆ IfConfigClearInterfaceInfo()

SHELL_STATUS IfConfigClearInterfaceInfo ( IN LIST_ENTRY IfList,
IN CHAR16 *  IfName 
)

The clean process of the ifconfig command to clear interface info.

Parameters
[in]IfListThe pointer of IfList(interface list).
[in]IfNameThe pointer of interface name.
Return values
SHELL_SUCCESSThe ifconfig command clean processed successfully.
othersThe ifconfig command clean process failed.

Definition at line 751 of file Ifconfig.c.

◆ IfConfigGetInterfaceInfo()

EFI_STATUS IfConfigGetInterfaceInfo ( IN CHAR16 *  IfName,
IN LIST_ENTRY IfList 
)

The get current status of all handles.

Parameters
[in]IfNameThe pointer of IfName(interface name).
[in]IfListThe pointer of IfList(interface list).
Return values
EFI_SUCCESSThe get status processed successfully.
othersThe get status process failed.

Definition at line 342 of file Ifconfig.c.

◆ IfConfigManualAddressNotify()

VOID EFIAPI IfConfigManualAddressNotify ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

The notify function of create event when performing a manual config.

Parameters
[in]EventThe event this notify function registered to.
[in]ContextPointer to the context data registered to the event.

Definition at line 296 of file Ifconfig.c.

◆ IfConfigPrintMacAddr()

VOID IfConfigPrintMacAddr ( IN UINT8 *  Node,
IN UINT32  Size 
)

Print MAC address.

Parameters
[in]NodeThe pointer of MAC address buffer.
[in]SizeThe size of MAC address buffer.

Definition at line 312 of file Ifconfig.c.

◆ IfConfigRetriveCheckListByName()

VAR_CHECK_CODE IfConfigRetriveCheckListByName ( IN VAR_CHECK_ITEM CheckList,
IN CHAR16 *  Name,
IN BOOLEAN  Init 
)

Check the correctness of input Args with '-s' option.

Parameters
[in]CheckListThe pointer of VAR_CHECK_ITEM array.
[in]NameThe pointer of input arg.
[in]InitThe switch to execute the check.
Returns
VarCheckOk Valid parameter or Initialize check successfully.
VarCheckDuplicate Duplicated parameter happened.
VarCheckConflict Conflicted parameter happened
VarCheckUnknown Unknown parameter.

Definition at line 235 of file Ifconfig.c.

◆ IfConfigSetInterfaceInfo()

SHELL_STATUS IfConfigSetInterfaceInfo ( IN LIST_ENTRY IfList,
IN ARG_LIST VarArg 
)

The set process of the ifconfig command.

Parameters
[in]IfListThe pointer of IfList(interface list).
[in]VarArgThe pointer of ARG_LIST(Args with "-s" option).
Return values
SHELL_SUCCESSThe ifconfig command set processed successfully.
othersThe ifconfig command set process failed.

Definition at line 823 of file Ifconfig.c.

◆ IfConfigShowInterfaceInfo()

SHELL_STATUS IfConfigShowInterfaceInfo ( IN LIST_ENTRY IfList)

The list process of the ifconfig command.

Parameters
[in]IfListThe pointer of IfList(interface list).
Return values
SHELL_SUCCESSThe ifconfig command list processed successfully.
othersThe ifconfig command list process failed.

Definition at line 542 of file Ifconfig.c.

◆ ShellCommandRunIfconfig()

SHELL_STATUS EFIAPI ShellCommandRunIfconfig ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'ifconfig' command.

Parameters
[in]ImageHandleHandle to the Image (NULL if Internal).
[in]SystemTablePointer to the System Table (NULL if Internal).
Return values
EFI_SUCCESSifconfig command processed successfully.
othersThe ifconfig command process failed.

Definition at line 1293 of file Ifconfig.c.

◆ SplitStrToList()

ARG_LIST * SplitStrToList ( IN CONST CHAR16 *  String,
IN CHAR16  Separator 
)

Split a string with specified separator and save the substring to a list.

Parameters
[in]StringThe pointer of the input string.
[in]SeparatorThe specified separator.
Returns
The pointer of headnode of ARG_LIST.

Definition at line 157 of file Ifconfig.c.

Variable Documentation

◆ mIfConfigCheckList

SHELL_PARAM_ITEM mIfConfigCheckList[]
Initial value:
= {
{
L"-b",
},
{
L"-l",
},
{
L"-r",
},
{
L"-c",
},
{
L"-s",
},
{
TypeMax
},
}
#define NULL
Definition: Base.h:319
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
Definition: ShellLib.h:700
@ TypeMaxValue
A flag followed by all the command line data before the next flag.
Definition: ShellLib.h:704
@ TypeFlag
A flag that is present or not present only (IE "-a").
Definition: ShellLib.h:699

Definition at line 70 of file Ifconfig.c.

◆ mSetCheckList

VAR_CHECK_ITEM mSetCheckList[]
Initial value:
= {
{
L"static",
0x00000001,
0x00000001,
FlagTypeSingle
},
{
L"dhcp",
0x00000002,
0x00000001,
FlagTypeSingle
},
{
L"dns",
0x00000008,
0x00000004,
FlagTypeSingle
},
{
0x0,
0x0,
FlagTypeSkipUnknown
},
}

Definition at line 97 of file Ifconfig.c.

◆ PermanentString

STATIC CONST CHAR16 PermanentString[10] = L"PERMANENT"

Definition at line 124 of file Ifconfig.c.