TianoCore EDK2 master
Loading...
Searching...
No Matches
Mtftp4Rrq.c
Go to the documentation of this file.
1
10#include "Mtftp4Impl.h"
11
21VOID
22EFIAPI
24 IN NET_BUF *UdpPacket,
25 IN UDP_END_POINT *EndPoint,
26 IN EFI_STATUS IoStatus,
27 IN VOID *Context
28 );
29
46 IN MTFTP4_PROTOCOL *Instance,
47 IN UINT16 Operation
48 )
49{
50 EFI_STATUS Status;
51
52 //
53 // The valid block number range are [1, 0xffff]. For example:
54 // the client sends an RRQ request to the server, the server
55 // transfers the DATA1 block. If option negotiation is ongoing,
56 // the server will send back an OACK, then client will send ACK0.
57 //
58 Status = Mtftp4InitBlockRange (&Instance->Blocks, 1, 0xffff);
59
60 if (EFI_ERROR (Status)) {
61 return Status;
62 }
63
64 Status = Mtftp4SendRequest (Instance);
65
66 if (EFI_ERROR (Status)) {
67 return Status;
68 }
69
70 return UdpIoRecvDatagram (Instance->UnicastPort, Mtftp4RrqInput, Instance, 0);
71}
72
86 IN MTFTP4_PROTOCOL *Instance,
87 IN UINT16 BlkNo
88 )
89{
91 NET_BUF *Packet;
92 EFI_STATUS Status;
93
94 Status = EFI_SUCCESS;
95
96 Packet = NetbufAlloc (sizeof (EFI_MTFTP4_ACK_HEADER));
97 if (Packet == NULL) {
98 return EFI_OUT_OF_RESOURCES;
99 }
100
102 Packet,
103 sizeof (EFI_MTFTP4_ACK_HEADER),
104 FALSE
105 );
106 ASSERT (Ack != NULL);
107
108 Ack->Ack.OpCode = HTONS (EFI_MTFTP4_OPCODE_ACK);
109 Ack->Ack.Block[0] = HTONS (BlkNo);
110
111 Status = Mtftp4SendPacket (Instance, Packet);
112 if (!EFI_ERROR (Status)) {
113 Instance->AckedBlock = Instance->TotalBlock;
114 }
115
116 return Status;
117}
118
136 IN OUT MTFTP4_PROTOCOL *Instance,
137 IN EFI_MTFTP4_PACKET *Packet,
138 IN UINT32 Len
139 )
140{
141 EFI_MTFTP4_TOKEN *Token;
142 EFI_STATUS Status;
143 UINT16 Block;
144 UINT64 Start;
145 UINT32 DataLen;
146 UINT64 BlockCounter;
147 BOOLEAN Completed;
148
149 Completed = FALSE;
150 Token = Instance->Token;
151 Block = NTOHS (Packet->Data.Block);
152 DataLen = Len - MTFTP4_DATA_HEAD_LEN;
153
154 //
155 // This is the last block, save the block no
156 //
157 if (DataLen < Instance->BlkSize) {
158 Completed = TRUE;
159 Instance->LastBlock = Block;
160 Mtftp4SetLastBlockNum (&Instance->Blocks, Block);
161 }
162
163 //
164 // Remove this block number from the file hole. If Mtftp4RemoveBlockNum
165 // returns EFI_NOT_FOUND, the block has been saved, don't save it again.
166 // Note that : For bigger files, allowing the block counter to roll over
167 // to accept transfers of unlimited size. So BlockCounter is memorised as
168 // continuous block counter.
169 //
170 Status = Mtftp4RemoveBlockNum (&Instance->Blocks, Block, Completed, &BlockCounter);
171
172 if (Status == EFI_NOT_FOUND) {
173 return EFI_SUCCESS;
174 } else if (EFI_ERROR (Status)) {
175 return Status;
176 }
177
178 if (Token->CheckPacket != NULL) {
179 Status = Token->CheckPacket (&Instance->Mtftp4, Token, (UINT16)Len, Packet);
180
181 if (EFI_ERROR (Status)) {
183 Instance,
184 EFI_MTFTP4_ERRORCODE_ILLEGAL_OPERATION,
185 (UINT8 *)"User aborted download"
186 );
187
188 return EFI_ABORTED;
189 }
190 }
191
192 if (Token->Buffer != NULL) {
193 Start = MultU64x32 (BlockCounter - 1, Instance->BlkSize);
194
195 if (Start + DataLen <= Token->BufferSize) {
196 CopyMem ((UINT8 *)Token->Buffer + Start, Packet->Data.Data, DataLen);
197
198 //
199 // Update the file size when received the last block
200 //
201 if ((Instance->LastBlock == Block) && Completed) {
202 Token->BufferSize = Start + DataLen;
203 }
204 } else if (Instance->LastBlock != 0) {
205 //
206 // Don't save the data if the buffer is too small, return
207 // EFI_BUFFER_TOO_SMALL if received the last packet. This
208 // will give a accurate file length.
209 //
210 Token->BufferSize = Start + DataLen;
211
213 Instance,
214 EFI_MTFTP4_ERRORCODE_DISK_FULL,
215 (UINT8 *)"User provided memory block is too small"
216 );
217
218 return EFI_BUFFER_TOO_SMALL;
219 }
220 }
221
222 return EFI_SUCCESS;
223}
224
243 IN MTFTP4_PROTOCOL *Instance,
244 IN EFI_MTFTP4_PACKET *Packet,
245 IN UINT32 Len,
246 IN BOOLEAN Multicast,
247 OUT BOOLEAN *Completed
248 )
249{
250 EFI_STATUS Status;
251 UINT16 BlockNum;
252 INTN Expected;
253
254 *Completed = FALSE;
255 Status = EFI_SUCCESS;
256 BlockNum = NTOHS (Packet->Data.Block);
257 Expected = Mtftp4GetNextBlockNum (&Instance->Blocks);
258
259 ASSERT (Expected >= 0);
260
261 //
262 // If we are active (Master) and received an unexpected packet, transmit
263 // the ACK for the block we received, then restart receiving the
264 // expected one. If we are passive (Slave), save the block.
265 //
266 if (Instance->Master && (Expected != BlockNum)) {
267 //
268 // If Expected is 0, (UINT16) (Expected - 1) is also the expected Ack number (65535).
269 //
270 return Mtftp4RrqSendAck (Instance, (UINT16)(Expected - 1));
271 }
272
273 Status = Mtftp4RrqSaveBlock (Instance, Packet, Len);
274
275 if (EFI_ERROR (Status)) {
276 return Status;
277 }
278
279 //
280 // Record the total received and saved block number.
281 //
282 Instance->TotalBlock++;
283
284 //
285 // Reset the passive client's timer whenever it received a
286 // valid data packet.
287 //
288 if (!Instance->Master) {
289 Mtftp4SetTimeout (Instance);
290 }
291
292 //
293 // Check whether we have received all the blocks. Send the ACK if we
294 // are active (unicast client or master client for multicast download).
295 // If we have received all the blocks, send an ACK even if we are passive
296 // to tell the server that we are done.
297 //
298 Expected = Mtftp4GetNextBlockNum (&Instance->Blocks);
299
300 if (Instance->Master || (Expected < 0)) {
301 if (Expected < 0) {
302 //
303 // If we are passive client, then the just received Block maybe
304 // isn't the last block. We need to send an ACK to the last block
305 // to inform the server that we are done. If we are active client,
306 // the Block == Instance->LastBlock.
307 //
308 BlockNum = Instance->LastBlock;
309 *Completed = TRUE;
310 } else {
311 BlockNum = (UINT16)(Expected - 1);
312 }
313
314 if ((Instance->WindowSize == (Instance->TotalBlock - Instance->AckedBlock)) || (Expected < 0)) {
315 Status = Mtftp4RrqSendAck (Instance, BlockNum);
316 }
317 }
318
319 return Status;
320}
321
339BOOLEAN
341 IN MTFTP4_PROTOCOL *This,
342 IN MTFTP4_OPTION *Reply,
343 IN MTFTP4_OPTION *Request
344 )
345{
346 //
347 // It is invalid for server to return options we don't request
348 //
349 if ((Reply->Exist &~Request->Exist) != 0) {
350 return FALSE;
351 }
352
353 //
354 // Server can only specify a smaller block size and window size to be used and
355 // return the timeout matches that requested.
356 //
357 if ((((Reply->Exist & MTFTP4_BLKSIZE_EXIST) != 0) && (Reply->BlkSize > Request->BlkSize)) ||
358 (((Reply->Exist & MTFTP4_WINDOWSIZE_EXIST) != 0) && (Reply->WindowSize > Request->WindowSize)) ||
359 (((Reply->Exist & MTFTP4_TIMEOUT_EXIST) != 0) && (Reply->Timeout != Request->Timeout))
360 )
361 {
362 return FALSE;
363 }
364
365 //
366 // The server can send ",,master" to client to change its master
367 // setting. But if it use the specific multicast channel, it can't
368 // change the setting.
369 //
370 if (((Reply->Exist & MTFTP4_MCAST_EXIST) != 0) && (This->McastIp != 0)) {
371 if ((Reply->McastIp != 0) && (Reply->McastIp != This->McastIp)) {
372 return FALSE;
373 }
374
375 if ((Reply->McastPort != 0) && (Reply->McastPort != This->McastPort)) {
376 return FALSE;
377 }
378 }
379
380 return TRUE;
381}
382
395EFIAPI
397 IN UDP_IO *McastIo,
398 IN VOID *Context
399 )
400{
401 MTFTP4_PROTOCOL *Instance;
403 EFI_UDP4_CONFIG_DATA UdpConfig;
404 EFI_IPv4_ADDRESS Group;
405 EFI_STATUS Status;
406 IP4_ADDR Ip;
407
408 Instance = (MTFTP4_PROTOCOL *)Context;
409 Config = &Instance->Config;
410
411 UdpConfig.AcceptBroadcast = FALSE;
412 UdpConfig.AcceptPromiscuous = FALSE;
413 UdpConfig.AcceptAnyPort = FALSE;
414 UdpConfig.AllowDuplicatePort = FALSE;
415 UdpConfig.TypeOfService = 0;
416 UdpConfig.TimeToLive = 64;
417 UdpConfig.DoNotFragment = FALSE;
418 UdpConfig.ReceiveTimeout = 0;
419 UdpConfig.TransmitTimeout = 0;
420 UdpConfig.UseDefaultAddress = Config->UseDefaultSetting;
421 IP4_COPY_ADDRESS (&UdpConfig.StationAddress, &Config->StationIp);
422 IP4_COPY_ADDRESS (&UdpConfig.SubnetMask, &Config->SubnetMask);
423 UdpConfig.StationPort = Instance->McastPort;
424 UdpConfig.RemotePort = 0;
425
426 Ip = HTONL (Instance->ServerIp);
427 IP4_COPY_ADDRESS (&UdpConfig.RemoteAddress, &Ip);
428
429 Status = McastIo->Protocol.Udp4->Configure (McastIo->Protocol.Udp4, &UdpConfig);
430
431 if (EFI_ERROR (Status)) {
432 return Status;
433 }
434
435 if (!Config->UseDefaultSetting &&
436 !EFI_IP4_EQUAL (&mZeroIp4Addr, &Config->GatewayIp))
437 {
438 //
439 // The station IP address is manually configured and the Gateway IP is not 0.
440 // Add the default route for this UDP instance.
441 //
442 Status = McastIo->Protocol.Udp4->Routes (
443 McastIo->Protocol.Udp4,
444 FALSE,
445 &mZeroIp4Addr,
446 &mZeroIp4Addr,
447 &Config->GatewayIp
448 );
449
450 if (EFI_ERROR (Status)) {
451 McastIo->Protocol.Udp4->Configure (McastIo->Protocol.Udp4, NULL);
452 return Status;
453 }
454 }
455
456 //
457 // join the multicast group
458 //
459 Ip = HTONL (Instance->McastIp);
460 IP4_COPY_ADDRESS (&Group, &Ip);
461
462 return McastIo->Protocol.Udp4->Groups (McastIo->Protocol.Udp4, TRUE, &Group);
463}
464
484 IN OUT MTFTP4_PROTOCOL *Instance,
485 IN EFI_MTFTP4_PACKET *Packet,
486 IN UINT32 Len,
487 IN BOOLEAN Multicast,
488 OUT BOOLEAN *Completed
489 )
490{
491 MTFTP4_OPTION Reply;
492 EFI_STATUS Status;
493 INTN Expected;
494 EFI_UDP4_PROTOCOL *Udp4;
495
496 *Completed = FALSE;
497
498 //
499 // If already started the master download, don't change the
500 // setting. Master download always succeeds.
501 //
502 Expected = Mtftp4GetNextBlockNum (&Instance->Blocks);
503 ASSERT (Expected != -1);
504
505 if (Instance->Master && (Expected != 1)) {
506 return EFI_SUCCESS;
507 }
508
509 //
510 // Parse and validate the options from server
511 //
512 ZeroMem (&Reply, sizeof (MTFTP4_OPTION));
513
514 Status = Mtftp4ParseOptionOack (Packet, Len, Instance->Operation, &Reply);
515
516 if (EFI_ERROR (Status) ||
517 !Mtftp4RrqOackValid (Instance, &Reply, &Instance->RequestOption))
518 {
519 //
520 // Don't send an ERROR packet if the error is EFI_OUT_OF_RESOURCES.
521 //
522 if (Status != EFI_OUT_OF_RESOURCES) {
524 Instance,
525 EFI_MTFTP4_ERRORCODE_ILLEGAL_OPERATION,
526 (UINT8 *)"Malformatted OACK packet"
527 );
528 }
529
530 return EFI_TFTP_ERROR;
531 }
532
533 if ((Reply.Exist & MTFTP4_MCAST_EXIST) != 0) {
534 //
535 // Save the multicast info. Always update the Master, only update the
536 // multicast IP address, block size, window size, timeout at the first time.
537 // If IP address is updated, create a UDP child to receive the multicast.
538 //
539 Instance->Master = Reply.Master;
540
541 if (Instance->McastIp == 0) {
542 if ((Reply.McastIp == 0) || (Reply.McastPort == 0)) {
544 Instance,
545 EFI_MTFTP4_ERRORCODE_ILLEGAL_OPERATION,
546 (UINT8 *)"Illegal multicast setting"
547 );
548
549 return EFI_TFTP_ERROR;
550 }
551
552 //
553 // Create a UDP child then start receive the multicast from it.
554 //
555 Instance->McastIp = Reply.McastIp;
556 Instance->McastPort = Reply.McastPort;
557 if (Instance->McastUdpPort == NULL) {
558 Instance->McastUdpPort = UdpIoCreateIo (
559 Instance->Service->Controller,
560 Instance->Service->Image,
562 UDP_IO_UDP4_VERSION,
563 Instance
564 );
565 if (Instance->McastUdpPort != NULL) {
566 Status = gBS->OpenProtocol (
567 Instance->McastUdpPort->UdpHandle,
568 &gEfiUdp4ProtocolGuid,
569 (VOID **)&Udp4,
570 Instance->Service->Image,
571 Instance->Handle,
572 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
573 );
574 if (EFI_ERROR (Status)) {
575 UdpIoFreeIo (Instance->McastUdpPort);
576 Instance->McastUdpPort = NULL;
577 return EFI_DEVICE_ERROR;
578 }
579 }
580 }
581
582 if (Instance->McastUdpPort == NULL) {
583 return EFI_DEVICE_ERROR;
584 }
585
586 Status = UdpIoRecvDatagram (Instance->McastUdpPort, Mtftp4RrqInput, Instance, 0);
587
588 if (EFI_ERROR (Status)) {
590 Instance,
591 EFI_MTFTP4_ERRORCODE_ACCESS_VIOLATION,
592 (UINT8 *)"Failed to create socket to receive multicast packet"
593 );
594
595 return Status;
596 }
597
598 //
599 // Update the parameters used.
600 //
601 if (Reply.BlkSize != 0) {
602 Instance->BlkSize = Reply.BlkSize;
603 }
604
605 if (Reply.WindowSize != 0) {
606 Instance->WindowSize = Reply.WindowSize;
607 }
608
609 if (Reply.Timeout != 0) {
610 Instance->Timeout = Reply.Timeout;
611 }
612 }
613 } else {
614 Instance->Master = TRUE;
615
616 if (Reply.BlkSize != 0) {
617 Instance->BlkSize = Reply.BlkSize;
618 }
619
620 if (Reply.WindowSize != 0) {
621 Instance->WindowSize = Reply.WindowSize;
622 }
623
624 if (Reply.Timeout != 0) {
625 Instance->Timeout = Reply.Timeout;
626 }
627 }
628
629 //
630 // Send an ACK to (Expected - 1) which is 0 for unicast download,
631 // or tell the server we want to receive the Expected block.
632 //
633 return Mtftp4RrqSendAck (Instance, (UINT16)(Expected - 1));
634}
635
645VOID
646EFIAPI
648 IN NET_BUF *UdpPacket,
649 IN UDP_END_POINT *EndPoint,
650 IN EFI_STATUS IoStatus,
651 IN VOID *Context
652 )
653{
654 MTFTP4_PROTOCOL *Instance;
655 EFI_MTFTP4_PACKET *Packet;
656 BOOLEAN Completed;
657 BOOLEAN Multicast;
658 EFI_STATUS Status;
659 UINT16 Opcode;
660 UINT32 Len;
661
662 Instance = (MTFTP4_PROTOCOL *)Context;
663 NET_CHECK_SIGNATURE (Instance, MTFTP4_PROTOCOL_SIGNATURE);
664
665 Status = EFI_SUCCESS;
666 Packet = NULL;
667 Completed = FALSE;
668 Multicast = FALSE;
669
670 if (EFI_ERROR (IoStatus)) {
671 Status = IoStatus;
672 goto ON_EXIT;
673 }
674
675 ASSERT (UdpPacket != NULL);
676
677 //
678 // Find the port this packet is from to restart receive correctly.
679 //
680 Multicast = (BOOLEAN)(EndPoint->LocalAddr.Addr[0] == Instance->McastIp);
681
682 if (UdpPacket->TotalSize < MTFTP4_OPCODE_LEN) {
683 goto ON_EXIT;
684 }
685
686 //
687 // Client send initial request to server's listening port. Server
688 // will select a UDP port to communicate with the client. The server
689 // is required to use the same port as RemotePort to multicast the
690 // data.
691 //
692 if (EndPoint->RemotePort != Instance->ConnectedPort) {
693 if (Instance->ConnectedPort != 0) {
694 goto ON_EXIT;
695 } else {
696 Instance->ConnectedPort = EndPoint->RemotePort;
697 }
698 }
699
700 //
701 // Copy the MTFTP packet to a continuous buffer if it isn't already so.
702 //
703 Len = UdpPacket->TotalSize;
704
705 if (UdpPacket->BlockOpNum > 1) {
706 Packet = AllocatePool (Len);
707
708 if (Packet == NULL) {
709 Status = EFI_OUT_OF_RESOURCES;
710 goto ON_EXIT;
711 }
712
713 NetbufCopy (UdpPacket, 0, Len, (UINT8 *)Packet);
714 } else {
715 Packet = (EFI_MTFTP4_PACKET *)NetbufGetByte (UdpPacket, 0, NULL);
716 ASSERT (Packet != NULL);
717 }
718
719 Opcode = NTOHS (Packet->OpCode);
720
721 //
722 // Call the user's CheckPacket if provided. Abort the transmission
723 // if CheckPacket returns an EFI_ERROR code.
724 //
725 if ((Instance->Token->CheckPacket != NULL) &&
726 ((Opcode == EFI_MTFTP4_OPCODE_OACK) || (Opcode == EFI_MTFTP4_OPCODE_ERROR)))
727 {
728 Status = Instance->Token->CheckPacket (
729 &Instance->Mtftp4,
730 Instance->Token,
731 (UINT16)Len,
732 Packet
733 );
734
735 if (EFI_ERROR (Status)) {
736 //
737 // Send an error message to the server to inform it
738 //
739 if (Opcode != EFI_MTFTP4_OPCODE_ERROR) {
741 Instance,
742 EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,
743 (UINT8 *)"User aborted the transfer"
744 );
745 }
746
747 Status = EFI_ABORTED;
748 goto ON_EXIT;
749 }
750 }
751
752 switch (Opcode) {
753 case EFI_MTFTP4_OPCODE_DATA:
754 if ((Len > (UINT32)(MTFTP4_DATA_HEAD_LEN + Instance->BlkSize)) ||
755 (Len < (UINT32)MTFTP4_DATA_HEAD_LEN))
756 {
757 goto ON_EXIT;
758 }
759
760 Status = Mtftp4RrqHandleData (Instance, Packet, Len, Multicast, &Completed);
761 break;
762
763 case EFI_MTFTP4_OPCODE_OACK:
764 if (Multicast || (Len <= MTFTP4_OPCODE_LEN)) {
765 goto ON_EXIT;
766 }
767
768 Status = Mtftp4RrqHandleOack (Instance, Packet, Len, Multicast, &Completed);
769 break;
770
771 case EFI_MTFTP4_OPCODE_ERROR:
772 Status = EFI_TFTP_ERROR;
773 break;
774
775 default:
776 break;
777 }
778
779ON_EXIT:
780
781 //
782 // Free the resources, then if !EFI_ERROR (Status), restart the
783 // receive, otherwise end the session.
784 //
785 if ((Packet != NULL) && (UdpPacket->BlockOpNum > 1)) {
786 FreePool (Packet);
787 }
788
789 if (UdpPacket != NULL) {
790 NetbufFree (UdpPacket);
791 }
792
793 if (!EFI_ERROR (Status) && !Completed) {
794 if (Multicast) {
795 Status = UdpIoRecvDatagram (Instance->McastUdpPort, Mtftp4RrqInput, Instance, 0);
796 } else {
797 Status = UdpIoRecvDatagram (Instance->UnicastPort, Mtftp4RrqInput, Instance, 0);
798 }
799 }
800
801 if (EFI_ERROR (Status) || Completed) {
802 Mtftp4CleanOperation (Instance, Status);
803 }
804}
INT64 INTN
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
Definition: MultU64x32.c:27
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define NULL
Definition: Base.h:319
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
VOID Mtftp4CleanOperation(IN OUT MTFTP4_PROTOCOL *Instance, IN EFI_STATUS Result)
Definition: Mtftp4Impl.c:20
EFI_STATUS Mtftp4ParseOptionOack(IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, IN UINT16 Operation, OUT MTFTP4_OPTION *MtftpOption)
Definition: Mtftp4Option.c:512
EFI_STATUS Mtftp4RrqStart(IN MTFTP4_PROTOCOL *Instance, IN UINT16 Operation)
Definition: Mtftp4Rrq.c:45
EFI_STATUS Mtftp4RrqHandleOack(IN OUT MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len, IN BOOLEAN Multicast, OUT BOOLEAN *Completed)
Definition: Mtftp4Rrq.c:483
EFI_STATUS Mtftp4RrqHandleData(IN MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len, IN BOOLEAN Multicast, OUT BOOLEAN *Completed)
Definition: Mtftp4Rrq.c:242
BOOLEAN Mtftp4RrqOackValid(IN MTFTP4_PROTOCOL *This, IN MTFTP4_OPTION *Reply, IN MTFTP4_OPTION *Request)
Definition: Mtftp4Rrq.c:340
EFI_STATUS Mtftp4RrqSaveBlock(IN OUT MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len)
Definition: Mtftp4Rrq.c:135
EFI_STATUS EFIAPI Mtftp4RrqConfigMcastPort(IN UDP_IO *McastIo, IN VOID *Context)
Definition: Mtftp4Rrq.c:396
VOID EFIAPI Mtftp4RrqInput(IN NET_BUF *UdpPacket, IN UDP_END_POINT *EndPoint, IN EFI_STATUS IoStatus, IN VOID *Context)
Definition: Mtftp4Rrq.c:647
EFI_STATUS Mtftp4RrqSendAck(IN MTFTP4_PROTOCOL *Instance, IN UINT16 BlkNo)
Definition: Mtftp4Rrq.c:85
EFI_STATUS Mtftp4InitBlockRange(IN LIST_ENTRY *Head, IN UINT16 Start, IN UINT16 End)
Definition: Mtftp4Support.c:64
VOID Mtftp4SetLastBlockNum(IN LIST_ENTRY *Head, IN UINT16 Last)
EFI_STATUS Mtftp4SendRequest(IN MTFTP4_PROTOCOL *Instance)
VOID Mtftp4SetTimeout(IN OUT MTFTP4_PROTOCOL *Instance)
INTN Mtftp4GetNextBlockNum(IN LIST_ENTRY *Head)
Definition: Mtftp4Support.c:91
EFI_STATUS Mtftp4SendError(IN MTFTP4_PROTOCOL *Instance, IN UINT16 ErrCode, IN UINT8 *ErrInfo)
EFI_STATUS Mtftp4RemoveBlockNum(IN LIST_ENTRY *Head, IN UINT16 Num, IN BOOLEAN Completed, OUT UINT64 *BlockCounter)
EFI_STATUS Mtftp4SendPacket(IN OUT MTFTP4_PROTOCOL *Instance, IN OUT NET_BUF *Packet)
VOID EFIAPI NetbufFree(IN NET_BUF *Nbuf)
Definition: NetBuffer.c:195
UINT32 EFIAPI NetbufCopy(IN NET_BUF *Nbuf, IN UINT32 Offset, IN UINT32 Len, IN UINT8 *Dest)
Definition: NetBuffer.c:1206
NET_BUF *EFIAPI NetbufAlloc(IN UINT32 Len)
Definition: NetBuffer.c:89
UINT8 *EFIAPI NetbufAllocSpace(IN OUT NET_BUF *Nbuf, IN UINT32 Len, IN BOOLEAN FromHead)
Definition: NetBuffer.c:1015
UINT8 *EFIAPI NetbufGetByte(IN NET_BUF *Nbuf, IN UINT32 Offset, OUT UINT32 *Index OPTIONAL)
Definition: NetBuffer.c:359
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI UdpIoRecvDatagram(IN UDP_IO *UdpIo, IN UDP_IO_CALLBACK CallBack, IN VOID *Context, IN UINT32 HeadLen)
Definition: DxeUdpIoLib.c:1084
EFI_STATUS EFIAPI UdpIoFreeIo(IN UDP_IO *UdpIo)
Definition: DxeUdpIoLib.c:809
UDP_IO *EFIAPI UdpIoCreateIo(IN EFI_HANDLE Controller, IN EFI_HANDLE ImageHandle, IN UDP_IO_CONFIG Configure, IN UINT8 UdpVersion, IN VOID *Context)
Definition: DxeUdpIoLib.c:602
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_MTFTP4_CHECK_PACKET CheckPacket
Definition: Mtftp4.h:562
UINT64 BufferSize
Definition: Mtftp4.h:547
VOID * Buffer
Definition: Mtftp4.h:553
UINT16 OpCode
Definition: Mtftp4.h:101
EFI_MTFTP4_ACK_HEADER Ack
Definition: Mtftp4.h:121