11CHAR8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS] = {
38 ASSERT ((Str1 !=
NULL) && (Str2 !=
NULL));
40 for ( ; (*Str1 !=
'\0') && (*Str2 !=
'\0'); Str1++, Str2++) {
47 if ((
'A' <= Ch1) && (Ch1 <=
'Z')) {
51 if ((
'A' <= Ch2) && (Ch2 <=
'Z')) {
60 return (BOOLEAN)(*Str1 == *Str2);
82 for ( ; NET_IS_DIGIT (*Str); Str++) {
83 Num = Num * 10 + (*Str -
'0');
112 for (Index = 0; Index < 4; Index++) {
113 if (!NET_IS_DIGIT (*Str)) {
114 return EFI_INVALID_PARAMETER;
120 return EFI_INVALID_PARAMETER;
123 Addr = (Addr << 8) | Byte;
128 while (NET_IS_DIGIT (*Str)) {
132 if ((Index < 3) && (*Str !=
'.')) {
133 return EFI_INVALID_PARAMETER;
163 IN OUT UINT32 *Count,
174 Cur = (UINT8 *)Packet + MTFTP4_OPCODE_LEN;
175 Last = (UINT8 *)Packet + PacketLen - 1;
188 return EFI_INVALID_PARAMETER;
199 if ((Options !=
NULL) && (Num <= *Count)) {
200 Options[Num - 1].OptionStr = Name;
201 Options[Num - 1].ValueStr = Value;
207 if ((*Count < Num) || (Options ==
NULL)) {
209 return EFI_BUFFER_TOO_SMALL;
237 OUT UINT32 *OptionCount,
245 if (OptionList !=
NULL) {
249 if (NTOHS (Packet->OpCode) != EFI_MTFTP4_OPCODE_OACK) {
250 return EFI_INVALID_PARAMETER;
253 if (PacketLen == MTFTP4_OPCODE_LEN) {
260 if (*((UINT8 *)Packet + PacketLen - 1) != 0) {
261 return EFI_INVALID_PARAMETER;
269 if ((Status ==
EFI_SUCCESS) || (Status != EFI_BUFFER_TOO_SMALL)) {
277 if (OptionList ==
NULL) {
283 if (*OptionList ==
NULL) {
284 return EFI_OUT_OF_RESOURCES;
319 if (EFI_ERROR (Status)) {
323 while ((*Value != 0) && (*Value !=
',')) {
329 return EFI_INVALID_PARAMETER;
339 Option->McastPort = 0;
344 return EFI_INVALID_PARAMETER;
347 Option->McastPort = (UINT16)Num;
349 while (NET_IS_DIGIT (*Value)) {
355 return EFI_INVALID_PARAMETER;
365 if ((Num != 0) && (Num != 1)) {
366 return EFI_INVALID_PARAMETER;
369 Option->Master = (BOOLEAN)(Num == 1);
371 while (NET_IS_DIGIT (*Value)) {
375 if (*Value !=
'\0') {
376 return EFI_INVALID_PARAMETER;
413 MtftpOption->Exist = 0;
415 for (Index = 0; Index < Count; Index++) {
416 This = Options + Index;
418 if ((This->OptionStr ==
NULL) || (This->ValueStr ==
NULL)) {
419 return EFI_INVALID_PARAMETER;
428 if ((Value < 8) || (Value > 65464)) {
429 return EFI_INVALID_PARAMETER;
432 MtftpOption->BlkSize = (UINT16)Value;
433 MtftpOption->Exist |= MTFTP4_BLKSIZE_EXIST;
440 if ((Value < 1) || (Value > 255)) {
441 return EFI_INVALID_PARAMETER;
444 MtftpOption->Timeout = (UINT8)Value;
450 MtftpOption->Exist |= MTFTP4_TSIZE_EXIST;
457 if (*(This->ValueStr) !=
'\0') {
458 return EFI_INVALID_PARAMETER;
463 if (EFI_ERROR (Status)) {
468 MtftpOption->Exist |= MTFTP4_MCAST_EXIST;
470 if (Operation == EFI_MTFTP4_OPCODE_WRQ) {
474 return EFI_UNSUPPORTED;
480 return EFI_INVALID_PARAMETER;
483 MtftpOption->WindowSize = (UINT16)Value;
484 MtftpOption->Exist |= MTFTP4_WINDOWSIZE_EXIST;
485 }
else if (Request) {
490 return EFI_UNSUPPORTED;
523 MtftpOption->Exist = 0;
527 if (EFI_ERROR (Status) || (Count == 0)) {
531 ASSERT (OptionList !=
NULL);
VOID EFIAPI FreePool(IN VOID *Buffer)
BOOLEAN NetStringEqualNoCase(IN UINT8 *Str1, IN UINT8 *Str2)
EFI_STATUS Mtftp4ExtractOptions(IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, OUT UINT32 *OptionCount, OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL)
EFI_STATUS Mtftp4ParseOption(IN EFI_MTFTP4_OPTION *Options, IN UINT32 Count, IN BOOLEAN Request, IN UINT16 Operation, OUT MTFTP4_OPTION *MtftpOption)
UINT32 NetStringToU32(IN UINT8 *Str)
EFI_STATUS NetStringToIp(IN UINT8 *Str, OUT IP4_ADDR *Ip)
EFI_STATUS Mtftp4ExtractMcast(IN UINT8 *Value, IN OUT MTFTP4_OPTION *Option)
EFI_STATUS Mtftp4FillOptions(IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, IN OUT UINT32 *Count, OUT EFI_MTFTP4_OPTION *Options OPTIONAL)
EFI_STATUS Mtftp4ParseOptionOack(IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, IN UINT16 Operation, OUT MTFTP4_OPTION *MtftpOption)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)