10#ifndef __EFI_PXEBC_DHCP4_H__
11#define __EFI_PXEBC_DHCP4_H__
13#define PXEBC_DHCP4_OPTION_MAX_NUM 16
14#define PXEBC_DHCP4_OPTION_MAX_SIZE 312
15#define PXEBC_DHCP4_PACKET_MAX_SIZE (sizeof (EFI_PXE_BASE_CODE_PACKET))
16#define PXEBC_DHCP4_S_PORT 67
17#define PXEBC_DHCP4_C_PORT 68
18#define PXEBC_BS_DOWNLOAD_PORT 69
19#define PXEBC_BS_DISCOVER_PORT 4011
20#define PXEBC_DHCP4_OPCODE_REQUEST 1
21#define PXEBC_DHCP4_OPCODE_REPLY 2
22#define PXEBC_DHCP4_MSG_TYPE_REQUEST 3
23#define PXEBC_DHCP4_MAGIC 0x63538263
28#define PXEBC_VENDOR_TAG_MTFTP_IP 1
29#define PXEBC_VENDOR_TAG_MTFTP_CPORT 2
30#define PXEBC_VENDOR_TAG_MTFTP_SPORT 3
31#define PXEBC_VENDOR_TAG_MTFTP_TIMEOUT 4
32#define PXEBC_VENDOR_TAG_MTFTP_DELAY 5
33#define PXEBC_VENDOR_TAG_DISCOVER_CTRL 6
34#define PXEBC_VENDOR_TAG_DISCOVER_MCAST 7
35#define PXEBC_VENDOR_TAG_BOOT_SERVERS 8
36#define PXEBC_VENDOR_TAG_BOOT_MENU 9
37#define PXEBC_VENDOR_TAG_MENU_PROMPT 10
38#define PXEBC_VENDOR_TAG_MCAST_ALLOC 11
39#define PXEBC_VENDOR_TAG_CREDENTIAL_TYPES 12
40#define PXEBC_VENDOR_TAG_BOOT_ITEM 71
42#define PXEBC_BOOT_REQUEST_TIMEOUT 1
43#define PXEBC_BOOT_REQUEST_RETRIES 4
45#define PXEBC_DHCP4_OVERLOAD_FILE 1
46#define PXEBC_DHCP4_OVERLOAD_SERVER_NAME 2
51#define PXEBC_DHCP4_TAG_INDEX_BOOTFILE_LEN 0
52#define PXEBC_DHCP4_TAG_INDEX_VENDOR 1
53#define PXEBC_DHCP4_TAG_INDEX_OVERLOAD 2
54#define PXEBC_DHCP4_TAG_INDEX_MSG_TYPE 3
55#define PXEBC_DHCP4_TAG_INDEX_SERVER_ID 4
56#define PXEBC_DHCP4_TAG_INDEX_CLASS_ID 5
57#define PXEBC_DHCP4_TAG_INDEX_BOOTFILE 6
58#define PXEBC_DHCP4_TAG_INDEX_MAX 7
71 PxeOfferTypeDhcpPxe10,
72 PxeOfferTypeDhcpWfm11a,
74 PxeOfferTypeProxyPxe10,
75 PxeOfferTypeProxyWfm11a,
76 PxeOfferTypeProxyBinl,
81#define BIT(x) (1 << x)
82#define CTRL(x) (0x1F & (x))
83#define DEFAULT_CLASS_ID_DATA "PXEClient:Arch:xxxxx:UNDI:003000"
84#define DEFAULT_UNDI_TYPE 1
85#define DEFAULT_UNDI_MAJOR 3
86#define DEFAULT_UNDI_MINOR 0
88#define MTFTP_VENDOR_OPTION_BIT_MAP \
89 (BIT (PXEBC_VENDOR_TAG_MTFTP_IP) | \
90 BIT (PXEBC_VENDOR_TAG_MTFTP_CPORT) | \
91 BIT (PXEBC_VENDOR_TAG_MTFTP_SPORT) | \
92 BIT (PXEBC_VENDOR_TAG_MTFTP_TIMEOUT) | \
93 BIT (PXEBC_VENDOR_TAG_MTFTP_DELAY))
95#define DISCOVER_VENDOR_OPTION_BIT_MAP \
96 (BIT (PXEBC_VENDOR_TAG_DISCOVER_CTRL) | \
97 BIT (PXEBC_VENDOR_TAG_DISCOVER_MCAST) | \
98 BIT (PXEBC_VENDOR_TAG_BOOT_SERVERS) | \
99 BIT (PXEBC_VENDOR_TAG_BOOT_MENU) | \
100 BIT (PXEBC_VENDOR_TAG_MENU_PROMPT))
102#define IS_VALID_BOOT_SERVERS(x) \
103 ((((x)[0]) & BIT (PXEBC_VENDOR_TAG_BOOT_SERVERS)) \
104 == BIT (PXEBC_VENDOR_TAG_BOOT_SERVERS))
106#define IS_VALID_BOOT_PROMPT(x) \
107 ((((x)[0]) & BIT (PXEBC_VENDOR_TAG_MENU_PROMPT)) \
108 == BIT (PXEBC_VENDOR_TAG_MENU_PROMPT))
110#define IS_VALID_BOOT_MENU(x) \
111 ((((x)[0]) & BIT (PXEBC_VENDOR_TAG_BOOT_MENU)) \
112 == BIT (PXEBC_VENDOR_TAG_BOOT_MENU))
114#define IS_VALID_MTFTP_VENDOR_OPTION(x) \
115 (((UINT32) ((x)[0]) & MTFTP_VENDOR_OPTION_BIT_MAP) \
116 == MTFTP_VENDOR_OPTION_BIT_MAP)
118#define IS_VALID_DISCOVER_VENDOR_OPTION(x) \
119 (((UINT32) ((x)[0]) & DISCOVER_VENDOR_OPTION_BIT_MAP) != 0)
121#define IS_VALID_CREDENTIAL_VENDOR_OPTION(x) \
122 (((UINT32) ((x)[0]) & BIT (PXEBC_VENDOR_TAG_CREDENTIAL_TYPES)) \
123 == BIT (PXEBC_VENDOR_TAG_CREDENTIAL_TYPES))
125#define IS_VALID_BOOTITEM_VENDOR_OPTION(x) \
126 (((UINT32) ((x)[PXEBC_VENDOR_TAG_BOOT_ITEM / 32]) & \
127 BIT (PXEBC_VENDOR_TAG_BOOT_ITEM % 32)) \
128 == BIT (PXEBC_VENDOR_TAG_BOOT_ITEM % 32))
130#define SET_VENDOR_OPTION_BIT_MAP(x, y) \
131 (*(x + ((y) / 32)) = (UINT32) ((UINT32) ((x)[(y) / 32]) | BIT ((y) % 32)))
133#define GET_NEXT_DHCP_OPTION(Opt) \
134 (EFI_DHCP4_PACKET_OPTION *) ((UINT8 *) (Opt) + \
135 sizeof (EFI_DHCP4_PACKET_OPTION) + (Opt)->Length - 1)
137#define GET_OPTION_BUFFER_LEN(Pkt) \
138 ((Pkt)->Length - sizeof (EFI_DHCP4_HEADER) - 4)
140#define GET_NEXT_BOOT_SVR_ENTRY(Ent) \
141 (PXEBC_BOOT_SVR_ENTRY *) ((UINT8 *) Ent + sizeof (*(Ent)) + \
142 ((Ent)->IpCnt - 1) * sizeof (EFI_IPv4_ADDRESS))
144#define IS_PROXY_DHCP_OFFER(Offer) \
145 EFI_IP4_EQUAL (&(Offer)->Dhcp4.Header.YourAddr, &mZeroIp4Addr)
147#define IS_DISABLE_BCAST_DISCOVER(x) \
148 (((x) & BIT (0)) == BIT (0))
150#define IS_DISABLE_MCAST_DISCOVER(x) \
151 (((x) & BIT (1)) == BIT (1))
153#define IS_ENABLE_USE_SERVER_LIST(x) \
154 (((x) & BIT (2)) == BIT (2))
156#define IS_DISABLE_PROMPT_MENU(x) \
157 (((x) & BIT (3)) == BIT (3))
183 UINT8 ClassIdentifier[10];
184 UINT8 ArchitecturePrefix[5];
185 UINT8 ArchitectureType[5];
187 UINT8 InterfaceName[4];
258#define PXEBC_CACHED_DHCP4_PACKET_MAX_SIZE (OFFSET_OF (EFI_DHCP4_PACKET, Dhcp4) + PXEBC_DHCP4_PACKET_MAX_SIZE)
263 UINT8 Buffer[PXEBC_CACHED_DHCP4_PACKET_MAX_SIZE];
268 PXEBC_OFFER_TYPE OfferType;
EFI_STATUS PxeBcDhcp4Discover(IN PXEBC_PRIVATE_DATA *Private, IN UINT16 Type, IN UINT16 *Layer, IN BOOLEAN UseBis, IN EFI_IP_ADDRESS *DestIp, IN UINT16 IpCount, IN EFI_PXE_BASE_CODE_SRVLIST *SrvList)
EFI_STATUS PxeBcSetIp4Policy(IN PXEBC_PRIVATE_DATA *Private)
VOID PxeBcSeedDhcp4Packet(OUT EFI_DHCP4_PACKET *Seed, IN EFI_UDP4_PROTOCOL *Udp4)
EFI_STATUS PxeBcDhcp4Dora(IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP4_PROTOCOL *Dhcp4)
EFI_STATUS PxeBcParseDhcp4Packet(IN PXEBC_DHCP4_PACKET_CACHE *Cache4)