1 /* $NetBSD: efiip.h,v 1.1.1.1 2014/04/01 16:16:07 jakllsch Exp $ */ 2 3 #ifndef _EFI_IP_H 4 #define _EFI_IP_H 5 6 /*++ 7 Copyright (c) 2013 Intel Corporation 8 9 --*/ 10 11 #define EFI_IP4_SERVICE_BINDING_PROTOCOL \ 12 {0xc51711e7,0xb4bf,0x404a,{0xbf,0xb8,0x0a,0x04, 0x8e,0xf1,0xff,0xe4}} 13 14 #define EFI_IP4_PROTOCOL \ 15 {0x41d94cd2,0x35b6,0x455a,{0x82,0x58,0xd4,0xe5,0x13,0x34,0xaa,0xdd}} 16 17 #define EFI_IP6_SERVICE_BINDING_PROTOCOL \ 18 {0xec835dd3,0xfe0f,0x617b,{0xa6,0x21,0xb3,0x50,0xc3,0xe1,0x33,0x88}} 19 20 #define EFI_IP6_PROTOCOL \ 21 {0x2c8759d5,0x5c2d,0x66ef,{0x92,0x5f,0xb6,0x6c,0x10,0x19,0x57,0xe2}} 22 23 INTERFACE_DECL(_EFI_IP4); 24 INTERFACE_DECL(_EFI_IP6); 25 26 typedef struct { 27 EFI_HANDLE InstanceHandle; 28 EFI_IPv4_ADDRESS Ip4Address; 29 EFI_IPv4_ADDRESS SubnetMask; 30 } EFI_IP4_ADDRESS_PAIR; 31 32 typedef struct { 33 EFI_HANDLE DriverHandle; 34 UINT32 AddressCount; 35 EFI_IP4_ADDRESS_PAIR AddressPairs[1]; 36 } EFI_IP4_VARIABLE_DATA; 37 38 typedef struct { 39 UINT8 DefaultProtocol; 40 BOOLEAN AcceptAnyProtocol; 41 BOOLEAN AcceptIcmpErrors; 42 BOOLEAN AcceptBroadcast; 43 BOOLEAN AcceptPromiscuous; 44 BOOLEAN UseDefaultAddress; 45 EFI_IPv4_ADDRESS StationAddress; 46 EFI_IPv4_ADDRESS SubnetMask; 47 UINT8 TypeOfService; 48 UINT8 TimeToLive; 49 BOOLEAN DoNotFragment; 50 BOOLEAN RawData; 51 UINT32 ReceiveTimeout; 52 UINT32 TransmitTimeout; 53 } EFI_IP4_CONFIG_DATA; 54 55 typedef struct { 56 EFI_IPv4_ADDRESS SubnetAddress; 57 EFI_IPv4_ADDRESS SubnetMask; 58 EFI_IPv4_ADDRESS GatewayAddress; 59 } EFI_IP4_ROUTE_TABLE; 60 61 typedef struct { 62 UINT8 Type; 63 UINT8 Code; 64 } EFI_IP4_ICMP_TYPE; 65 66 typedef struct { 67 BOOLEAN IsStarted; 68 UINT32 MaxPacketSize; 69 EFI_IP4_CONFIG_DATA ConfigData; 70 BOOLEAN IsConfigured; 71 UINT32 GroupCount; 72 EFI_IPv4_ADDRESS *GroupTable; 73 UINT32 RouteCount; 74 EFI_IP4_ROUTE_TABLE *RouteTable; 75 UINT32 IcmpTypeCount; 76 EFI_IP4_ICMP_TYPE *IcmpTypeList; 77 } EFI_IP4_MODE_DATA; 78 79 typedef 80 EFI_STATUS 81 (EFIAPI *EFI_IP4_GET_MODE_DATA) ( 82 IN struct _EFI_IP4 *This, 83 OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, 84 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, 85 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL 86 ); 87 88 typedef 89 EFI_STATUS 90 (EFIAPI *EFI_IP4_CONFIGURE) ( 91 IN struct _EFI_IP4 *This, 92 IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL 93 ); 94 95 typedef 96 EFI_STATUS 97 (EFIAPI *EFI_IP4_GROUPS) ( 98 IN struct _EFI_IP4 *This, 99 IN BOOLEAN JoinFlag, 100 IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL 101 ); 102 103 typedef 104 EFI_STATUS 105 (EFIAPI *EFI_IP4_ROUTES) ( 106 IN struct _EFI_IP4 *This, 107 IN BOOLEAN DeleteRoute, 108 IN EFI_IPv4_ADDRESS *SubnetAddress, 109 IN EFI_IPv4_ADDRESS *SubnetMask, 110 IN EFI_IPv4_ADDRESS *GatewayAddress 111 ); 112 113 #pragma pack(1) 114 typedef struct { 115 UINT8 HeaderLength:4; 116 UINT8 Version:4; 117 UINT8 TypeOfService; 118 UINT16 TotalLength; 119 UINT16 Identification; 120 UINT16 Fragmentation; 121 UINT8 TimeToLive; 122 UINT8 Protocol; 123 UINT16 Checksum; 124 EFI_IPv4_ADDRESS SourceAddress; 125 EFI_IPv4_ADDRESS DestinationAddress; 126 } EFI_IP4_HEADER; 127 #pragma pack() 128 129 typedef struct { 130 UINT32 FragmentLength; 131 VOID *FragmentBuffer; 132 } EFI_IP4_FRAGMENT_DATA; 133 134 typedef struct { 135 EFI_TIME TimeStamp; 136 EFI_EVENT RecycleSignal; 137 UINT32 HeaderLength; 138 EFI_IP4_HEADER *Header; 139 UINT32 OptionsLength; 140 VOID *Options; 141 UINT32 DataLength; 142 UINT32 FragmentCount; 143 EFI_IP4_FRAGMENT_DATA FragmentTable[1]; 144 } EFI_IP4_RECEIVE_DATA; 145 146 typedef struct { 147 EFI_IPv4_ADDRESS SourceAddress; 148 EFI_IPv4_ADDRESS GatewayAddress; 149 UINT8 Protocol; 150 UINT8 TypeOfService; 151 UINT8 TimeToLive; 152 BOOLEAN DoNotFragment; 153 } EFI_IP4_OVERRIDE_DATA; 154 155 typedef struct { 156 EFI_IPv4_ADDRESS DestinationAddress; 157 EFI_IP4_OVERRIDE_DATA *OverrideData; 158 UINT32 OptionsLength; 159 VOID *OptionsBuffer; 160 UINT32 TotalDataLength; 161 UINT32 FragmentCount; 162 EFI_IP4_FRAGMENT_DATA FragmentTable[1]; 163 } EFI_IP4_TRANSMIT_DATA; 164 165 typedef struct { 166 EFI_EVENT Event; 167 EFI_STATUS Status; 168 union { 169 EFI_IP4_RECEIVE_DATA *RxData; 170 EFI_IP4_TRANSMIT_DATA *TxData; 171 } Packet; 172 } EFI_IP4_COMPLETION_TOKEN; 173 174 typedef 175 EFI_STATUS 176 (EFIAPI *EFI_IP4_TRANSMIT) ( 177 IN struct _EFI_IP4 *This, 178 IN EFI_IP4_COMPLETION_TOKEN *Token 179 ); 180 181 typedef 182 EFI_STATUS 183 (EFIAPI *EFI_IP4_RECEIVE) ( 184 IN struct _EFI_IP4 *This, 185 IN EFI_IP4_COMPLETION_TOKEN *Token 186 ); 187 188 typedef 189 EFI_STATUS 190 (EFIAPI *EFI_IP4_CANCEL)( 191 IN struct _EFI_IP4 *This, 192 IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL 193 ); 194 195 typedef 196 EFI_STATUS 197 (EFIAPI *EFI_IP4_POLL) ( 198 IN struct _EFI_IP4 *This 199 ); 200 201 typedef struct _EFI_IP4 { 202 EFI_IP4_GET_MODE_DATA GetModeData; 203 EFI_IP4_CONFIGURE Configure; 204 EFI_IP4_GROUPS Groups; 205 EFI_IP4_ROUTES Routes; 206 EFI_IP4_TRANSMIT Transmit; 207 EFI_IP4_RECEIVE Receive; 208 EFI_IP4_CANCEL Cancel; 209 EFI_IP4_POLL Poll; 210 } EFI_IP4; 211 212 typedef struct { 213 UINT8 DefaultProtocol; 214 BOOLEAN AcceptAnyProtocol; 215 BOOLEAN AcceptIcmpErrors; 216 BOOLEAN AcceptPromiscuous; 217 EFI_IPv6_ADDRESS DestinationAddress; 218 EFI_IPv6_ADDRESS StationAddress; 219 UINT8 TrafficClass; 220 UINT8 HopLimit; 221 UINT32 FlowLabel; 222 UINT32 ReceiveTimeout; 223 UINT32 TransmitTimeout; 224 } EFI_IP6_CONFIG_DATA; 225 226 typedef struct { 227 EFI_IPv6_ADDRESS Address; 228 UINT8 PrefixLength; 229 } EFI_IP6_ADDRESS_INFO; 230 231 typedef struct { 232 EFI_IPv6_ADDRESS Gateway; 233 EFI_IPv6_ADDRESS Destination; 234 UINT8 PrefixLength; 235 } EFI_IP6_ROUTE_TABLE; 236 237 typedef enum { 238 EfiNeighborInComplete, 239 EfiNeighborReachable, 240 EfiNeighborStale, 241 EfiNeighborDelay, 242 EfiNeighborProbe 243 } EFI_IP6_NEIGHBOR_STATE; 244 245 typedef struct { 246 EFI_IPv6_ADDRESS Neighbor; 247 EFI_MAC_ADDRESS LinkAddress; 248 EFI_IP6_NEIGHBOR_STATE State; 249 } EFI_IP6_NEIGHBOR_CACHE; 250 251 typedef struct { 252 UINT8 Type; 253 UINT8 Code; 254 } EFI_IP6_ICMP_TYPE; 255 256 //*********************************************************** 257 // ICMPv6 type definitions for error messages 258 //*********************************************************** 259 #define ICMP_V6_DEST_UNREACHABLE 0x1 260 #define ICMP_V6_PACKET_TOO_BIG 0x2 261 #define ICMP_V6_TIME_EXCEEDED 0x3 262 #define ICMP_V6_PARAMETER_PROBLEM 0x4 263 264 //*********************************************************** 265 // ICMPv6 type definition for informational messages 266 //*********************************************************** 267 #define ICMP_V6_ECHO_REQUEST 0x80 268 #define ICMP_V6_ECHO_REPLY 0x81 269 #define ICMP_V6_LISTENER_QUERY 0x82 270 #define ICMP_V6_LISTENER_REPORT 0x83 271 #define ICMP_V6_LISTENER_DONE 0x84 272 #define ICMP_V6_ROUTER_SOLICIT 0x85 273 #define ICMP_V6_ROUTER_ADVERTISE 0x86 274 #define ICMP_V6_NEIGHBOR_SOLICIT 0x87 275 #define ICMP_V6_NEIGHBOR_ADVERTISE 0x88 276 #define ICMP_V6_REDIRECT 0x89 277 #define ICMP_V6_LISTENER_REPORT_2 0x8F 278 279 //*********************************************************** 280 // ICMPv6 code definitions for ICMP_V6_DEST_UNREACHABLE 281 //*********************************************************** 282 #define ICMP_V6_NO_ROUTE_TO_DEST 0x0 283 #define ICMP_V6_COMM_PROHIBITED 0x1 284 #define ICMP_V6_BEYOND_SCOPE 0x2 285 #define ICMP_V6_ADDR_UNREACHABLE 0x3 286 #define ICMP_V6_PORT_UNREACHABLE 0x4 287 #define ICMP_V6_SOURCE_ADDR_FAILED 0x5 288 #define ICMP_V6_ROUTE_REJECTED 0x6 289 290 //*********************************************************** 291 // ICMPv6 code definitions for ICMP_V6_TIME_EXCEEDED 292 //*********************************************************** 293 #define ICMP_V6_TIMEOUT_HOP_LIMIT 0x0 294 #define ICMP_V6_TIMEOUT_REASSEMBLE 0x1 295 296 //*********************************************************** 297 // ICMPv6 code definitions for ICMP_V6_PARAMETER_PROBLEM 298 //*********************************************************** 299 #define ICMP_V6_ERRONEOUS_HEADER 0x0 300 #define ICMP_V6_UNRECOGNIZE_NEXT_HDR 0x1 301 #define ICMP_V6_UNRECOGNIZE_OPTION 0x2 302 303 typedef struct { 304 BOOLEAN IsStarted; 305 UINT32 MaxPacketSize; 306 EFI_IP6_CONFIG_DATA ConfigData; 307 BOOLEAN IsConfigured; 308 UINT32 AddressCount; 309 EFI_IP6_ADDRESS_INFO *AddressList; 310 UINT32 GroupCount; 311 EFI_IPv6_ADDRESS *GroupTable; 312 UINT32 RouteCount; 313 EFI_IP6_ROUTE_TABLE *RouteTable; 314 UINT32 NeighborCount; 315 EFI_IP6_NEIGHBOR_CACHE *NeighborCache; 316 UINT32 PrefixCount; 317 EFI_IP6_ADDRESS_INFO *PrefixTable; 318 UINT32 IcmpTypeCount; 319 EFI_IP6_ICMP_TYPE *IcmpTypeList; 320 } EFI_IP6_MODE_DATA; 321 322 typedef 323 EFI_STATUS 324 (EFIAPI *EFI_IP6_GET_MODE_DATA) ( 325 IN struct _EFI_IP6 *This, 326 OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL, 327 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, 328 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL 329 ); 330 331 typedef 332 EFI_STATUS 333 (EFIAPI *EFI_IP6_CONFIGURE) ( 334 IN struct _EFI_IP6 *This, 335 IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL 336 ); 337 typedef 338 EFI_STATUS 339 (EFIAPI *EFI_IP6_GROUPS) ( 340 IN struct _EFI_IP6 *This, 341 IN BOOLEAN JoinFlag, 342 IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL 343 ); 344 345 typedef 346 EFI_STATUS 347 (EFIAPI *EFI_IP6_ROUTES) ( 348 IN struct _EFI_IP6 *This, 349 IN BOOLEAN DeleteRoute, 350 IN EFI_IPv6_ADDRESS *Destination OPTIONAL, 351 IN UINT8 PrefixLength, 352 IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL 353 ); 354 355 typedef 356 EFI_STATUS 357 (EFIAPI *EFI_IP6_NEIGHBORS) ( 358 IN struct _EFI_IP6 *This, 359 IN BOOLEAN DeleteFlag, 360 IN EFI_IPv6_ADDRESS *TargetIp6Address, 361 IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL, 362 IN UINT32 Timeout, 363 IN BOOLEAN Override 364 ); 365 366 typedef struct _EFI_IP6_FRAGMENT_DATA { 367 UINT32 FragmentLength; 368 VOID *FragmentBuffer; 369 } EFI_IP6_FRAGMENT_DATA; 370 371 typedef struct _EFI_IP6_OVERRIDE_DATA { 372 UINT8 Protocol; 373 UINT8 HopLimit; 374 UINT32 FlowLabel; 375 } EFI_IP6_OVERRIDE_DATA; 376 377 typedef struct _EFI_IP6_TRANSMIT_DATA { 378 EFI_IPv6_ADDRESS DestinationAddress; 379 EFI_IP6_OVERRIDE_DATA *OverrideData; 380 UINT32 ExtHdrsLength; 381 VOID *ExtHdrs; 382 UINT8 NextHeader; 383 UINT32 DataLength; 384 UINT32 FragmentCount; 385 EFI_IP6_FRAGMENT_DATA FragmentTable[1]; 386 } EFI_IP6_TRANSMIT_DATA; 387 388 #pragma pack(1) 389 typedef struct _EFI_IP6_HEADER { 390 UINT8 TrafficClassH:4; 391 UINT8 Version:4; 392 UINT8 FlowLabelH:4; 393 UINT8 TrafficClassL:4; 394 UINT16 FlowLabelL; 395 UINT16 PayloadLength; 396 UINT8 NextHeader; 397 UINT8 HopLimit; 398 EFI_IPv6_ADDRESS SourceAddress; 399 EFI_IPv6_ADDRESS DestinationAddress; 400 } EFI_IP6_HEADER; 401 #pragma pack() 402 403 typedef struct _EFI_IP6_RECEIVE_DATA { 404 EFI_TIME TimeStamp; 405 EFI_EVENT RecycleSignal; 406 UINT32 HeaderLength; 407 EFI_IP6_HEADER *Header; 408 UINT32 DataLength; 409 UINT32 FragmentCount; 410 EFI_IP6_FRAGMENT_DATA FragmentTable[1]; 411 } EFI_IP6_RECEIVE_DATA; 412 413 typedef struct { 414 EFI_EVENT Event; 415 EFI_STATUS Status; 416 union { 417 EFI_IP6_RECEIVE_DATA *RxData; 418 EFI_IP6_TRANSMIT_DATA *TxData; 419 } Packet; 420 } EFI_IP6_COMPLETION_TOKEN; 421 422 typedef 423 EFI_STATUS 424 (EFIAPI *EFI_IP6_TRANSMIT) ( 425 IN struct _EFI_IP6 *This, 426 IN EFI_IP6_COMPLETION_TOKEN *Token 427 ); 428 429 typedef 430 EFI_STATUS 431 (EFIAPI *EFI_IP6_RECEIVE) ( 432 IN struct _EFI_IP6 *This, 433 IN EFI_IP6_COMPLETION_TOKEN *Token 434 ); 435 436 typedef 437 EFI_STATUS 438 (EFIAPI *EFI_IP6_CANCEL)( 439 IN struct _EFI_IP6 *This, 440 IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL 441 ); 442 443 typedef 444 EFI_STATUS 445 (EFIAPI *EFI_IP6_POLL) ( 446 IN struct _EFI_IP6 *This 447 ); 448 449 typedef struct _EFI_IP6 { 450 EFI_IP6_GET_MODE_DATA GetModeData; 451 EFI_IP6_CONFIGURE Configure; 452 EFI_IP6_GROUPS Groups; 453 EFI_IP6_ROUTES Routes; 454 EFI_IP6_NEIGHBORS Neighbors; 455 EFI_IP6_TRANSMIT Transmit; 456 EFI_IP6_RECEIVE Receive; 457 EFI_IP6_CANCEL Cancel; 458 EFI_IP6_POLL Poll; 459 } EFI_IP6; 460 461 #endif /* _EFI_IP_H */ 462