Go to the documentation of this file.
31 #ifndef _TFTP_CLIENT_H
32 #define _TFTP_CLIENT_H
39 #ifndef TFTP_CLIENT_SUPPORT
40 #define TFTP_CLIENT_SUPPORT ENABLED
41 #elif (TFTP_CLIENT_SUPPORT != ENABLED && TFTP_CLIENT_SUPPORT != DISABLED)
42 #error TFTP_CLIENT_SUPPORT parameter is not valid
46 #ifndef TFTP_CLIENT_TICK_INTERVAL
47 #define TFTP_CLIENT_TICK_INTERVAL 500
48 #elif (TFTP_CLIENT_TICK_INTERVAL < 100)
49 #error TFTP_CLIENT_TICK_INTERVAL parameter is not valid
53 #ifndef TFTP_CLIENT_MAX_RETRIES
54 #define TFTP_CLIENT_MAX_RETRIES 5
55 #elif (TFTP_CLIENT_MAX_RETRIES < 1)
56 #error TFTP_CLIENT_MAX_RETRIES parameter is not valid
60 #ifndef TFTP_CLIENT_TIMEOUT
61 #define TFTP_CLIENT_TIMEOUT 5000
62 #elif (TFTP_CLIENT_TIMEOUT < 1000)
63 #error TFTP_CLIENT_TIMEOUT parameter is not valid
67 #ifndef TFTP_CLIENT_FINAL_DELAY
68 #define TFTP_CLIENT_FINAL_DELAY 10000
69 #elif (TFTP_CLIENT_FINAL_DELAY < 1000)
70 #error TFTP_CLIENT_FINAL_DELAY parameter is not valid
74 #ifndef TFTP_CLIENT_BLOCK_SIZE
75 #define TFTP_CLIENT_BLOCK_SIZE 512
76 #elif (TFTP_CLIENT_BLOCK_SIZE < 512)
77 #error TFTP_CLIENT_BLOCK_SIZE parameter is not valid
81 #ifndef TFTP_CLIENT_PRIVATE_CONTEXT
82 #define TFTP_CLIENT_PRIVATE_CONTEXT
86 #define TFTP_CLIENT_MAX_PACKET_SIZE (sizeof(TftpDataPacket) + TFTP_CLIENT_BLOCK_SIZE)
157 const IpAddr *serverIpAddr, uint16_t serverPort);
@ TFTP_CLIENT_STATE_CLOSED
TftpClientState
TFTP client state.
@ TFTP_CLIENT_STATE_COMPLETE
error_t tftpClientInit(TftpClientContext *context)
TFTP client initialization.
size_t inPacketLen
Length of the outgoing packet.
error_t tftpClientConnect(TftpClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort)
Specify the address of the TFTP server.
TftpFileMode
File access modes.
error_t tftpClientWriteFile(TftpClientContext *context, const void *data, size_t length, size_t *written, uint_t flags)
Write data to the file.
error_t tftpClientCloseFile(TftpClientContext *context)
Close the file.
void tftpClientDeinit(TftpClientContext *context)
Release TFTP client context.
systime_t timestamp
Time stamp to manage retransmissions.
@ TFTP_FILE_MODE_NETASCII
error_t tftpClientReadFile(TftpClientContext *context, void *data, size_t size, size_t *received, uint_t flags)
Read data from the file.
uint32_t systime_t
System time.
#define TFTP_CLIENT_PRIVATE_CONTEXT
Socket * socket
Underlying UDP socket.
#define TFTP_CLIENT_MAX_PACKET_SIZE
@ TFTP_CLIENT_STATE_LAST_DATA
uint_t retransmitCount
Retransmission counter.
TftpClientState state
TFTP client state.
error_t tftpClientOpenFile(TftpClientContext *context, const char_t *filename, uint_t mode)
Open a file for reading or writing.
size_t outPacketLen
Length of the outgoing packet.
NetInterface * interface
Underlying network interface.
Definitions common to TFTP client and server.
uint16_t block
Block number.
error_t tftpClientFlushFile(TftpClientContext *context)
Flush pending write operations.
@ TFTP_CLIENT_STATE_ERROR
error_t tftpClientBindToInterface(TftpClientContext *context, NetInterface *interface)
Bind the TFTP client to a particular network interface.