]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Protocol/NicIp4Config.h
1. Retired HotPlugDevice protocol.
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / NicIp4Config.h
1 /** @file
2 This file defines NicIp4Config Protocol.
3 EFI_NIC_IP4_CONFIG_PROTOCOL is a proprietary protocol, not defined by UEFI2.0.
4
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. 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
10
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.
13
14 **/
15
16 #ifndef __NIC_IP4_CONFIG_H__
17 #define __NIC_IP4_CONFIG_H__
18
19 #include <Protocol/Ip4Config.h>
20
21
22 #define EFI_NIC_IP4_CONFIG_PROTOCOL_GUID \
23 { \
24 0xdca3d4d, 0x12da, 0x4728, { 0xbf, 0x7e, 0x86, 0xce, 0xb9, 0x28, 0xd0, 0x67 } \
25 }
26
27 #define EFI_NIC_IP4_CONFIG_VARIABLE_GUID \
28 { \
29 0xd8944553, 0xc4dd, 0x41f4, { 0x9b, 0x30, 0xe1, 0x39, 0x7c, 0xfb, 0x26, 0x7b } \
30 }
31
32 #define EFI_NIC_IP4_CONFIG_VARIABLE L"EfiNicIp4ConfigVariable"
33
34
35 typedef struct _EFI_NIC_IP4_CONFIG_PROTOCOL EFI_NIC_IP4_CONFIG_PROTOCOL;
36
37 typedef enum {
38 //
39 // Config source: dhcp or static
40 //
41 IP4_CONFIG_SOURCE_DHCP = 0,
42 IP4_CONFIG_SOURCE_STATIC,
43 IP4_CONFIG_SOURCE_MAX,
44
45 IP4_NIC_NAME_LENGTH = 64,
46 MAX_IP4_CONFIG_IN_VARIABLE = 16
47 } IP4_CONFIG_TYPE;
48
49 //
50 // The following structures are used by drivers/applications other
51 // than EFI_IP4_PROTOCOL, such as ifconfig shell application, to
52 // communicate the IP configuration information to EFI_IP4_CONFIG_PROTOCOL.
53 // EFI_IP4_CONFIG_PROTOCOL in turn is used by EFI_IP4_PROTOCOL to get
54 // the default IP4 configuration. ifconfig can't use the EFI_IP4_PROTOCOL
55 // because it don't know how to configure the default IP address even
56 // it has got the address.
57 //
58
59 ///
60 /// NIC_ADDR contains the interface's type and MAC address to identify
61 /// a specific NIC.
62 ///
63 typedef struct {
64 UINT16 Type; ///< Interface type
65 UINT8 Len; ///< Length of MAC address
66 EFI_MAC_ADDRESS MacAddr; ///< MAC address of interface
67 } NIC_ADDR;
68
69 ///
70 /// NIC_IP4_CONFIG_INFO contains the IP4 configure
71 /// parameters for that NIC. NIC_IP4_CONFIG_INFO is
72 /// of variable length.
73 ///
74 typedef struct {
75 NIC_ADDR NicAddr; ///< Link layer address to identify the NIC
76 UINT32 Source; ///< Static or DHCP
77 BOOLEAN Perment; ///< Survive the reboot or not
78 EFI_IP4_IPCONFIG_DATA Ip4Info; ///< IP addresses
79 } NIC_IP4_CONFIG_INFO;
80
81 ///
82 /// IP4_CONFIG_VARIABLE is the EFI variable to
83 /// save the configuration. IP4_CONFIG_VARIABLE is
84 /// of variable length.
85 ///
86 typedef struct {
87 UINT32 Len; ///< Total length of the variable
88 UINT16 CheckSum; ///< CheckSum, the same as IP4 head checksum
89 UINT32 Count; ///< Number of NIC_IP4_CONFIG_INFO follows
90 NIC_IP4_CONFIG_INFO ConfigInfo;
91 } IP4_CONFIG_VARIABLE;
92
93 /**
94 Get the configure parameter for this NIC.
95
96 @param This The NIC IP4 CONFIG protocol.
97 @param Len The length of the NicConfig buffer.
98 @param NicConfig The buffer to receive the NIC's configure
99 parameter.
100
101 @retval EFI_SUCCESS The configure parameter for this NIC was
102 obtained successfully .
103 @retval EFI_INVALID_PARAMETER This or ConfigLen is NULL.
104 @retval EFI_NOT_FOUND There is no configure parameter for the NIC in
105 NVRam.
106 @retval EFI_BUFFER_TOO_SMALL The ConfigLen is too small or the NicConfig is
107 NULL.
108
109 **/
110 typedef
111 EFI_STATUS
112 (EFIAPI *EFI_NIC_IP4_CONFIG_GET_INFO)(
113 IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
114 IN OUT UINTN *Len,
115 OUT NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL
116 );
117
118 /**
119 Set the IP configure parameters for this NIC.
120
121 If Reconfig is TRUE, the IP driver will be informed to discard current
122 auto configure parameter and restart the auto configuration process.
123 If current there is a pending auto configuration, EFI_ALREADY_STARTED is
124 returned. You can only change the configure setting when either
125 the configure has finished or not started yet. If NicConfig, the
126 NIC's configure parameter is removed from the variable.
127
128 @param This The NIC IP4 CONFIG protocol
129 @param NicConfig The new NIC IP4 configure parameter
130 @param Reconfig Inform the IP4 driver to restart the auto
131 configuration
132
133 @retval EFI_SUCCESS The configure parameter for this NIC was
134 set successfully .
135 @retval EFI_INVALID_PARAMETER This is NULL or the configure parameter is
136 invalid.
137 @retval EFI_ALREADY_STARTED There is a pending auto configuration.
138 @retval EFI_NOT_FOUND No auto configure parameter is found
139
140 **/
141 typedef
142 EFI_STATUS
143 (EFIAPI *EFI_NIC_IP4_CONFIG_SET_INFO)(
144 IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
145 IN NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL,
146 IN BOOLEAN ReConfig
147 );
148
149 /**
150 Return the name and MAC address for the NIC. The Name, if not NULL,
151 has at least IP4_NIC_NAME_LENGTH bytes.
152
153 @param This The NIC IP4 CONFIG protocol
154 @param Name The buffer to return the name
155 @param NicAddr The buffer to return the MAC addr
156
157 @retval EFI_INVALID_PARAMETER This is NULL
158 @retval EFI_SUCCESS The name or address of the NIC are returned.
159
160 **/
161 typedef
162 EFI_STATUS
163 (EFIAPI *EFI_NIC_IP4_CONFIG_GET_NAME)(
164 IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
165 OUT UINT16 *Name OPTIONAL,
166 OUT NIC_ADDR *NicAddr OPTIONAL
167 );
168
169 struct _EFI_NIC_IP4_CONFIG_PROTOCOL {
170 EFI_NIC_IP4_CONFIG_GET_NAME GetName;
171 EFI_NIC_IP4_CONFIG_GET_INFO GetInfo;
172 EFI_NIC_IP4_CONFIG_SET_INFO SetInfo;
173 };
174
175 extern EFI_GUID gEfiNicIp4ConfigVariableGuid;
176 extern EFI_GUID gEfiNicIp4ConfigProtocolGuid;
177 #endif