iPXE
Data Structures | Defines | Enumerations | Functions | Variables
tftp.c File Reference

TFTP protocol. More...

#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <byteswap.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/refcnt.h>
#include <ipxe/iobuf.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>
#include <ipxe/uri.h>
#include <ipxe/tcpip.h>
#include <ipxe/retry.h>
#include <ipxe/features.h>
#include <ipxe/bitmap.h>
#include <ipxe/settings.h>
#include <ipxe/dhcp.h>
#include <ipxe/tftp.h>

Go to the source code of this file.

Data Structures

struct  tftp_request
 A TFTP request. More...
struct  tftp_option
 A TFTP option. More...

Defines

#define EINVAL_BLKSIZE   __einfo_error ( EINFO_EINVAL_BLKSIZE )
#define EINFO_EINVAL_BLKSIZE
#define EINVAL_TSIZE   __einfo_error ( EINFO_EINVAL_TSIZE )
#define EINFO_EINVAL_TSIZE
#define EINVAL_MC_NO_PORT   __einfo_error ( EINFO_EINVAL_MC_NO_PORT )
#define EINFO_EINVAL_MC_NO_PORT
#define EINVAL_MC_NO_MC   __einfo_error ( EINFO_EINVAL_MC_NO_MC )
#define EINFO_EINVAL_MC_NO_MC
#define EINVAL_MC_INVALID_MC   __einfo_error ( EINFO_EINVAL_MC_INVALID_MC )
#define EINFO_EINVAL_MC_INVALID_MC
#define EINVAL_MC_INVALID_IP   __einfo_error ( EINFO_EINVAL_MC_INVALID_IP )
#define EINFO_EINVAL_MC_INVALID_IP
#define EINVAL_MC_INVALID_PORT   __einfo_error ( EINFO_EINVAL_MC_INVALID_PORT )
#define EINFO_EINVAL_MC_INVALID_PORT
#define MTFTP_MAX_TIMEOUTS   3
 Maximum number of MTFTP open requests before falling back to TFTP.

Enumerations

enum  { TFTP_FL_SEND_ACK = 0x0001, TFTP_FL_RRQ_SIZES = 0x0002, TFTP_FL_RRQ_MULTICAST = 0x0004, TFTP_FL_MTFTP_RECOVERY = 0x0008 }
 TFTP request flags. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FEATURE (FEATURE_PROTOCOL,"TFTP", DHCP_EB_FEATURE_TFTP, 1)
static void tftp_free (struct refcnt *refcnt)
 Free TFTP request.
static void tftp_done (struct tftp_request *tftp, int rc)
 Mark TFTP request as complete.
static int tftp_reopen (struct tftp_request *tftp)
 Reopen TFTP socket.
static int tftp_reopen_mc (struct tftp_request *tftp, struct sockaddr *local)
 Reopen TFTP multicast socket.
static int tftp_presize (struct tftp_request *tftp, size_t filesize)
 Presize TFTP receive buffers and block bitmap.
void tftp_set_mtftp_address (struct in_addr address)
 Set MTFTP multicast address.
void tftp_set_mtftp_port (unsigned int port)
 Set MTFTP multicast port.
static int tftp_send_rrq (struct tftp_request *tftp)
 Transmit RRQ.
static int tftp_send_ack (struct tftp_request *tftp)
 Transmit ACK.
static int tftp_send_error (struct tftp_request *tftp, int errcode, const char *errmsg)
 Transmit ERROR (Abort)
static int tftp_send_packet (struct tftp_request *tftp)
 Transmit next relevant packet.
static void tftp_timer_expired (struct retry_timer *timer, int fail)
 Handle TFTP retransmission timer expiry.
static int tftp_process_blksize (struct tftp_request *tftp, const char *value)
 Process TFTP "blksize" option.
static int tftp_process_tsize (struct tftp_request *tftp, const char *value)
 Process TFTP "tsize" option.
static int tftp_process_multicast (struct tftp_request *tftp, const char *value)
 Process TFTP "multicast" option.
static int tftp_process_option (struct tftp_request *tftp, const char *name, const char *value)
 Process TFTP option.
static int tftp_rx_oack (struct tftp_request *tftp, void *buf, size_t len)
 Receive OACK.
static int tftp_rx_data (struct tftp_request *tftp, struct io_buffer *iobuf)
 Receive DATA.
static int tftp_errcode_to_rc (unsigned int errcode)
 Convert TFTP error code to return status code.
static int tftp_rx_error (struct tftp_request *tftp, void *buf, size_t len)
 Receive ERROR.
static int tftp_rx (struct tftp_request *tftp, struct io_buffer *iobuf, struct xfer_metadata *meta)
 Receive new data.
static int tftp_socket_deliver (struct tftp_request *tftp, struct io_buffer *iobuf, struct xfer_metadata *meta)
 Receive new data via socket.
static size_t tftp_xfer_window (struct tftp_request *tftp)
 Check flow control window.
static void tftp_close (struct tftp_request *tftp, int rc)
 Terminate download.
static int tftp_core_open (struct interface *xfer, struct uri *uri, unsigned int default_port, struct sockaddr *multicast, unsigned int flags)
 Initiate TFTP/TFTM/MTFTP download.
static int tftp_open (struct interface *xfer, struct uri *uri)
 Initiate TFTP download.
static int tftm_open (struct interface *xfer, struct uri *uri)
 Initiate TFTM download.
static int mtftp_open (struct interface *xfer, struct uri *uri)
 Initiate MTFTP download.
static int tftp_apply_settings (void)
 Apply TFTP configuration settings.

Variables

static struct sockaddr_in tftp_mtftp_socket
 MTFTP multicast receive address.
static struct tftp_option tftp_options []
 Recognised TFTP options.
static struct interface_operation tftp_socket_operations []
 TFTP socket operations.
static struct interface_descriptor tftp_socket_desc
 TFTP socket interface descriptor.
static struct interface_operation tftp_mc_socket_operations []
 TFTP multicast socket operations.
static struct interface_descriptor tftp_mc_socket_desc
 TFTP multicast socket interface descriptor.
static struct interface_operation tftp_xfer_operations []
 TFTP data transfer interface operations.
static struct interface_descriptor tftp_xfer_desc
 TFTP data transfer interface descriptor.
struct uri_opener tftp_uri_opener __uri_opener
 TFTP URI opener.
struct settings_applicator
tftp_settings_applicator 
__settings_applicator
 TFTP settings applicator.

Detailed Description

TFTP protocol.

Definition in file tftp.c.


Define Documentation

Definition at line 57 of file tftp.c.

Referenced by tftp_process_blksize().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x01, "Invalid blksize" )

Definition at line 58 of file tftp.c.

Definition at line 60 of file tftp.c.

Referenced by tftp_process_tsize().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x02, "Invalid tsize" )

Definition at line 61 of file tftp.c.

Definition at line 63 of file tftp.c.

Referenced by tftp_process_multicast().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x03, "Missing multicast port" )

Definition at line 64 of file tftp.c.

Definition at line 66 of file tftp.c.

Referenced by tftp_process_multicast().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x04, "Missing multicast mc" )

Definition at line 67 of file tftp.c.

Definition at line 69 of file tftp.c.

Referenced by tftp_process_multicast().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x05, "Missing multicast IP" )

Definition at line 70 of file tftp.c.

Definition at line 72 of file tftp.c.

Referenced by tftp_process_multicast().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x06, "Invalid multicast IP" )

Definition at line 73 of file tftp.c.

Definition at line 75 of file tftp.c.

Referenced by tftp_process_multicast().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x07, "Invalid multicast port" )

Definition at line 76 of file tftp.c.

#define MTFTP_MAX_TIMEOUTS   3

Maximum number of MTFTP open requests before falling back to TFTP.

Definition at line 159 of file tftp.c.

Referenced by tftp_timer_expired().


Enumeration Type Documentation

anonymous enum

TFTP request flags.

Enumerator:
TFTP_FL_SEND_ACK 

Send ACK packets.

TFTP_FL_RRQ_SIZES 

Request blksize and tsize options.

TFTP_FL_RRQ_MULTICAST 

Request multicast option.

TFTP_FL_MTFTP_RECOVERY 

Perform MTFTP recovery on timeout.

Definition at line 147 of file tftp.c.

     {
        /** Send ACK packets */
        TFTP_FL_SEND_ACK = 0x0001,
        /** Request blksize and tsize options */
        TFTP_FL_RRQ_SIZES = 0x0002,
        /** Request multicast option */
        TFTP_FL_RRQ_MULTICAST = 0x0004,
        /** Perform MTFTP recovery on timeout */
        TFTP_FL_MTFTP_RECOVERY = 0x0008,
};

Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
FEATURE ( FEATURE_PROTOCOL  ,
"TFTP"  ,
DHCP_EB_FEATURE_TFTP  ,
 
)
static void tftp_free ( struct refcnt refcnt) [static]

Free TFTP request.

Parameters:
refcntReference counter

Definition at line 166 of file tftp.c.

References tftp_request::bitmap, bitmap_free(), container_of, free, tftp_request::uri, and uri_put().

Referenced by tftp_core_open().

                                                {
        struct tftp_request *tftp =
                container_of ( refcnt, struct tftp_request, refcnt );

        uri_put ( tftp->uri );
        bitmap_free ( &tftp->bitmap );
        free ( tftp );
}
static void tftp_done ( struct tftp_request tftp,
int  rc 
) [static]

Mark TFTP request as complete.

Parameters:
tftpTFTP connection
rcReturn status code

Definition at line 181 of file tftp.c.

References DBGC, intf_shutdown(), tftp_request::mc_socket, tftp_request::socket, stop_timer(), strerror(), tftp_request::timer, and tftp_request::xfer.

Referenced by tftp_close(), tftp_core_open(), tftp_rx_data(), tftp_rx_error(), tftp_rx_oack(), and tftp_timer_expired().

                                                            {

        DBGC ( tftp, "TFTP %p finished with status %d (%s)\n",
               tftp, rc, strerror ( rc ) );

        /* Stop the retry timer */
        stop_timer ( &tftp->timer );

        /* Close all data transfer interfaces */
        intf_shutdown ( &tftp->socket, rc );
        intf_shutdown ( &tftp->mc_socket, rc );
        intf_shutdown ( &tftp->xfer, rc );
}
static int tftp_reopen ( struct tftp_request tftp) [static]

Reopen TFTP socket.

Parameters:
tftpTFTP connection
Return values:
rcReturn status code

Definition at line 201 of file tftp.c.

References DBGC, tftp_request::flags, uri::host, htons, intf_restart(), memset(), NULL, tftp_request::peer, tftp_request::port, rc, SOCK_DGRAM, tftp_request::socket, sockaddr_tcpip::st_port, strerror(), TFTP_FL_SEND_ACK, tftp_request::uri, and xfer_open_named_socket().

Referenced by tftp_core_open(), and tftp_timer_expired().

                                                     {
        struct sockaddr_tcpip server;
        int rc;

        /* Close socket */
        intf_restart ( &tftp->socket, 0 );

        /* Disable ACK sending. */
        tftp->flags &= ~TFTP_FL_SEND_ACK;

        /* Reset peer address */
        memset ( &tftp->peer, 0, sizeof ( tftp->peer ) );

        /* Open socket */
        memset ( &server, 0, sizeof ( server ) );
        server.st_port = htons ( tftp->port );
        if ( ( rc = xfer_open_named_socket ( &tftp->socket, SOCK_DGRAM,
                                             ( struct sockaddr * ) &server,
                                             tftp->uri->host, NULL ) ) != 0 ) {
                DBGC ( tftp, "TFTP %p could not open socket: %s\n",
                       tftp, strerror ( rc ) );
                return rc;
        }

        return 0;
}
static int tftp_reopen_mc ( struct tftp_request tftp,
struct sockaddr local 
) [static]

Reopen TFTP multicast socket.

Parameters:
tftpTFTP connection
localLocal socket address
Return values:
rcReturn status code

Definition at line 235 of file tftp.c.

References DBGC, intf_restart(), tftp_request::mc_socket, rc, SOCK_DGRAM, strerror(), and xfer_open_socket().

Referenced by tftp_core_open(), and tftp_process_multicast().

                                                     {
        int rc;

        /* Close multicast socket */
        intf_restart ( &tftp->mc_socket, 0 );

        /* Open multicast socket.  We never send via this socket, so
         * use the local address as the peer address (since the peer
         * address cannot be NULL).
         */
        if ( ( rc = xfer_open_socket ( &tftp->mc_socket, SOCK_DGRAM,
                                       local, local ) ) != 0 ) {
                DBGC ( tftp, "TFTP %p could not open multicast "
                       "socket: %s\n", tftp, strerror ( rc ) );
                return rc;
        }

        return 0;
}
static int tftp_presize ( struct tftp_request tftp,
size_t  filesize 
) [static]

Presize TFTP receive buffers and block bitmap.

Parameters:
tftpTFTP connection
filesizeKnown minimum file size
Return values:
rcReturn status code

Definition at line 263 of file tftp.c.

References tftp_request::bitmap, bitmap_resize(), tftp_request::blksize, DBGC, EINVAL, tftp_request::filesize, rc, strerror(), tftp_request::xfer, and xfer_seek().

Referenced by tftp_rx_data(), and tftp_rx_oack().

                                                                       {
        unsigned int num_blocks;
        int rc;

        /* Do nothing if we are already large enough */
        if ( filesize <= tftp->filesize )
                return 0;

        /* Record filesize */
        tftp->filesize = filesize;

        /* Notify recipient of file size */
        xfer_seek ( &tftp->xfer, filesize );
        xfer_seek ( &tftp->xfer, 0 );

        /* Calculate expected number of blocks.  Note that files whose
         * length is an exact multiple of the blocksize will have a
         * trailing zero-length block, which must be included.
         */
        if ( tftp->blksize == 0 )
                return -EINVAL;
        num_blocks = ( ( filesize / tftp->blksize ) + 1 );
        if ( ( rc = bitmap_resize ( &tftp->bitmap, num_blocks ) ) != 0 ) {
                DBGC ( tftp, "TFTP %p could not resize bitmap to %d blocks: "
                       "%s\n", tftp, num_blocks, strerror ( rc ) );
                return rc;
        }

        return 0;
}
void tftp_set_mtftp_address ( struct in_addr  address)

Set MTFTP multicast address.

Parameters:
addressMulticast IPv4 address

Definition at line 310 of file tftp.c.

References address, and sockaddr_in::sin_addr.

void tftp_set_mtftp_port ( unsigned int  port)

Set MTFTP multicast port.

Parameters:
portMulticast port

Definition at line 319 of file tftp.c.

References htons, and sockaddr_in::sin_port.

static int tftp_send_rrq ( struct tftp_request tftp) [static]

Transmit RRQ.

Parameters:
tftpTFTP connection
Return values:
rcReturn status code

Definition at line 329 of file tftp.c.

References blksize, DBGC, ENOMEM, tftp_request::flags, htons, iob_put, iob_tailroom(), len, tftp_rrq::opcode, uri::path, snprintf(), tftp_request::socket, strlen(), io_buffer::tail, TFTP_FL_RRQ_MULTICAST, TFTP_FL_RRQ_SIZES, TFTP_MAX_BLKSIZE, TFTP_RRQ, tftp_request::uri, tftp_request::xfer, xfer_alloc_iob(), xfer_deliver_iob(), and xfer_window().

Referenced by tftp_send_packet().

                                                       {
        const char *path = ( tftp->uri->path + 1 /* skip '/' */ );
        struct tftp_rrq *rrq;
        size_t len;
        struct io_buffer *iobuf;
        size_t blksize;

        DBGC ( tftp, "TFTP %p requesting \"%s\"\n", tftp, path );

        /* Allocate buffer */
        len = ( sizeof ( *rrq ) + strlen ( path ) + 1 /* NUL */
                + 5 + 1 /* "octet" + NUL */
                + 7 + 1 + 5 + 1 /* "blksize" + NUL + ddddd + NUL */
                + 5 + 1 + 1 + 1 /* "tsize" + NUL + "0" + NUL */ 
                + 9 + 1 + 1 /* "multicast" + NUL + NUL */ );
        iobuf = xfer_alloc_iob ( &tftp->socket, len );
        if ( ! iobuf )
                return -ENOMEM;

        /* Determine block size */
        blksize = xfer_window ( &tftp->xfer );
        if ( blksize > TFTP_MAX_BLKSIZE )
                blksize = TFTP_MAX_BLKSIZE;

        /* Build request */
        rrq = iob_put ( iobuf, sizeof ( *rrq ) );
        rrq->opcode = htons ( TFTP_RRQ );
        iob_put ( iobuf, snprintf ( iobuf->tail, iob_tailroom ( iobuf ),
                                    "%s%coctet", path, 0 ) + 1 );
        if ( tftp->flags & TFTP_FL_RRQ_SIZES ) {
                iob_put ( iobuf, snprintf ( iobuf->tail,
                                            iob_tailroom ( iobuf ),
                                            "blksize%c%zd%ctsize%c0",
                                            0, blksize, 0, 0 ) + 1 );
        }
        if ( tftp->flags & TFTP_FL_RRQ_MULTICAST ) {
                iob_put ( iobuf, snprintf ( iobuf->tail,
                                            iob_tailroom ( iobuf ),
                                            "multicast%c", 0 ) + 1 );
        }

        /* RRQ always goes to the address specified in the initial
         * xfer_open() call
         */
        return xfer_deliver_iob ( &tftp->socket, iobuf );
}
static int tftp_send_ack ( struct tftp_request tftp) [static]

Transmit ACK.

Parameters:
tftpTFTP connection
Return values:
rcReturn status code

Definition at line 382 of file tftp.c.

References tftp_request::bitmap, bitmap_first_gap(), block, tftp_ack::block, DBGC2, xfer_metadata::dest, ENOMEM, htons, iob_put, tftp_ack::opcode, tftp_request::peer, tftp_request::socket, TFTP_ACK, xfer_alloc_iob(), and xfer_deliver().

Referenced by tftp_send_packet().

                                                       {
        struct tftp_ack *ack;
        struct io_buffer *iobuf;
        struct xfer_metadata meta = {
                .dest = ( struct sockaddr * ) &tftp->peer,
        };
        unsigned int block;

        /* Determine next required block number */
        block = bitmap_first_gap ( &tftp->bitmap );
        DBGC2 ( tftp, "TFTP %p sending ACK for block %d\n", tftp, block );

        /* Allocate buffer */
        iobuf = xfer_alloc_iob ( &tftp->socket, sizeof ( *ack ) );
        if ( ! iobuf )
                return -ENOMEM;

        /* Build ACK */
        ack = iob_put ( iobuf, sizeof ( *ack ) );
        ack->opcode = htons ( TFTP_ACK );
        ack->block = htons ( block );

        /* ACK always goes to the peer recorded from the RRQ response */
        return xfer_deliver ( &tftp->socket, iobuf, &meta );
}
static int tftp_send_error ( struct tftp_request tftp,
int  errcode,
const char *  errmsg 
) [static]

Transmit ERROR (Abort)

Parameters:
tftpTFTP connection
errcodeTFTP error code
errmsgError message string
Return values:
rcReturn status code

Definition at line 416 of file tftp.c.

References DBGC2, xfer_metadata::dest, ENOMEM, tftp_error::errcode, tftp_error::errmsg, htons, iob_put, tftp_error::opcode, tftp_request::peer, tftp_request::socket, strcpy(), strlen(), TFTP_ERROR, xfer_alloc_iob(), and xfer_deliver().

Referenced by tftp_close().

                                                  {
        struct tftp_error *err;
        struct io_buffer *iobuf;
        struct xfer_metadata meta = {
                .dest = ( struct sockaddr * ) &tftp->peer,
        };
        size_t msglen;

        DBGC2 ( tftp, "TFTP %p sending ERROR %d: %s\n", tftp, errcode,
                errmsg );

        /* Allocate buffer */
        msglen = sizeof ( *err ) + strlen ( errmsg ) + 1 /* NUL */;
        iobuf = xfer_alloc_iob ( &tftp->socket, msglen );
        if ( ! iobuf )
                return -ENOMEM;

        /* Build ERROR */
        err = iob_put ( iobuf, msglen );
        err->opcode = htons ( TFTP_ERROR );
        err->errcode = htons ( errcode );
        strcpy ( err->errmsg, errmsg );

        /* ERR always goes to the peer recorded from the RRQ response */
        return xfer_deliver ( &tftp->socket, iobuf, &meta );
}
static int tftp_send_packet ( struct tftp_request tftp) [static]

Transmit next relevant packet.

Parameters:
tftpTFTP connection
Return values:
rcReturn status code

Definition at line 450 of file tftp.c.

References tftp_request::flags, tftp_request::peer, tftp_request::socket, sockaddr_tcpip::st_family, start_timer(), start_timer_nodelay(), stop_timer(), TFTP_FL_SEND_ACK, tftp_send_ack(), tftp_send_rrq(), tftp_request::timer, and xfer_window().

Referenced by tftp_rx_data(), tftp_rx_oack(), and tftp_timer_expired().

                                                          {

        /* Update retransmission timer.  While name resolution takes place the
         * window is zero.  Avoid unnecessary delay after name resolution
         * completes by retrying immediately.
         */
        stop_timer ( &tftp->timer );
        if ( xfer_window ( &tftp->socket ) ) {
                start_timer ( &tftp->timer );
        } else {
                start_timer_nodelay ( &tftp->timer );
        }

        /* Send RRQ or ACK as appropriate */
        if ( ! tftp->peer.st_family ) {
                return tftp_send_rrq ( tftp );
        } else {
                if ( tftp->flags & TFTP_FL_SEND_ACK ) {
                        return tftp_send_ack ( tftp );
                } else {
                        return 0;
                }
        }
}
static void tftp_timer_expired ( struct retry_timer timer,
int  fail 
) [static]

Handle TFTP retransmission timer expiry.

Parameters:
timerRetry timer
failFailure indicator

Definition at line 481 of file tftp.c.

References tftp_request::bitmap, bitmap_free(), container_of, DBGC, ETIMEDOUT, tftp_request::flags, intf_restart(), tftp_request::mc_socket, memset(), MTFTP_MAX_TIMEOUTS, tftp_request::mtftp_timeouts, tftp_request::peer, tftp_request::port, rc, sockaddr_tcpip::st_family, start_timer_nodelay(), tftp_done(), TFTP_FL_MTFTP_RECOVERY, TFTP_FL_RRQ_SIZES, TFTP_PORT, tftp_reopen(), tftp_send_packet(), and tftp_request::timer.

Referenced by tftp_core_open().

                                                                       {
        struct tftp_request *tftp =
                container_of ( timer, struct tftp_request, timer );
        int rc;

        /* If we are doing MTFTP, attempt the various recovery strategies */
        if ( tftp->flags & TFTP_FL_MTFTP_RECOVERY ) {
                if ( tftp->peer.st_family ) {
                        /* If we have received any response from the server,
                         * try resending the RRQ to restart the download.
                         */
                        DBGC ( tftp, "TFTP %p attempting reopen\n", tftp );
                        if ( ( rc = tftp_reopen ( tftp ) ) != 0 )
                                goto err;
                } else {
                        /* Fall back to plain TFTP after several attempts */
                        tftp->mtftp_timeouts++;
                        DBGC ( tftp, "TFTP %p timeout %d waiting for MTFTP "
                               "open\n", tftp, tftp->mtftp_timeouts );

                        if ( tftp->mtftp_timeouts > MTFTP_MAX_TIMEOUTS ) {
                                DBGC ( tftp, "TFTP %p falling back to plain "
                                       "TFTP\n", tftp );
                                tftp->flags = TFTP_FL_RRQ_SIZES;

                                /* Close multicast socket */
                                intf_restart ( &tftp->mc_socket, 0 );

                                /* Reset retry timer */
                                start_timer_nodelay ( &tftp->timer );

                                /* The blocksize may change: discard
                                 * the block bitmap
                                 */
                                bitmap_free ( &tftp->bitmap );
                                memset ( &tftp->bitmap, 0,
                                         sizeof ( tftp->bitmap ) );

                                /* Reopen on standard TFTP port */
                                tftp->port = TFTP_PORT;
                                if ( ( rc = tftp_reopen ( tftp ) ) != 0 )
                                        goto err;
                        }
                }
        } else {
                /* Not doing MTFTP (or have fallen back to plain
                 * TFTP); fail as per normal.
                 */
                if ( fail ) {
                        rc = -ETIMEDOUT;
                        goto err;
                }
        }
        tftp_send_packet ( tftp );
        return;

 err:
        tftp_done ( tftp, rc );
}
static int tftp_process_blksize ( struct tftp_request tftp,
const char *  value 
) [static]

Process TFTP "blksize" option.

Parameters:
tftpTFTP connection
valueOption value
Return values:
rcReturn status code

Definition at line 548 of file tftp.c.

References tftp_request::blksize, DBGC, EINVAL_BLKSIZE, end, and strtoul().

                                                      {
        char *end;

        tftp->blksize = strtoul ( value, &end, 10 );
        if ( *end ) {
                DBGC ( tftp, "TFTP %p got invalid blksize \"%s\"\n",
                       tftp, value );
                return -EINVAL_BLKSIZE;
        }
        DBGC ( tftp, "TFTP %p blksize=%d\n", tftp, tftp->blksize );

        return 0;
}
static int tftp_process_tsize ( struct tftp_request tftp,
const char *  value 
) [static]

Process TFTP "tsize" option.

Parameters:
tftpTFTP connection
valueOption value
Return values:
rcReturn status code

Definition at line 570 of file tftp.c.

References DBGC, EINVAL_TSIZE, end, strtoul(), and tftp_request::tsize.

                                                    {
        char *end;

        tftp->tsize = strtoul ( value, &end, 10 );
        if ( *end ) {
                DBGC ( tftp, "TFTP %p got invalid tsize \"%s\"\n",
                       tftp, value );
                return -EINVAL_TSIZE;
        }
        DBGC ( tftp, "TFTP %p tsize=%ld\n", tftp, tftp->tsize );

        return 0;
}
static int tftp_process_multicast ( struct tftp_request tftp,
const char *  value 
) [static]

Process TFTP "multicast" option.

Parameters:
tftpTFTP connection
valueOption value
Return values:
rcReturn status code

Definition at line 592 of file tftp.c.

References addr, AF_INET, DBGC, EINVAL_MC_INVALID_IP, EINVAL_MC_INVALID_MC, EINVAL_MC_INVALID_PORT, EINVAL_MC_NO_MC, EINVAL_MC_NO_PORT, tftp_request::flags, htons, inet_aton(), inet_ntoa(), memcpy(), ntohs, port, rc, strchr(), strlen(), strtoul(), TFTP_FL_SEND_ACK, and tftp_reopen_mc().

                                                        {
        union {
                struct sockaddr sa;
                struct sockaddr_in sin;
        } socket;
        char buf[ strlen ( value ) + 1 ];
        char *addr;
        char *port;
        char *port_end;
        char *mc;
        char *mc_end;
        int rc;

        /* Split value into "addr,port,mc" fields */
        memcpy ( buf, value, sizeof ( buf ) );
        addr = buf;
        port = strchr ( addr, ',' );
        if ( ! port ) {
                DBGC ( tftp, "TFTP %p multicast missing port,mc\n", tftp );
                return -EINVAL_MC_NO_PORT;
        }
        *(port++) = '\0';
        mc = strchr ( port, ',' );
        if ( ! mc ) {
                DBGC ( tftp, "TFTP %p multicast missing mc\n", tftp );
                return -EINVAL_MC_NO_MC;
        }
        *(mc++) = '\0';

        /* Parse parameters */
        if ( strtoul ( mc, &mc_end, 0 ) == 0 )
                tftp->flags &= ~TFTP_FL_SEND_ACK;
        if ( *mc_end ) {
                DBGC ( tftp, "TFTP %p multicast invalid mc %s\n", tftp, mc );
                return -EINVAL_MC_INVALID_MC;
        }
        DBGC ( tftp, "TFTP %p is%s the master client\n",
               tftp, ( ( tftp->flags & TFTP_FL_SEND_ACK ) ? "" : " not" ) );
        if ( *addr && *port ) {
                socket.sin.sin_family = AF_INET;
                if ( inet_aton ( addr, &socket.sin.sin_addr ) == 0 ) {
                        DBGC ( tftp, "TFTP %p multicast invalid IP address "
                               "%s\n", tftp, addr );
                        return -EINVAL_MC_INVALID_IP;
                }
                DBGC ( tftp, "TFTP %p multicast IP address %s\n",
                       tftp, inet_ntoa ( socket.sin.sin_addr ) );
                socket.sin.sin_port = htons ( strtoul ( port, &port_end, 0 ) );
                if ( *port_end ) {
                        DBGC ( tftp, "TFTP %p multicast invalid port %s\n",
                               tftp, port );
                        return -EINVAL_MC_INVALID_PORT;
                }
                DBGC ( tftp, "TFTP %p multicast port %d\n",
                       tftp, ntohs ( socket.sin.sin_port ) );
                if ( ( rc = tftp_reopen_mc ( tftp, &socket.sa ) ) != 0 )
                        return rc;
        }

        return 0;
}
static int tftp_process_option ( struct tftp_request tftp,
const char *  name,
const char *  value 
) [static]

Process TFTP option.

Parameters:
tftpTFTP connection
nameOption name
valueOption value
Return values:
rcReturn status code

Definition at line 684 of file tftp.c.

References DBGC, tftp_option::name, tftp_option::process, and strcasecmp().

Referenced by tftp_rx_oack().

                                                                       {
        struct tftp_option *option;

        for ( option = tftp_options ; option->name ; option++ ) {
                if ( strcasecmp ( name, option->name ) == 0 )
                        return option->process ( tftp, value );
        }

        DBGC ( tftp, "TFTP %p received unknown option \"%s\" = \"%s\"\n",
               tftp, name, value );

        /* Unknown options should be silently ignored */
        return 0;
}
static int tftp_rx_oack ( struct tftp_request tftp,
void *  buf,
size_t  len 
) [static]

Receive OACK.

Parameters:
tftpTFTP connection
bufTemporary data buffer
lenLength of temporary data buffer
Return values:
rcReturn status code

Definition at line 708 of file tftp.c.

References tftp_oack::data, DBGC, DBGC_HD, done, EINVAL, end, len, name, next, rc, strnlen(), tftp_done(), tftp_presize(), tftp_process_option(), tftp_send_packet(), tftp_request::tsize, and value.

Referenced by tftp_rx().

                                                                             {
        struct tftp_oack *oack = buf;
        char *end = buf + len;
        char *name;
        char *value;
        char *next;
        int rc = 0;

        /* Sanity check */
        if ( len < sizeof ( *oack ) ) {
                DBGC ( tftp, "TFTP %p received underlength OACK packet "
                       "length %zd\n", tftp, len );
                rc = -EINVAL;
                goto done;
        }

        /* Process each option in turn */
        for ( name = oack->data ; name < end ; name = next ) {

                /* Parse option name and value
                 *
                 * We treat parsing errors as non-fatal, because there
                 * exists at least one TFTP server (IBM Tivoli PXE
                 * Server 5.1.0.3) that has been observed to send
                 * malformed OACKs containing trailing garbage bytes.
                 */
                value = ( name + strnlen ( name, ( end - name ) ) + 1 );
                if ( value > end ) {
                        DBGC ( tftp, "TFTP %p received OACK with malformed "
                               "option name:\n", tftp );
                        DBGC_HD ( tftp, oack, len );
                        break;
                }
                if ( value == end ) {
                        DBGC ( tftp, "TFTP %p received OACK missing value "
                               "for option \"%s\"\n", tftp, name );
                        DBGC_HD ( tftp, oack, len );
                        break;
                }
                next = ( value + strnlen ( value, ( end - value ) ) + 1 );
                if ( next > end ) {
                        DBGC ( tftp, "TFTP %p received OACK with malformed "
                               "value for option \"%s\":\n", tftp, name );
                        DBGC_HD ( tftp, oack, len );
                        break;
                }

                /* Process option */
                if ( ( rc = tftp_process_option ( tftp, name, value ) ) != 0 )
                        goto done;
        }

        /* Process tsize information, if available */
        if ( tftp->tsize ) {
                if ( ( rc = tftp_presize ( tftp, tftp->tsize ) ) != 0 )
                        goto done;
        }

        /* Request next data block */
        tftp_send_packet ( tftp );

 done:
        if ( rc )
                tftp_done ( tftp, rc );
        return rc;
}
static int tftp_rx_data ( struct tftp_request tftp,
struct io_buffer iobuf 
) [static]

Receive DATA.

Parameters:
tftpTFTP connection
iobufI/O buffer
Return values:
rcReturn status code

Takes ownership of I/O buffer.

Definition at line 784 of file tftp.c.

References tftp_request::bitmap, bitmap_first_gap(), bitmap_full(), bitmap_set(), tftp_request::blksize, tftp_data::block, block, io_buffer::data, data, DBGC, done, EINVAL, xfer_metadata::flags, free_iob(), iob_disown, iob_len(), iob_pull, memset(), ntohs, xfer_metadata::offset, offset, rc, strerror(), tftp_done(), tftp_presize(), tftp_send_packet(), tftp_request::xfer, xfer_deliver(), and XFER_FL_ABS_OFFSET.

Referenced by tftp_rx().

                                                    {
        struct tftp_data *data = iobuf->data;
        struct xfer_metadata meta;
        unsigned int block;
        off_t offset;
        size_t data_len;
        int rc;

        /* Sanity check */
        if ( iob_len ( iobuf ) < sizeof ( *data ) ) {
                DBGC ( tftp, "TFTP %p received underlength DATA packet "
                       "length %zd\n", tftp, iob_len ( iobuf ) );
                rc = -EINVAL;
                goto done;
        }

        /* Calculate block number */
        block = ( ( bitmap_first_gap ( &tftp->bitmap ) + 1 ) & ~0xffff );
        if ( data->block == 0 && block == 0 ) {
                DBGC ( tftp, "TFTP %p received data block 0\n", tftp );
                rc = -EINVAL;
                goto done;
        }
        block += ( ntohs ( data->block ) - 1 );

        /* Extract data */
        offset = ( block * tftp->blksize );
        iob_pull ( iobuf, sizeof ( *data ) );
        data_len = iob_len ( iobuf );
        if ( data_len > tftp->blksize ) {
                DBGC ( tftp, "TFTP %p received overlength DATA packet "
                       "length %zd\n", tftp, data_len );
                rc = -EINVAL;
                goto done;
        }

        /* Deliver data */
        memset ( &meta, 0, sizeof ( meta ) );
        meta.flags = XFER_FL_ABS_OFFSET;
        meta.offset = offset;
        if ( ( rc = xfer_deliver ( &tftp->xfer, iob_disown ( iobuf ),
                                   &meta ) ) != 0 ) {
                DBGC ( tftp, "TFTP %p could not deliver data: %s\n",
                       tftp, strerror ( rc ) );
                goto done;
        }

        /* Ensure block bitmap is ready */
        if ( ( rc = tftp_presize ( tftp, ( offset + data_len ) ) ) != 0 )
                goto done;

        /* Mark block as received */
        bitmap_set ( &tftp->bitmap, block );

        /* Acknowledge block */
        tftp_send_packet ( tftp );

        /* If all blocks have been received, finish. */
        if ( bitmap_full ( &tftp->bitmap ) )
                tftp_done ( tftp, 0 );

 done:
        free_iob ( iobuf );
        if ( rc )
                tftp_done ( tftp, rc );
        return rc;
}
static int tftp_errcode_to_rc ( unsigned int  errcode) [static]

Convert TFTP error code to return status code.

Parameters:
errcodeTFTP error code
Return values:
rcReturn status code

Definition at line 859 of file tftp.c.

References EACCES, ENOENT, ENOTSUP, ENOTTY, TFTP_ERR_ACCESS_DENIED, TFTP_ERR_FILE_NOT_FOUND, and TFTP_ERR_ILLEGAL_OP.

Referenced by tftp_rx_error().

                                                       {
        switch ( errcode ) {
        case TFTP_ERR_FILE_NOT_FOUND:   return -ENOENT;
        case TFTP_ERR_ACCESS_DENIED:    return -EACCES;
        case TFTP_ERR_ILLEGAL_OP:       return -ENOTTY;
        default:                        return -ENOTSUP;
        }
}
static int tftp_rx_error ( struct tftp_request tftp,
void *  buf,
size_t  len 
) [static]

Receive ERROR.

Parameters:
tftpTFTP connection
bufTemporary data buffer
lenLength of temporary data buffer
Return values:
rcReturn status code

Definition at line 876 of file tftp.c.

References DBGC, EINVAL, tftp_error::errcode, tftp_error::errmsg, error, ntohs, rc, tftp_done(), and tftp_errcode_to_rc().

Referenced by tftp_rx().

                                                                              {
        struct tftp_error *error = buf;
        int rc;

        /* Sanity check */
        if ( len < sizeof ( *error ) ) {
                DBGC ( tftp, "TFTP %p received underlength ERROR packet "
                       "length %zd\n", tftp, len );
                return -EINVAL;
        }

        DBGC ( tftp, "TFTP %p received ERROR packet with code %d, message "
               "\"%s\"\n", tftp, ntohs ( error->errcode ), error->errmsg );
        
        /* Determine final operation result */
        rc = tftp_errcode_to_rc ( ntohs ( error->errcode ) );

        /* Close TFTP request */
        tftp_done ( tftp, rc );

        return 0;
}
static int tftp_rx ( struct tftp_request tftp,
struct io_buffer iobuf,
struct xfer_metadata meta 
) [static]

Receive new data.

Parameters:
tftpTFTP connection
iobufI/O buffer
metaTransfer metadata
Return values:
rcReturn status code

Definition at line 907 of file tftp.c.

References common, io_buffer::data, DBGC, done, EINVAL, free_iob(), htons, iob_disown, iob_len(), len, memcmp(), memcpy(), ntohs, tftp_common::opcode, tftp_request::peer, rc, xfer_metadata::src, sockaddr_tcpip::st_family, sockaddr_tcpip::st_port, TFTP_DATA, TFTP_ERROR, TFTP_OACK, tftp_rx_data(), tftp_rx_error(), and tftp_rx_oack().

Referenced by tftp_socket_deliver().

                                                  {
        struct sockaddr_tcpip *st_src;
        struct tftp_common *common = iobuf->data;
        size_t len = iob_len ( iobuf );
        int rc = -EINVAL;
        
        /* Sanity checks */
        if ( len < sizeof ( *common ) ) {
                DBGC ( tftp, "TFTP %p received underlength packet length "
                       "%zd\n", tftp, len );
                goto done;
        }
        if ( ! meta->src ) {
                DBGC ( tftp, "TFTP %p received packet without source port\n",
                       tftp );
                goto done;
        }

        /* Filter by TID.  Set TID on first response received */
        st_src = ( struct sockaddr_tcpip * ) meta->src;
        if ( ! tftp->peer.st_family ) {
                memcpy ( &tftp->peer, st_src, sizeof ( tftp->peer ) );
                DBGC ( tftp, "TFTP %p using remote port %d\n", tftp,
                       ntohs ( tftp->peer.st_port ) );
        } else if ( memcmp ( &tftp->peer, st_src,
                             sizeof ( tftp->peer ) ) != 0 ) {
                DBGC ( tftp, "TFTP %p received packet from wrong source (got "
                       "%d, wanted %d)\n", tftp, ntohs ( st_src->st_port ),
                       ntohs ( tftp->peer.st_port ) );
                goto done;
        }

        switch ( common->opcode ) {
        case htons ( TFTP_OACK ):
                rc = tftp_rx_oack ( tftp, iobuf->data, len );
                break;
        case htons ( TFTP_DATA ):
                rc = tftp_rx_data ( tftp, iob_disown ( iobuf ) );
                break;
        case htons ( TFTP_ERROR ):
                rc = tftp_rx_error ( tftp, iobuf->data, len );
                break;
        default:
                DBGC ( tftp, "TFTP %p received strange packet type %d\n",
                       tftp, ntohs ( common->opcode ) );
                break;
        };

 done:
        free_iob ( iobuf );
        return rc;
}
static int tftp_socket_deliver ( struct tftp_request tftp,
struct io_buffer iobuf,
struct xfer_metadata meta 
) [static]

Receive new data via socket.

Parameters:
tftpTFTP connection
iobufI/O buffer
metaTransfer metadata
Return values:
rcReturn status code

Definition at line 970 of file tftp.c.

References tftp_request::flags, TFTP_FL_SEND_ACK, and tftp_rx().

                                                              {

        /* Enable sending ACKs when we receive a unicast packet.  This
         * covers three cases:
         *
         * 1. Standard TFTP; we should always send ACKs, and will
         *    always receive a unicast packet before we need to send the
         *    first ACK.
         *
         * 2. RFC2090 multicast TFTP; the only unicast packets we will
         *    receive are the OACKs; enable sending ACKs here (before
         *    processing the OACK) and disable it when processing the
         *    multicast option if we are not the master client.
         *
         * 3. MTFTP; receiving a unicast datagram indicates that we
         *    are the "master client" and should send ACKs.
         */
        tftp->flags |= TFTP_FL_SEND_ACK;

        return tftp_rx ( tftp, iobuf, meta );
}
static size_t tftp_xfer_window ( struct tftp_request tftp) [static]

Check flow control window.

Parameters:
tftpTFTP connection
Return values:
lenLength of window

Definition at line 1018 of file tftp.c.

References tftp_request::blksize.

                                                             {

        /* We abuse this data-xfer method to convey the blocksize to
         * the caller.  This really should be done using some kind of
         * stat() method, but we don't yet have the facility to do
         * that.
         */
        return tftp->blksize;
}
static void tftp_close ( struct tftp_request tftp,
int  rc 
) [static]

Terminate download.

Parameters:
tftpTFTP connection
rcReason for close

Definition at line 1034 of file tftp.c.

References tftp_done(), and tftp_send_error().

                                                             {

        /* Abort download */
        tftp_send_error ( tftp, 0, "TFTP Aborted" );

        /* Close TFTP request */
        tftp_done ( tftp, rc );
}
static int tftp_core_open ( struct interface xfer,
struct uri uri,
unsigned int  default_port,
struct sockaddr multicast,
unsigned int  flags 
) [static]

Initiate TFTP/TFTM/MTFTP download.

Parameters:
xferData transfer interface
uriUniform Resource Identifier
Return values:
rcReturn status code

Definition at line 1060 of file tftp.c.

References tftp_request::blksize, DBGC, EINVAL, ENOMEM, flags, tftp_request::flags, uri::host, intf_init(), intf_plug_plug(), tftp_request::mc_socket, uri::path, tftp_request::port, rc, ref_init, ref_put, tftp_request::refcnt, tftp_request::socket, start_timer_nodelay(), strerror(), TFTP_DEFAULT_BLKSIZE, tftp_done(), tftp_free(), tftp_reopen(), tftp_reopen_mc(), tftp_timer_expired(), tftp_request::timer, tftp_request::uri, uri_get(), uri_port(), tftp_request::xfer, and zalloc().

Referenced by mtftp_open(), tftm_open(), and tftp_open().

                                                 {
        struct tftp_request *tftp;
        int rc;

        /* Sanity checks */
        if ( ! uri->host )
                return -EINVAL;
        if ( ! uri->path )
                return -EINVAL;
        if ( uri->path[0] != '/' )
                return -EINVAL;

        /* Allocate and populate TFTP structure */
        tftp = zalloc ( sizeof ( *tftp ) );
        if ( ! tftp )
                return -ENOMEM;
        ref_init ( &tftp->refcnt, tftp_free );
        intf_init ( &tftp->xfer, &tftp_xfer_desc, &tftp->refcnt );
        intf_init ( &tftp->socket, &tftp_socket_desc, &tftp->refcnt );
        intf_init ( &tftp->mc_socket, &tftp_mc_socket_desc, &tftp->refcnt );
        timer_init ( &tftp->timer, tftp_timer_expired, &tftp->refcnt );
        tftp->uri = uri_get ( uri );
        tftp->blksize = TFTP_DEFAULT_BLKSIZE;
        tftp->flags = flags;

        /* Open socket */
        tftp->port = uri_port ( tftp->uri, default_port );
        if ( ( rc = tftp_reopen ( tftp ) ) != 0 )
                goto err;

        /* Open multicast socket */
        if ( multicast ) {
                if ( ( rc = tftp_reopen_mc ( tftp, multicast ) ) != 0 )
                        goto err;
        }

        /* Start timer to initiate RRQ */
        start_timer_nodelay ( &tftp->timer );

        /* Attach to parent interface, mortalise self, and return */
        intf_plug_plug ( &tftp->xfer, xfer );
        ref_put ( &tftp->refcnt );
        return 0;

 err:
        DBGC ( tftp, "TFTP %p could not create request: %s\n",
               tftp, strerror ( rc ) );
        tftp_done ( tftp, rc );
        ref_put ( &tftp->refcnt );
        return rc;
}
static int tftp_open ( struct interface xfer,
struct uri uri 
) [static]

Initiate TFTP download.

Parameters:
xferData transfer interface
uriUniform Resource Identifier
Return values:
rcReturn status code

Definition at line 1122 of file tftp.c.

References NULL, tftp_core_open(), TFTP_FL_RRQ_SIZES, and TFTP_PORT.

                                                                 {
        return tftp_core_open ( xfer, uri, TFTP_PORT, NULL,
                                TFTP_FL_RRQ_SIZES );

}
static int tftm_open ( struct interface xfer,
struct uri uri 
) [static]

Initiate TFTM download.

Parameters:
xferData transfer interface
uriUniform Resource Identifier
Return values:
rcReturn status code

Definition at line 1141 of file tftp.c.

References NULL, tftp_core_open(), TFTP_FL_RRQ_MULTICAST, TFTP_FL_RRQ_SIZES, and TFTP_PORT.

static int mtftp_open ( struct interface xfer,
struct uri uri 
) [static]

Initiate MTFTP download.

Parameters:
xferData transfer interface
uriUniform Resource Identifier
Return values:
rcReturn status code

Definition at line 1161 of file tftp.c.

References MTFTP_PORT, tftp_core_open(), and TFTP_FL_MTFTP_RECOVERY.

                                                                  {
        return tftp_core_open ( xfer, uri, MTFTP_PORT,
                                ( struct sockaddr * ) &tftp_mtftp_socket,
                                TFTP_FL_MTFTP_RECOVERY );
}
static int tftp_apply_settings ( void  ) [static]

Apply TFTP configuration settings.

Return values:
rcReturn status code

Definition at line 1185 of file tftp.c.

References churi(), DBGC, ENOMEM, fetch_ipv4_setting(), inet_ntoa(), NULL, parse_uri(), in_addr::s_addr, snprintf(), and uri_put().

                                        {
        static struct in_addr tftp_server = { 0 };
        struct in_addr new_tftp_server;
        char uri_string[32];
        struct uri *uri;

        /* Retrieve TFTP server setting */
        fetch_ipv4_setting ( NULL, &next_server_setting, &new_tftp_server );

        /* If TFTP server setting has changed, set the current working
         * URI to match.  Do it only when the TFTP server has changed
         * to try to minimise surprises to the user, who probably
         * won't expect the CWURI to change just because they updated
         * an unrelated setting and triggered all the settings
         * applicators.
         */
        if ( new_tftp_server.s_addr &&
             ( new_tftp_server.s_addr != tftp_server.s_addr ) ) {
                DBGC ( &tftp_server, "TFTP server changed %s => ",
                       inet_ntoa ( tftp_server ) );
                DBGC ( &tftp_server, "%s\n", inet_ntoa ( new_tftp_server ) );
                snprintf ( uri_string, sizeof ( uri_string ),
                           "tftp://%s/", inet_ntoa ( new_tftp_server ) );
                uri = parse_uri ( uri_string );
                if ( ! uri )
                        return -ENOMEM;
                churi ( uri );
                uri_put ( uri );
                tftp_server = new_tftp_server;
        }

        return 0;
}

Variable Documentation

struct sockaddr_in tftp_mtftp_socket [static]
Initial value:
 {
        .sin_family = AF_INET,
        .sin_addr.s_addr = htonl ( 0xefff0101 ),
        .sin_port = htons ( 3001 ),
}

MTFTP multicast receive address.

This is treated as a global configuration parameter.

Definition at line 299 of file tftp.c.

struct tftp_option tftp_options[] [static]
Initial value:
 {
        { "blksize", tftp_process_blksize },
        { "tsize", tftp_process_tsize },
        { "multicast", tftp_process_multicast },
        { NULL, NULL }
}

Recognised TFTP options.

Definition at line 669 of file tftp.c.

Initial value:

TFTP socket operations.

Definition at line 995 of file tftp.c.

Initial value:

TFTP socket interface descriptor.

Definition at line 1000 of file tftp.c.

Initial value:

TFTP multicast socket operations.

Definition at line 1004 of file tftp.c.

Initial value:

TFTP multicast socket interface descriptor.

Definition at line 1009 of file tftp.c.

Initial value:

TFTP data transfer interface operations.

Definition at line 1044 of file tftp.c.

Initial value:

TFTP data transfer interface descriptor.

Definition at line 1050 of file tftp.c.

struct uri_opener mtftp_uri_opener __uri_opener
Initial value:
 {
        .scheme = "tftp",
        .open   = tftp_open,
}

TFTP URI opener.

MTFTP URI opener.

TFTM URI opener.

Definition at line 1129 of file tftp.c.

struct settings_applicator tftp_settings_applicator __settings_applicator
Initial value:
 {
        .apply = tftp_apply_settings,
}

TFTP settings applicator.

Definition at line 1220 of file tftp.c.