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)
100 TFTP_FILE_MODE_READ = 0,
101 TFTP_FILE_MODE_WRITE = 1,
102 TFTP_FILE_MODE_OCTET = 0,
103 TFTP_FILE_MODE_NETASCII = 2
113 TFTP_CLIENT_STATE_CLOSED = 0,
114 TFTP_CLIENT_STATE_RRQ = 1,
115 TFTP_CLIENT_STATE_WRQ = 2,
116 TFTP_CLIENT_STATE_DATA = 3,
117 TFTP_CLIENT_STATE_ACK = 4,
118 TFTP_CLIENT_STATE_LAST_DATA = 5,
119 TFTP_CLIENT_STATE_COMPLETE = 6,
120 TFTP_CLIENT_STATE_ERROR = 7
139 uint8_t inPacket[TFTP_CLIENT_MAX_PACKET_SIZE];
143 uint8_t outPacket[TFTP_CLIENT_MAX_PACKET_SIZE];
146 TFTP_CLIENT_PRIVATE_CONTEXT
154 NetInterface *interface);
157 const IpAddr *serverIpAddr, uint16_t serverPort);
160 const char_t *filename, uint_t mode);
163 const void *data,
size_t length,
size_t *written, uint_t flags);
168 void *data,
size_t size,
size_t *received, uint_t flags);
error_t
Error codes.
Definition error.h:43
uint32_t systime_t
System time.
Definition os_port_none.h:90
IP network address.
Definition ip.h:72
TFTP client context.
Definition tftp_client.h:129
size_t outPacketLen
Length of the outgoing packet.
Definition tftp_client.h:144
systime_t timestamp
Time stamp to manage retransmissions.
Definition tftp_client.h:137
TftpClientState state
TFTP client state.
Definition tftp_client.h:135
uint_t retransmitCount
Retransmission counter.
Definition tftp_client.h:138
Socket * socket
Underlying UDP socket.
Definition tftp_client.h:134
uint16_t block
Block number.
Definition tftp_client.h:136
size_t inPacketLen
Length of the outgoing packet.
Definition tftp_client.h:140
NetInterface * interface
Underlying network interface.
Definition tftp_client.h:130
TftpClientState
TFTP client state.
Definition tftp_client.h:112
TftpFileMode
File access modes.
Definition tftp_client.h:99
Definitions common to TFTP client and server.