]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/Network/PxeBc/Dxe/ip.h
Merge PVCS #7739.
[mirror_edk2.git] / EdkModulePkg / Universal / Network / PxeBc / Dxe / ip.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 --*/
13
14 #ifndef _IP_H_
15 #define _IP_H_
16
17 #include "hton.h"
18
19 //
20 // Client architecture types
21 //
22 #if defined MDE_CPU_IA32
23 #define SYS_ARCH 0x6
24 #elif defined MDE_CPU_X64
25 #define SYS_ARCH 0x7
26 #elif defined MDE_CPU_IPF
27 #define SYS_ARCH 0x2
28 #else
29 #error Unsupported Client Processor Type
30 #endif
31
32
33 //
34 // portability macros
35 //
36 #define UDP_FILTER_MASK (EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP | \
37 EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT | \
38 EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP | \
39 EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT | \
40 EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER \
41 )
42
43 #define PXE_BOOT_LAYER_MASK 0x7FFF
44 #define PXE_BOOT_LAYER_INITIAL 0x0000
45 #define PXE_BOOT_LAYER_CREDENTIAL_FLAG 0x8000
46 #define MAX_BOOT_SERVERS 32
47
48 //
49 // macro to evaluate IP address as TRUE if it is a multicast IP address
50 //
51 #define IS_MULTICAST(ptr) ((*((UINT8 *) ptr) & 0xf0) == 0xe0)
52
53 //
54 // length macros
55 //
56 #define IP_ADDRESS_LENGTH(qp) (((qp)->UsingIpv6) ? sizeof (EFI_IPv6_ADDRESS) : sizeof (EFI_IPv4_ADDRESS))
57
58 #define MAX_FRAME_DATA_SIZE 1488
59 #define ALLOCATE_SIZE(X) (((X) + 7) & 0xfff8)
60 #define MODE_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_MODE))
61 #define BUFFER_ALLOCATE_SIZE (8192 + 512)
62 #define ROUTER_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_PXE_BASE_CODE_ROUTE_ENTRY) * PXE_ROUTER_TABLE_SIZE))
63 #define ARP_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_PXE_BASE_CODE_ARP_ENTRY) * PXE_ARP_CACHE_SIZE))
64 #define FILTER_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_IP_ADDRESS) * PXE_IP_FILTER_SIZE))
65 #define PXE_ARP_CACHE_SIZE 8
66 #define PXE_ROUTER_TABLE_SIZE 8
67 #define PXE_IP_FILTER_SIZE 8
68 #define ICMP_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_ICMP_ERROR))
69 #define TFTP_ERR_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_TFTP_ERROR))
70
71 //
72 // DHCP discover/request packets are sent to this UDP port. ProxyDHCP
73 // servers listen on this port for DHCP discover packets that have a
74 // class identifier (option 60) with 'PXEClient' in the first 9 bytes.
75 // Bootservers also listen on this port for PXE broadcast discover
76 // requests from PXE clients.
77 //
78 #define DHCP_SERVER_PORT 67
79
80 //
81 // When DHCP, proxyDHCP and Bootservers respond to DHCP and PXE broadcast
82 // discover requests by broadcasting the reply packet, the packet is
83 // broadcast to this port.
84 //
85 #define DHCP_CLIENT_PORT 68
86
87 //
88 // TFTP servers listen for TFTP open requests on this port.
89 //
90 #define TFTP_OPEN_PORT 69
91
92 //
93 // proxyDHCP and Bootservers listen on this port for a PXE unicast and/or
94 // multicast discover requests from PXE clients. A PXE discover request
95 // looks like a DHCP discover or DHCP request packet.
96 //
97 #define PXE_DISCOVERY_PORT 4011
98
99 //
100 // This port is used by the PXE client/server protocol tests.
101 //
102 #define PXE_PORT_PXETEST_PORT 0x8080
103
104 //
105 // Definitions for Ethertype protocol numbers and interface types
106 // Per RFC 1700,
107 //
108 #define PXE_PROTOCOL_ETHERNET_IP 0x0800
109 #define PXE_PROTOCOL_ETHERNET_ARP 0x0806
110 #define PXE_PROTOCOL_ETHERNET_RARP 0x8035
111
112 #define PXE_IFTYPE_ETHERNET 0x01
113 #define PXE_IFTYPE_TOKENRING 0x04
114 #define PXE_IFTYPE_FIBRE_CHANNEL 0x12
115
116 //
117 // Definitions for internet protocol version 4 header
118 // Per RFC 791, September 1981.
119 //
120 #define IPVER4 4
121
122 #pragma pack(1) // make network structures packed byte alignment
123 typedef union {
124 UINT8 B[4];
125 UINT32 L;
126 } IPV4_ADDR;
127
128 #define IPV4_HEADER_LENGTH(IpHeaderPtr) (((IpHeaderPtr)->VersionIhl & 0xf) << 2)
129
130 #define SET_IPV4_VER_HDL(IpHeaderPtr, IpHeaderLen) { \
131 (IpHeaderPtr)->VersionIhl = (UINT8) ((IPVER4 << 4) | ((IpHeaderLen) >> 2)); \
132 }
133
134 typedef struct {
135 UINT8 VersionIhl;
136 UINT8 TypeOfService;
137 UINT16 TotalLength;
138 UINT16 Id;
139 UINT16 FragmentFields;
140 UINT8 TimeToLive;
141 UINT8 Protocol;
142 UINT16 HeaderChecksum;
143 IPV4_ADDR SrcAddr;
144 IPV4_ADDR DestAddr;
145 //
146 // options are not implemented
147 //
148 } IPV4_HEADER;
149
150 #define IP_FRAG_RSVD 0x8000 // reserved bit - must be zero
151 #define IP_NO_FRAG 0x4000 // do not fragment bit
152 #define IP_MORE_FRAG 0x2000 // not last fragment
153 #define IP_FRAG_OFF_MSK 0x1fff // fragment offset in 8 byte chunks
154 #define DEFAULT_RFC_TTL 64
155
156 #define PROT_ICMP 1
157 #define PROT_IGMP 2
158 #define PROT_TCP 6
159 #define PROT_UDP 17
160
161 /*
162 * Definitions for internet control message protocol version 4 message
163 * structure. Per RFC 792, September 1981.
164 */
165
166 //
167 // icmp header for all icmp messages
168 //
169 typedef struct {
170 UINT8 Type; // message type
171 UINT8 Code; // type specific - 0 for types we implement
172 UINT16 Checksum; // ones complement of ones complement sum of 16 bit words of message
173 } ICMPV4_HEADER;
174
175 #define ICMP_DEST_UNREACHABLE 3
176 #define ICMP_SOURCE_QUENCH 4
177 #define ICMP_REDIRECT 5
178 #define ICMP_ECHO 8
179 #define ICMP_ECHO_REPLY 0
180 #define ICMP_ROUTER_ADV 9
181 #define ICMP_ROUTER_SOLICIT 10
182 #define ICMP_TIME_EXCEEDED 11
183 #define ICMP_PARAMETER_PROBLEM 12
184 #define ICMP_TIMESTAMP 13
185 #define ICMP_TIMESTAMP_REPLY 14
186 #define ICMP_INFO_REQ 15
187 #define ICMP_INFO_REQ_REPLY 16
188 #define ICMP_SUBNET_MASK_REQ 17
189 #define ICMP_SUBNET_MASK_REPLY 18
190 //
191 // other ICMP message types ignored in this implementation
192 //
193 // icmp general messages
194 //
195 typedef struct {
196 ICMPV4_HEADER Header;
197 //
198 // generally unused except byte [0] for
199 // parameter problem message
200 //
201 UINT8 GenerallyUnused[4];
202 //
203 // original message ip header of plus 64
204 // bits of data
205 //
206 IPV4_HEADER IpHeader;
207 } ICMPV4_GENERAL_MESSAGE;
208
209 //
210 // icmp req/rply message header
211 //
212 typedef struct {
213 ICMPV4_HEADER Header;
214 UINT16 Id;
215 UINT16 SequenceNumber;
216 } ICMPV4_REQUEST_REPLY_HEADER;
217
218 //
219 // icmp echo message
220 //
221 typedef struct {
222 ICMPV4_REQUEST_REPLY_HEADER Header;
223 UINT8 EchoData[1]; // variable length data to be echoed
224 } ICMPV4_ECHO_MESSAGE;
225
226 //
227 // icmp timestamp message - times are milliseconds since midnight UT -
228 // if non std, set high order bit
229 //
230 typedef struct {
231 ICMPV4_REQUEST_REPLY_HEADER Header;
232 UINT32 OriginalTime; // originating timestamp
233 UINT32 ReceiveTime; // receiving timestamp
234 UINT32 TransmitTime; // transmitting timestamp
235 } ICMPV4_TIMESTAMP_MESSAGE;
236
237 //
238 // icmp info request structure - fill in source and dest net ip address on reply
239 //
240 typedef struct {
241 ICMPV4_REQUEST_REPLY_HEADER Header;
242 } ICMPV4_INFO_MESSAGE;
243
244 //
245 // Definitions for internet control message protocol version 4 message structure
246 // Router discovery
247 // Per RFC 1256, September 1991.
248 //
249 //
250 // icmp router advertisement message
251 //
252 typedef struct {
253 ICMPV4_HEADER Header;
254 UINT8 NumberEntries; // number of address entries
255 UINT8 EntrySize; // number of 32 bit words per address entry
256 UINT16 Lifetime; // seconds to consider info valid
257 UINT32 RouterIp;
258 UINT32 Preferance;
259 } ICMPV4_ROUTER_ADVERTISE_MESSAGE;
260
261 //
262 // icmp router solicitation message
263 //
264 typedef struct {
265 ICMPV4_HEADER Header;
266 UINT32 Reserved;
267 } ICMPV4_ROUTER_SOLICIT_MESSAGE;
268
269 #define MAX_SOLICITATION_DELAY 1 // 1 second
270 #define SOLICITATION_INTERVAL 3 // 3 seconds
271 #define MAX_SOLICITATIONS 3 // 3 transmissions
272 #define V1ROUTER_PRESENT_TIMEOUT 400 // 400 second timeout until v2 reports can be sent
273 #define UNSOLICITED_REPORT_INTERVAL 10 // 10 seconds between unsolicited reports
274 #define BROADCAST_IPv4 0xffffffff
275
276 //
277 // Definitions for address resolution protocol message structure
278 // Per RFC 826, November 1982
279 //
280 typedef struct {
281 UINT16 HwType; // hardware type - e.g. ethernet (1)
282 UINT16 ProtType; // protocol type - for ethernet, 0x800 for IP
283 UINT8 HwAddLen; // byte length of a hardware address (e.g. 6 for ethernet)
284 UINT8 ProtAddLen; // byte length of a protocol address (e.g. 4 for ipv4)
285 UINT16 OpCode;
286 //
287 // source and dest hw and prot addresses follow - see example below
288 //
289 } ARP_HEADER;
290
291 #define ETHERNET_ADD_SPC 1
292
293 #define ETHER_TYPE_IP 0x800
294
295 #define ARP_REQUEST 1
296 #define ARP_REPLY 2
297
298 //
299 // generic ARP packet
300 //
301 typedef struct {
302 ARP_HEADER ArpHeader;
303 EFI_MAC_ADDRESS SrcHardwareAddr;
304 EFI_IP_ADDRESS SrcProtocolAddr;
305 EFI_MAC_ADDRESS DestHardwareAddr;
306 EFI_IP_ADDRESS DestProtocolAddr;
307 } ARP_PACKET;
308
309 #define ENET_HWADDLEN 6
310 #define IPV4_PROTADDLEN 4
311
312 //
313 // Definitions for user datagram protocol version 4 pseudo header & header
314 // Per RFC 768, 28 August 1980
315 //
316 typedef struct {
317 IPV4_ADDR SrcAddr; // source ip address
318 IPV4_ADDR DestAddr; // dest ip address
319 UINT8 Zero; // 0
320 UINT8 Protocol; // protocol
321 UINT16 TotalLength; // UDP length - sizeof udpv4hdr + data length
322 } UDPV4_PSEUDO_HEADER;
323
324 typedef struct {
325 UINT16 SrcPort; // source port identifier
326 UINT16 DestPort; // destination port identifier
327 UINT16 TotalLength; // total length header plus data
328 //
329 // ones complement of ones complement sum of 16 bit
330 // words of pseudo header, UDP header, and data
331 // zero checksum is transmitted as -0 (ones comp)
332 // zero transmitted means checksum not computed
333 // data follows
334 //
335 UINT16 Checksum;
336 } UDPV4_HEADER;
337
338 typedef struct {
339 UDPV4_PSEUDO_HEADER Udpv4PseudoHeader;
340 UDPV4_HEADER Udpv4Header;
341 } UDPV4_HEADERS;
342
343 //
344 // Definitions for transmission control protocol header
345 // Per RFC 793, September, 1981
346 //
347 typedef struct {
348 IPV4_ADDR SrcAddr; // source ip address
349 IPV4_ADDR DestAddr; // dest ip address
350 UINT8 Zero; // 0
351 UINT8 Protocol; // protocol
352 UINT16 TotalLength; // TCP length - TCP header length + data length
353 } TCPV4_PSEUDO_HEADER;
354
355 typedef struct {
356 UINT16 SrcPort; // source port identifier
357 UINT16 DestPort; // destination port identifier
358 UINT32 SeqNumber; // Sequence number
359 UINT32 AckNumber; // Acknowledgement Number
360 //
361 // Nibble of HLEN (length of header in 32-bit multiples)
362 // 6bits of RESERVED
363 // Nibble of Code Bits
364 //
365 UINT16 HlenResCode;
366 UINT16 Window; // Software buffer size (sliding window size) in network-standard byte order
367 //
368 // ones complement of ones complement sum of 16 bit words of
369 // pseudo header, TCP header, and data
370 // zero checksum is transmitted as -0 (ones comp)
371 // zero transmitted means checksum not computed
372 //
373 UINT16 Checksum;
374 UINT16 UrgentPointer; // pointer to urgent data (allows sender to specify urgent data)
375 } TCPV4_HEADER;
376
377 typedef struct {
378 TCPV4_PSEUDO_HEADER Tcpv4PseudoHeader;
379 TCPV4_HEADER Tcpv4Header;
380 } TCPV4_HEADERS;
381
382 typedef struct {
383 UINT8 Kind; // one of the following:
384 UINT8 Length; // total option length including Kind and Lth
385 UINT8 Data[1]; // length = Lth - 2
386 } TCPV4_OPTION;
387
388 #define TCP_OP_END 0 // only used to pad to end of TCP header
389 #define TCP_NOP 1 // optional - may be used to pad between options to get alignment
390 #define TCP_MAX_SEG 2 // maximum receive segment size - only send at initial connection request
391 #define MAX_MEDIA_HDR_SIZE 64
392 #define MIN_ENET_DATA_SIZE 64
393 #define MAX_ENET_DATA_SIZE 1500 // temp def - make a network based var
394 #define MAX_IPV4_PKT_SIZE 65535 // maximum IP packet size
395 #define MAX_IPV4_DATA_SIZE (MAX_IPV4_PKT_SIZE - sizeof (IPV4_HEADER))
396 #define MAX_IPV4_FRAME_DATA_SIZE (MAX_FRAME_DATA_SIZE - sizeof (IPV4_HEADER))
397 #define REAS_IPV4_PKT_SIZE 576 // minimum IP packet size all IP host can handle
398 #define REAS_IPV4_DATA_SIZE (REAS_IPV4_PKT_SIZE - sizeof (IPV4_HEADER))
399
400 //
401 //
402 //
403 typedef union {
404 UINT8 Data[MAX_ENET_DATA_SIZE];
405 ICMPV4_HEADER IcmpHeader;
406 IGMPV2_MESSAGE IgmpMessage;
407 struct {
408 UDPV4_HEADER UdpHeader;
409 UINT8 Data[1];
410 } Udp;
411 struct {
412 TCPV4_HEADER TcpHeader;
413 UINT8 Data[1];
414 } Tcp;
415 } PROTOCOL_UNION;
416
417 //
418 // out buffer structure
419 //
420 typedef struct {
421 UINT8 MediaHeader[MAX_MEDIA_HDR_SIZE];
422 IPV4_HEADER IpHeader;
423 //
424 // following union placement only valid if no option IP header
425 //
426 PROTOCOL_UNION u;
427 } IPV4_BUFFER;
428
429 typedef struct {
430 IPV4_HEADER IpHeader;
431 //
432 // following union placement only valid if no option IP header
433 //
434 PROTOCOL_UNION u;
435 } IPV4_STRUCT;
436
437 #pragma pack() // reset to default
438
439 ////////////////////////////////////////////////////////////
440 //
441 // BC IP Filter Routine
442 //
443 EFI_STATUS
444 IpFilter (
445 PXE_BASECODE_DEVICE *Private,
446 IN EFI_PXE_BASE_CODE_IP_FILTER *Filter
447 )
448 ;
449
450 //
451 // //////////////////////////////////////////////////////////////////////
452 //
453 // Udp Write Routine - called by base code - e.g. TFTP - already locked
454 //
455 EFI_STATUS
456 UdpWrite (
457 IN PXE_BASECODE_DEVICE *Private,
458 IN UINT16 OpFlags,
459 IN EFI_IP_ADDRESS *DestIpPtr,
460 IN EFI_PXE_BASE_CODE_UDP_PORT *DestPortptr,
461 IN EFI_IP_ADDRESS *GatewayIpPtr, OPTIONAL
462 IN EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
463 IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
464 IN UINTN *HeaderSizePtr, OPTIONAL
465 IN VOID *HeaderPtr, OPTIONAL
466 IN UINTN *BufferSizePtr,
467 IN VOID *BufferPtr
468 )
469 ;
470
471 //
472 // /////////////////////////////////////////////////////////////////////
473 //
474 // Udp Read Routine - called by base code - e.g. TFTP - already locked
475 //
476 EFI_STATUS
477 UdpRead (
478 IN PXE_BASECODE_DEVICE *Private,
479 IN UINT16 OpFlags,
480 IN OUT EFI_IP_ADDRESS *DestIpPtr, OPTIONAL
481 IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPorPtrt, OPTIONAL
482 IN OUT EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
483 IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
484 IN UINTN *HeaderSizePtr, OPTIONAL
485 IN VOID *HeaderPtr, OPTIONAL
486 IN OUT UINTN *BufferSizePtr,
487 IN VOID *BufferPtr,
488 IN EFI_EVENT TimeoutEvent
489 )
490 ;
491
492 VOID
493 IgmpLeaveGroup (
494 PXE_BASECODE_DEVICE *Private,
495 EFI_IP_ADDRESS *
496 )
497 ;
498
499 VOID
500 IgmpJoinGroup (
501 PXE_BASECODE_DEVICE *Private,
502 EFI_IP_ADDRESS *
503 )
504 ;
505
506 //
507 // convert number to zero filled ascii value of length lth
508 //
509 VOID
510 CvtNum (
511 UINTN Number,
512 UINT8 *BufferPtr,
513 INTN BufferLen
514 )
515 ;
516
517 //
518 // convert number to ascii string at ptr
519 //
520 VOID
521 UtoA10 (
522 UINTN Number,
523 UINT8 *BufferPtr
524 )
525 ;
526
527 //
528 // convert ascii numeric string to UINTN
529 //
530 UINTN
531 AtoU (
532 UINT8 *BufferPtr
533 )
534 ;
535
536 UINT64
537 AtoU64 (
538 UINT8 *BufferPtr
539 )
540 ;
541
542 //
543 // calculate the internet checksum (RFC 1071)
544 // return 16 bit ones complement of ones complement sum of 16 bit words
545 //
546 UINT16
547 IpChecksum (
548 UINT16 *MessagePtr,
549 UINTN ByteLength
550 )
551 ;
552
553 //
554 // do checksum on non contiguous header and data
555 //
556 UINT16
557 IpChecksum2 (
558 UINT16 *Header,
559 UINTN HeaderLength,
560 UINT16 *Message,
561 UINTN MessageLength
562 )
563 ;
564
565 //
566 // update checksum when only a single word changes
567 //
568 UINT16
569 UpdateChecksum (
570 UINT16 OldChecksum,
571 UINT16 OldWord,
572 UINT16 NewWord
573 )
574 ;
575
576 VOID
577 SeedRandom (
578 IN PXE_BASECODE_DEVICE *Private,
579 IN UINT16 InitialSeed
580 )
581 ;
582
583 UINT16
584 Random (
585 IN PXE_BASECODE_DEVICE *Private
586 )
587 ;
588
589 EFI_STATUS
590 SendPacket (
591 PXE_BASECODE_DEVICE *Private,
592 VOID *HeaderPtr,
593 VOID *PacketPtr,
594 INTN PacketLength,
595 VOID *HardwareAddress,
596 UINT16 MediaProtocol,
597 IN EFI_PXE_BASE_CODE_FUNCTION Function
598 )
599 ;
600
601 VOID
602 HandleArpReceive (
603 PXE_BASECODE_DEVICE *Private,
604 ARP_PACKET *ArpPacketPtr,
605 VOID *HeaderPtr
606 )
607 ;
608
609 VOID
610 HandleIgmp (
611 PXE_BASECODE_DEVICE *Private,
612 IGMPV2_MESSAGE *IgmpMessageptr,
613 UINTN IgmpMessageLen
614 )
615 ;
616
617 VOID
618 IgmpCheckTimers (
619 PXE_BASECODE_DEVICE *Private
620 )
621 ; // poll when doing a receive
622 // return hw add of IP and TRUE if available, otherwise FALSE
623 //
624 BOOLEAN
625 GetHwAddr (
626 IN PXE_BASECODE_DEVICE *Private,
627 EFI_IP_ADDRESS *ProtocolAddressPtr,
628 EFI_MAC_ADDRESS *HardwareAddressPtr
629 )
630 ;
631
632 EFI_STATUS
633 DoArp (
634 IN PXE_BASECODE_DEVICE *Private,
635 IN EFI_IP_ADDRESS *ProtocolAddressPtr,
636 OUT EFI_MAC_ADDRESS *HardwareAddressptr
637 )
638 ;
639
640 BOOLEAN
641 OnSameSubnet (
642 UINTN IpAddressLen,
643 EFI_IP_ADDRESS *Ip1,
644 EFI_IP_ADDRESS *Ip2,
645 EFI_IP_ADDRESS *SubnetMask
646 )
647 ;
648
649 VOID
650 IpAddRouter (
651 PXE_BASECODE_DEVICE *Private,
652 EFI_IP_ADDRESS *RouterIp
653 )
654 ;
655
656 #define Ip4AddRouter(Private, Ipv4Ptr) IpAddRouter (Private, (EFI_IP_ADDRESS *) Ipv4Ptr)
657
658 //
659 // routine to send ipv4 packet
660 // ipv4 + upper protocol header for length TotHdrLth in xmtbuf, ipv4 header length IpHdrLth
661 // routine fills in ipv4hdr Ver_Hdl, TotLth, and Checksum, moves in Data, and gets dest MAC address
662 //
663 EFI_STATUS
664 Ipv4Xmt (
665 PXE_BASECODE_DEVICE *Private,
666 UINT32 GatewayIP,
667 UINTN IpHeaderLen,
668 UINTN TotalHeaderLen,
669 VOID *Data,
670 UINTN DataLen,
671 EFI_PXE_BASE_CODE_FUNCTION Function
672 )
673 ;
674
675 //
676 // send ipv4 packet with ipv4 option
677 //
678 EFI_STATUS
679 Ipv4SendWOp (
680 PXE_BASECODE_DEVICE *Private,
681 UINT32 GatewayIP,
682 UINT8 *MessagePtr,
683 UINTN MessageLth,
684 UINT8 Protocol,
685 UINT8 *Option,
686 UINTN OptionLen,
687 UINT32 DestIp,
688 EFI_PXE_BASE_CODE_FUNCTION Function
689 )
690 ;
691
692 //
693 // send MsgLth message at MsgPtr - higher level protocol header already in xmtbuf, length HdrSize
694 //
695 EFI_STATUS
696 Ip4Send (
697 IN PXE_BASECODE_DEVICE *Private, // pointer to instance data
698 IN UINTN MayFragment, //
699 IN UINT8 Protocol, // protocol
700 IN UINT32 SrcIp, // Source IP address
701 IN UINT32 DestIp, // Destination IP address
702 IN UINT32 GatewayIp, // used if not NULL and needed
703 IN UINTN HeaderSize, // protocol header byte length
704 IN UINT8 *MsgPtr, // pointer to data
705 IN UINTN MsgLength
706 )
707 ; // data byte length
708 // receive up to MsgLth message into MsgPtr for protocol Prot
709 // return message length, src/dest ips if select any, and pointer to protocol header
710 //
711 EFI_STATUS
712 IpReceive (
713 IN PXE_BASECODE_DEVICE *Private, // pointer to instance data
714 UINT16 OpFlags, // Flags to determine if filtering on IP addresses
715 EFI_IP_ADDRESS *SrcIpPtr, // if filtering, O if accept any
716 EFI_IP_ADDRESS *DstIpPtr, // if filtering, O if accept any
717 UINT8 Protocol, // protocol
718 VOID *HeaderPtr, // address of where to put protocol header
719 UINTN HeaderSize, // protocol header byte length
720 UINT8 *MsgPtr, // pointer to data buffer
721 UINTN *MsgLenPtr, // pointer to data buffer length/ O - returned data length
722 IN EFI_EVENT TimeoutEvent
723 )
724 ;
725
726 #if 0
727 VOID
728 WaitForTxComplete (
729 IN PXE_BASECODE_DEVICE *Private
730 )
731 ;
732 #endif
733 //
734 // routine to cycle waiting for a receive or timeout
735 //
736 EFI_STATUS
737 WaitForReceive (
738 IN PXE_BASECODE_DEVICE *Private,
739 IN EFI_PXE_BASE_CODE_FUNCTION Function,
740 IN EFI_EVENT TimeoutEvent,
741 IN OUT UINTN *HeaderSizePtr,
742 IN OUT UINTN *BufferSizePtr,
743 IN OUT UINT16 *ProtocolPtr
744 )
745 ;
746
747 #endif /* _IP_H_ */
748
749 /* EOF - ip.h */