PXENV_TFTP_GET_FSIZE
[PXE TFTP API]

TFTP GET FILE SIZE. More...


Data Structures

struct  s_PXENV_TFTP_GET_FSIZE
 Parameter block for pxenv_tftp_get_fsize(). More...

Defines

#define PXENV_TFTP_GET_FSIZE   0x0025
 PXE API function code for pxenv_tftp_get_fsize().

Typedefs

typedef struct
s_PXENV_TFTP_GET_FSIZE 
PXENV_TFTP_GET_FSIZE_t

Functions

PXENV_EXIT_t pxenv_tftp_get_fsize (struct s_PXENV_TFTP_GET_FSIZE *get_fsize)
 TFTP GET FILE SIZE.


Detailed Description

TFTP GET FILE SIZE.

Define Documentation

#define PXENV_TFTP_GET_FSIZE   0x0025

PXE API function code for pxenv_tftp_get_fsize().

Definition at line 706 of file pxe_api.h.

Referenced by pxe_api_call().


Typedef Documentation

Definition at line 717 of file pxe_api.h.


Function Documentation

PXENV_EXIT_t pxenv_tftp_get_fsize ( struct s_PXENV_TFTP_GET_FSIZE tftp_get_fsize  ) 

TFTP GET FILE SIZE.

Parameters:
tftp_get_fsize Pointer to a struct s_PXENV_TFTP_GET_FSIZE
s_PXENV_TFTP_GET_FSIZE::ServerIPAddress TFTP server IP address
s_PXENV_TFTP_GET_FSIZE::GatewayIPAddress Relay agent IP address
s_PXENV_TFTP_GET_FSIZE::FileName File name
Return values:
PXENV_EXIT_SUCCESS File size was determined successfully
PXENV_EXIT_FAILURE File size was not determined
s_PXENV_TFTP_GET_FSIZE::Status PXE status code
s_PXENV_TFTP_GET_FSIZE::FileSize File size
Determine the size of a file on a TFTP server. This uses the "tsize" TFTP option, and so will not work with a TFTP server that does not support TFTP options, or that does not support the "tsize" option.

The PXE specification states that this API call will not open a TFTP connection for subsequent use with pxenv_tftp_read(). (This is somewhat daft, since the only way to obtain the file size via the "tsize" option involves issuing a TFTP open request, but that's life.)

You cannot call pxenv_tftp_get_fsize() while a TFTP or UDP connection is open.

If s_PXENV_TFTP_GET_FSIZE::GatewayIPAddress is 0.0.0.0, normal IP routing will take place. See the relevant implementation note for more details.

On x86, you must set the s_PXE::StatusCallout field to a nonzero value before calling this function in protected mode. You cannot call this function with a 32-bit stack segment. (See the relevant implementation note for more details.)

Note:
There is no way to specify the TFTP server port with this API call. Though you can open a file using a non-standard TFTP server port (via s_PXENV_TFTP_OPEN::TFTPPort or, potentially, s_PXENV_TFTP_READ_FILE::TFTPSrvPort), you can only get the size of a file from a TFTP server listening on the standard TFTP port. "Consistency" is not a word in Intel's vocabulary.

Definition at line 542 of file pxe_tftp.c.

References DBG, EINPROGRESS, s_PXENV_TFTP_GET_FSIZE::FileName, s_PXENV_TFTP_GET_FSIZE::FileSize, pxe_tftp_connection::max_offset, pxe_tftp_close(), pxe_tftp_open(), PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS, pxe_tftp_connection::rc, s_PXENV_TFTP_GET_FSIZE::ServerIPAddress, s_PXENV_TFTP_GET_FSIZE::Status, and step().

Referenced by pxe_api_call().

00543                                                       {
00544         int rc;
00545 
00546         DBG ( "PXENV_TFTP_GET_FSIZE" );
00547 
00548         /* Open TFTP file */
00549         if ( ( rc = pxe_tftp_open ( tftp_get_fsize->ServerIPAddress, 0,
00550                                     tftp_get_fsize->FileName, 0, 1 ) ) != 0 ) {
00551                 tftp_get_fsize->Status = PXENV_STATUS ( rc );
00552                 return PXENV_EXIT_FAILURE;
00553         }
00554 
00555         /* Wait for initial seek to arrive, and record size */
00556         while ( ( ( rc = pxe_tftp.rc ) == -EINPROGRESS ) &&
00557                 ( pxe_tftp.max_offset == 0 ) ) {
00558                 step();
00559         }
00560         tftp_get_fsize->FileSize = pxe_tftp.max_offset;
00561         DBG ( " fsize=%d", tftp_get_fsize->FileSize );
00562 
00563         /* EINPROGRESS is normal; we don't wait for the whole transfer */
00564         if ( rc == -EINPROGRESS )
00565                 rc = 0;
00566 
00567         /* Close TFTP file */
00568         pxe_tftp_close ( rc );
00569 
00570         tftp_get_fsize->Status = PXENV_STATUS ( rc );
00571         return ( rc ? PXENV_EXIT_FAILURE : PXENV_EXIT_SUCCESS );
00572 }


Generated on Tue Apr 6 20:01:59 2010 for gPXE by  doxygen 1.5.7.1