From 3611cb17b74740588059c5fe2d11545c6e11f573 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 8 Aug 2006 23:45:52 +0000 Subject: Initial (untested) implementation of TFTP over the new UDP API. --- src/include/gpxe/tftp.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/include') diff --git a/src/include/gpxe/tftp.h b/src/include/gpxe/tftp.h index f6b738e68..e5c599bc0 100644 --- a/src/include/gpxe/tftp.h +++ b/src/include/gpxe/tftp.h @@ -9,6 +9,8 @@ #include #include +#include +#include #define TFTP_PORT 69 /**< Default TFTP server port */ #define TFTP_DEFAULT_BLKSIZE 512 /**< Default TFTP data block size */ @@ -59,7 +61,7 @@ struct tftp_error { /** A TFTP options acknowledgement (OACK) packet */ struct tftp_oack { uint16_t opcode; - uint8_t data[0]; + char data[0]; } __attribute__ (( packed )); /** The common header of all TFTP packets */ @@ -87,6 +89,17 @@ struct tftp_session { struct udp_connection udp; /** Filename */ const char *filename; + + /** + * Callback function + * + * @v tftp TFTP connection + * @v block Block number + * @v data Data + * @v len Length of data + */ + void ( * callback ) ( struct tftp_session *tftp, unsigned int block, + void *data, size_t len ); /** * Transfer ID * @@ -119,7 +132,12 @@ struct tftp_session { * TFTP server. If the TFTP server does not support the * "tsize" option, this value will be zero. */ - off_t tsize; + unsigned long tsize; + + /** Asynchronous operation for this session */ + struct async_operation aop; + /** Retransmission timer */ + struct retry_timer timer; }; #endif /* _GPXE_TFTP_H */ -- cgit v1.2.3-55-g7522