Struct protocol_ftp_client::FtpTransmitter
[−]
[src]
pub struct FtpTransmitter {
// some fields omitted
}"Active" side of FTP protocol, i.e. fill buffer with desired FTP commands for further delivery to remote server.
Methods
impl FtpTransmitter[src]
fn to_receiver(self) -> FtpReceiver
Sometimes you need to manually advance to Receiver
e.g. in case of LIST or file get commands, servers sends
start data transfer and end data transfer responses.
fn send_login(self, buffer: &mut [u8], count: &mut usize, login: &str) -> FtpReceiver
Fills the output buffer with the login command (takes login string argument ),
modifies count variable with the count of written bytes and returns FtpReceiver.
fn send_password(self, buffer: &mut [u8], count: &mut usize, pass: &str) -> FtpReceiver
Fills the output buffer with the password command (takes password string argument ),
modifies count variable with the count of written bytes and returns FtpReceiver.
fn send_pwd_req(self, buffer: &mut [u8], count: &mut usize) -> FtpReceiver
Fills the output buffer with the PWD command (take current working directory on remote server),
modifies count variable with the count of written bytes and returns FtpReceiver.
fn get_wd(&self) -> &str
Returns current working directory. Assumes either that send_pwd_req or send_cwd_req
has been sent and succeeded.
fn send_type_req(self, buffer: &mut [u8], count: &mut usize, data_type: DataMode) -> FtpReceiver
Fills the output buffer with the data transfer mode request (binary or text),
modifies count variable with the count of written bytes and returns FtpReceiver.
fn get_type(&self) -> &DataMode
Returns current data mode. Assumes either that send_type_req
has been sent and succeeded.
fn send_system_req(self, buffer: &mut [u8], count: &mut usize) -> FtpReceiver
Fills the output buffer with the remote system request;
modifies count variable with the count of written bytes and returns FtpReceiver.
fn get_system(&self) -> (&String, &String)
Returns remote system with subtype. Assumes either that send_system_req
has been sent and succeeded.
fn send_pasv_req(self, buffer: &mut [u8], count: &mut usize) -> FtpReceiver
Fills the output buffer with the PASS requests to allow further data transfer (LIST or get file)
modifies count variable with the count of written bytes and returns FtpReceiver.
fn send_get_req(self, buffer: &mut [u8], count: &mut usize, file_path: &str) -> FtpReceiver
Fills the output buffer with get remove file command (takes path string argument ),
modifies count variable with the count of written bytes and returns FtpReceiver.
fn send_cwd_req(self, buffer: &mut [u8], count: &mut usize, path: &str) -> FtpReceiver
Fills the output buffer with change remote working directory command (takes path string argument ),
modifies count variable with the count of written bytes and returns FtpReceiver.
fn take_endpoint(&mut self) -> (Ipv4Addr, u16)
Takes pair of IP-address and port, where TCP-connection can be opened to.
Assumes send_pasv_req has been invoked before.
fn send_list_req(self, buffer: &mut [u8], count: &mut usize) -> FtpReceiver
Fills the output buffer with LIST command to get directory listing of current remote working directory;
modifies count variable with the count of written bytes and returns FtpReceiver.
fn parse_list(&self, data: &[u8]) -> Result<Vec<RemoteFile>, FtpError>
Parses remote directory listing, requested by send_list_req command.