TianoCore EDK2 master
Loading...
Searching...
No Matches
Mtftp4Option.c File Reference
#include "Mtftp4Impl.h"

Go to the source code of this file.

Functions

BOOLEAN NetStringEqualNoCase (IN UINT8 *Str1, IN UINT8 *Str2)
 
UINT32 NetStringToU32 (IN UINT8 *Str)
 
EFI_STATUS NetStringToIp (IN UINT8 *Str, OUT IP4_ADDR *Ip)
 
EFI_STATUS Mtftp4FillOptions (IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, IN OUT UINT32 *Count, OUT EFI_MTFTP4_OPTION *Options OPTIONAL)
 
EFI_STATUS Mtftp4ExtractOptions (IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, OUT UINT32 *OptionCount, OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL)
 
EFI_STATUS Mtftp4ExtractMcast (IN UINT8 *Value, IN OUT MTFTP4_OPTION *Option)
 
EFI_STATUS Mtftp4ParseOption (IN EFI_MTFTP4_OPTION *Options, IN UINT32 Count, IN BOOLEAN Request, IN UINT16 Operation, OUT MTFTP4_OPTION *MtftpOption)
 
EFI_STATUS Mtftp4ParseOptionOack (IN EFI_MTFTP4_PACKET *Packet, IN UINT32 PacketLen, IN UINT16 Operation, OUT MTFTP4_OPTION *MtftpOption)
 

Variables

CHAR8 * mMtftp4SupportedOptions [MTFTP4_SUPPORTED_OPTIONS]
 

Detailed Description

Routines to process MTFTP4 options.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Mtftp4Option.c.

Function Documentation

◆ Mtftp4ExtractMcast()

EFI_STATUS Mtftp4ExtractMcast ( IN UINT8 *  Value,
IN OUT MTFTP4_OPTION Option 
)

Parse the MTFTP multicast option.

Parameters
ValueThe Mtftp multicast value string
OptionThe option to save the info into.
Return values
EFI_INVALID_PARAMETERThe multicast value string is invalid.
EFI_SUCCESSThe multicast value is parsed into the Option

Definition at line 302 of file Mtftp4Option.c.

◆ Mtftp4ExtractOptions()

EFI_STATUS Mtftp4ExtractOptions ( IN EFI_MTFTP4_PACKET Packet,
IN UINT32  PacketLen,
OUT UINT32 *  OptionCount,
OUT EFI_MTFTP4_OPTION **OptionList  OPTIONAL 
)

Allocate and fill in a array of Mtftp options from the Packet.

It first calls Mtftp4FillOption to get the option number, then allocate the array, at last, call Mtftp4FillOption again to save the options.

Parameters
PacketThe packet to parse
PacketLenThe length of the packet
OptionCountThe number of options in the packet
OptionListThe point to get the option array.
Return values
EFI_INVALID_PARAMETERThe parametera are invalid or packet isn't a well-formatted OACK packet.
EFI_SUCCESSThe option array is build
EFI_OUT_OF_RESOURCESFailed to allocate memory for the array

Definition at line 234 of file Mtftp4Option.c.

◆ Mtftp4FillOptions()

EFI_STATUS Mtftp4FillOptions ( IN EFI_MTFTP4_PACKET Packet,
IN UINT32  PacketLen,
IN OUT UINT32 *  Count,
OUT EFI_MTFTP4_OPTION *Options  OPTIONAL 
)

Go through the packet to fill the Options array with the start addresses of each MTFTP option name/value pair.

Parameters
PacketThe packet to check
PacketLenThe packet's length
CountThe size of the Options on input. The actual options on output
OptionsThe option array to fill in
Return values
EFI_INVALID_PARAMETERThe packet is malformatted
EFI_BUFFER_TOO_SMALLThe Options array is too small
EFI_SUCCESSThe packet has been parsed into the Options array.

Definition at line 160 of file Mtftp4Option.c.

◆ Mtftp4ParseOption()

EFI_STATUS Mtftp4ParseOption ( IN EFI_MTFTP4_OPTION Options,
IN UINT32  Count,
IN BOOLEAN  Request,
IN UINT16  Operation,
OUT MTFTP4_OPTION MtftpOption 
)

Parse the option in Options array to MTFTP4_OPTION which program can access directly.

Parameters
OptionsThe option array, which contains addresses of each option's name/value string.
CountThe number of options in the Options
RequestWhether this is a request or OACK. The format of multicast is different according to this setting.
OperationThe current performed operation.
MtftpOptionThe MTFTP4_OPTION for easy access.
Return values
EFI_INVALID_PARAMETERThe option is malformatted
EFI_UNSUPPORTEDSome option isn't supported
EFI_SUCCESSThe option are OK and has been parsed.

Definition at line 400 of file Mtftp4Option.c.

◆ Mtftp4ParseOptionOack()

EFI_STATUS Mtftp4ParseOptionOack ( IN EFI_MTFTP4_PACKET Packet,
IN UINT32  PacketLen,
IN UINT16  Operation,
OUT MTFTP4_OPTION MtftpOption 
)

Parse the options in the OACK packet to MTFTP4_OPTION which program can access directly.

Parameters
PacketThe OACK packet to parse
PacketLenThe length of the packet
OperationThe current performed operation.
MtftpOptionThe MTFTP_OPTION for easy access.
Return values
EFI_INVALID_PARAMETERThe packet option is malformatted
EFI_UNSUPPORTEDSome option isn't supported
EFI_SUCCESSThe option are OK and has been parsed.

Definition at line 512 of file Mtftp4Option.c.

◆ NetStringEqualNoCase()

BOOLEAN NetStringEqualNoCase ( IN UINT8 *  Str1,
IN UINT8 *  Str2 
)

Check whether two ascii strings are equal, ignore the case.

Parameters
Str1The first ascii string
Str2The second ascii string
Return values
TRUETwo strings are equal when case is ignored.
FALSETwo strings are not equal.

Definition at line 30 of file Mtftp4Option.c.

◆ NetStringToIp()

EFI_STATUS NetStringToIp ( IN UINT8 *  Str,
OUT IP4_ADDR *  Ip 
)

Convert a string of the format "192.168.0.1" to an IP address.

Parameters
StrThe string representation of IP
IpThe variable to get IP.
Return values
EFI_INVALID_PARAMETERThe IP string is invalid.
EFI_SUCCESSThe IP is parsed into the Ip

Definition at line 100 of file Mtftp4Option.c.

◆ NetStringToU32()

UINT32 NetStringToU32 ( IN UINT8 *  Str)

Convert a string to a UINT32 number.

Parameters
StrThe string to convert from
Returns
The number get from the string

Definition at line 72 of file Mtftp4Option.c.

Variable Documentation

◆ mMtftp4SupportedOptions

CHAR8* mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS]
Initial value:
= {
"blksize",
"windowsize",
"timeout",
"tsize",
"multicast"
}

Definition at line 11 of file Mtftp4Option.c.