SatCat5
satcat5::udp::TftpTransfer Class Reference

Detailed Description

Transfer objects used by both TftpClient and TftpServer.

Users should not typically use this object directly.

Definition at line 28 of file udp_tftp.h.

#include <udp_tftp.h>

Inheritance diagram for satcat5::udp::TftpTransfer:
[legend]
Collaboration diagram for satcat5::udp::TftpTransfer:
[legend]

Public Member Functions

 TftpTransfer (satcat5::udp::Dispatch *iface)
 Create an idle connection object.
 
bool active () const
 Is there a transfer in progress?
 
u32 progress_blocks () const
 Transfer progress, measured in 512-byte blocks.
 
u32 progress_bytes () const
 Transfer progress, measured in bytes.
 
void reset (const char *msg)
 Immediately revert to the idle state.
 
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 accept ()
 Accept remote connection and note reply address. More...
 
void send_error (u16 errcode)
 Send an error message.
 
void timer_once (unsigned msec)
 Configure a one-time notification after X milliseconds.
 
void timer_every (unsigned msec)
 Configure a repeating notification every X milliseconds.
 
void timer_stop ()
 Stop all future notifications.
 
unsigned timer_interval () const
 Accessor for recurring timer interval, if one is set.
 
unsigned timer_remaining () const
 Accessor for time to next event, if one is set.
 
void file_send (satcat5::io::Readable *src, bool now)
 Begin transfer of a single file (DATA-ACK-DATA-ACK). More...
 
void file_recv (satcat5::io::Writeable *dst, bool now)
 Begin transfer of a single file (DATA-ACK-DATA-ACK). More...
 

Static Public Member Functions

static unsigned count_timer ()
 Count all objects of this type, including idle timers.
 

Protected Member Functions

void frame_rcvd (satcat5::io::LimitedRead &src) override
 Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value. More...
 
void timer_event () override
 Child class MUST override this method.
 
void read_data (u16 block_id, satcat5::io::LimitedRead &src)
 
void read_error (satcat5::io::LimitedRead &src)
 
void send_ack (u16 block_id)
 
void send_data (u16 block_id)
 
void send_packet (unsigned len, u16 retry)
 

Protected Attributes

satcat5::udp::Address m_addr
 
satcat5::io::Readablem_src
 
satcat5::io::Writeablem_dst
 
u32 m_xfer_bytes
 
u32 m_block_id
 
u16 m_flags
 
u16 m_retry_count
 
u16 m_retry_len
 
u8 m_retry_buff [516]
 
satcat5::net::Type m_filter
 Incoming packet filter.
 

Private Member Functions

void query (unsigned elapsed_msec)
 

Private Attributes

satcat5::net::Protocolm_next
 Linked list of Protocols.
 
unsigned m_trem
 
unsigned m_tnext
 

Member Function Documentation

◆ accept()

void TftpTransfer::accept ( )

Accept remote connection and note reply address.

(Host should next call file_send() or file_recv().)

Definition at line 149 of file udp_tftp.cc.

◆ file_recv()

void TftpTransfer::file_recv ( satcat5::io::Writeable dst,
bool  now 
)

Begin transfer of a single file (DATA-ACK-DATA-ACK).

Once activated, the transfer proceeds unless cancelled.

Definition at line 190 of file udp_tftp.cc.

◆ file_send()

void TftpTransfer::file_send ( satcat5::io::Readable src,
bool  now 
)

Begin transfer of a single file (DATA-ACK-DATA-ACK).

Once activated, the transfer proceeds unless cancelled.

Definition at line 170 of file udp_tftp.cc.

◆ frame_rcvd()

void TftpTransfer::frame_rcvd ( satcat5::io::LimitedRead src)
overrideprotectedvirtual

Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.

The child class SHOULD read the frame contents from the provided "src" object, which is only valid until the function returns.

To send a reply:

  • Call m_iface->open_reply() to obtain a Writable object. (This also writes out any applicable frame headers.)
  • Write frame contents, then call write_finalize().

The child class MUST override this method.

Implements satcat5::net::Protocol.

Definition at line 209 of file udp_tftp.cc.


The documentation for this class was generated from the following files: