22 #include <satcat5/udp_socket.h>
46 {
return m_xfer_bytes;}
49 void reset(
const char* msg);
54 u16 opcode,
const char* filename);
74 friend satcat5::test::TftpClient;
75 friend satcat5::test::TftpServer;
84 void send_ack(u16 block_id);
85 void send_data(u16 block_id);
86 void send_packet(
unsigned len, u16 retry);
103 u8 m_retry_buff[516];
121 const char* filename);
127 const char* filename);
140 friend satcat5::test::TftpClient;
191 friend satcat5::test::TftpServer;
Limited read of next N bytes.
Abstract API for reading byte-streams and packets.
Abstract API for writing byte-streams and packets.
A net::Protocol is the counterpart to net::Dispatch that handles a particular data stream,...
Timer objects are polled after a fixed delay or at a regular interval.
Implementation of "net::Address" for UDP Dispatch.
Dispatcher sorts incoming UDP messages by port index.
A TFTP client makes request(s) to a remote server.
void begin_upload(satcat5::io::Readable *src, const satcat5::ip::Addr &server, const char *filename)
Upload data from a Readable stream to the server.
u32 progress_bytes() const
Transfer progress, measured in bytes.
u32 progress_blocks() const
Transfer progress, measured in 512-byte blocks.
TftpClient(satcat5::udp::Dispatch *iface)
Attach this client to a network interface.
bool active() const
Is there an active transfer?
void begin_download(satcat5::io::Writeable *dst, const satcat5::ip::Addr &server, const char *filename)
Download a file from server to a Writeable stream.
ServerCore is the base class that handles TFTP network functions.
bool active() const
Is there an active transfer?
void frame_rcvd(satcat5::io::LimitedRead &src) override
Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.
virtual satcat5::io::Readable * read(const char *filename)=0
Child class MUST override these methods.
TftpServerCore(satcat5::udp::Dispatch *iface)
Users cannot instantiate this class directly.
TFTP server with a simple streaming source and sink.
satcat5::io::Readable * read(const char *filename) override
Child class MUST override these methods.
TftpServerSimple(satcat5::udp::Dispatch *iface, satcat5::io::Readable *src, satcat5::io::Writeable *dst)
Attach this server to a network interface, and to a source and sink for transfered data.
Transfer objects used by both TftpClient and TftpServer.
void file_send(satcat5::io::Readable *src, bool now)
Begin transfer of a single file (DATA-ACK-DATA-ACK).
u32 progress_blocks() const
Transfer progress, measured in 512-byte blocks.
void request(const satcat5::ip::Addr &dstaddr, u16 opcode, const char *filename)
Issue a write-request or read-request.
bool is_duplicate_request()
Before calling accept, test if this is a duplicate request.
void timer_event() override
Child class MUST override this method.
void accept()
Accept remote connection and note reply address.
void frame_rcvd(satcat5::io::LimitedRead &src) override
Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.
void file_recv(satcat5::io::Writeable *dst, bool now)
Begin transfer of a single file (DATA-ACK-DATA-ACK).
void send_error(u16 errcode)
Send an error message.
TftpTransfer(satcat5::udp::Dispatch *iface)
Create an idle connection object.
u32 progress_bytes() const
Transfer progress, measured in bytes.
bool active() const
Is there a transfer in progress?
void reset(const char *msg)
Immediately revert to the idle state.
IPv4 address is a 32-bit unsigned integer.