1 /*++ 2 3 Copyright (c) 2006 - 2010, 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 Module Name: 13 14 NicIp4Config.h 15 16 Abstract: 17 18 --*/ 19 20 #ifndef _NIC_IP4_CONFIG_H_ 21 #define _NIC_IP4_CONFIG_H_ 22 23 #include EFI_PROTOCOL_DEFINITION (Ip4Config) 24 25 #define EFI_NIC_IP4_CONFIG_PROTOCOL_GUID \ 26 {0xdca3d4d, 0x12da, 0x4728, {0xbf, 0x7e, 0x86, 0xce, 0xb9, 0x28, 0xd0, 0x67}} 27 28 #define EFI_NIC_IP4_CONFIG_VARIABLE_GUID \ 29 {0xd8944553, 0xc4dd, 0x41f4, {0x9b, 0x30, 0xe1, 0x39, 0x7c, 0xfb, 0x26, 0x7b}} 30 31 #define EFI_NIC_IP4_CONFIG_VARIABLE L"EfiNicIp4ConfigVariable" 32 33 34 typedef struct _EFI_NIC_IP4_CONFIG_PROTOCOL EFI_NIC_IP4_CONFIG_PROTOCOL; 35 36 enum { 37 // 38 // Config source: dhcp or static 39 // 40 IP4_CONFIG_SOURCE_DHCP = 0, 41 IP4_CONFIG_SOURCE_STATIC, 42 IP4_CONFIG_SOURCE_MAX, 43 44 IP4_NIC_NAME_LENGTH = 64, 45 MAX_IP4_CONFIG_IN_VARIABLE = 128 46 }; 47 48 // 49 // The following structures are used by drivers/applications other 50 // than EFI_IP4_PROTOCOL, such as ifconfig shell application, to 51 // communicate the IP configuration information to EFI_IP4_CONFIG_PROTOCOL. 52 // EFI_IP4_CONFIG_PROTOCOL in turn is used by EFI_IP4_PROTOCOL to get 53 // the default IP4 configuration. ifconfig can't use the EFI_IP4_PROTOCOL 54 // because it don't know how to configure the default IP address even 55 // it has got the address. 56 // 57 // NIC_ADDR contains the interface's type and MAC address to identify 58 // a specific NIC. NIC_IP4_CONFIG_INFO contains the IP4 configure 59 // parameters for that NIC. IP4_CONFIG_VARIABLE is the EFI variable to 60 // save the configuration. NIC_IP4_CONFIG_INFO and IP4_CONFIG_VARIABLE 61 // is of variable length. 62 // 63 // EFI_NIC_IP4_CONFIG_PROTOCOL is a priority protocol, not defined by UEFI2.0 64 // 65 typedef struct { 66 UINT16 Type; 67 UINT8 Len; 68 EFI_MAC_ADDRESS MacAddr; 69 } NIC_ADDR; 70 71 typedef struct { 72 NIC_ADDR NicAddr; // Link layer address to identify the NIC 73 UINT32 Source; // Static or DHCP 74 BOOLEAN Perment; // Survive the reboot or not 75 EFI_IP4_IPCONFIG_DATA Ip4Info; // IP addresses 76 } NIC_IP4_CONFIG_INFO; 77 78 typedef struct { 79 UINT32 Len; // Total length of the variable 80 UINT16 CheckSum; // CheckSum, the same as IP4 head checksum 81 UINT32 Count; // Number of NIC_IP4_CONFIG_INFO follows 82 NIC_IP4_CONFIG_INFO ConfigInfo; 83 } IP4_CONFIG_VARIABLE; 84 85 typedef 86 EFI_STATUS 87 (EFIAPI *EFI_NIC_IP4_CONFIG_GET_INFO) ( 88 IN EFI_NIC_IP4_CONFIG_PROTOCOL *This, 89 IN OUT UINTN *Len, 90 OUT NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL 91 ); 92 93 typedef 94 EFI_STATUS 95 (EFIAPI *EFI_NIC_IP4_CONFIG_SET_INFO) ( 96 IN EFI_NIC_IP4_CONFIG_PROTOCOL *This, 97 IN NIC_IP4_CONFIG_INFO *NicConfig, OPTIONAL 98 IN BOOLEAN ReConfig 99 ); 100 101 typedef 102 EFI_STATUS 103 (EFIAPI *EFI_NIC_IP4_CONFIG_GET_NAME) ( 104 IN EFI_NIC_IP4_CONFIG_PROTOCOL *This, 105 IN UINT16 *Name, OPTIONAL 106 IN NIC_ADDR *NicAddr OPTIONAL 107 ); 108 109 struct _EFI_NIC_IP4_CONFIG_PROTOCOL { 110 EFI_NIC_IP4_CONFIG_GET_NAME GetName; 111 EFI_NIC_IP4_CONFIG_GET_INFO GetInfo; 112 EFI_NIC_IP4_CONFIG_SET_INFO SetInfo; 113 }; 114 115 extern EFI_GUID gEfiNicIp4ConfigVariableGuid; 116 extern EFI_GUID gEfiNicIp4ConfigProtocolGuid; 117 #endif 118