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