ftp
FTP Protocol Helpers
Functions
| Function | Description |
|---|---|
_ftp_byte_at | Internal byte reader. |
_ftp_copy | Internal: copy bytes. |
_ftp_crlf | Internal: write CRLF. |
ftp_format_user | Format USER command: “USER user\r\n” |
ftp_format_pass | Format PASS command: “PASS pass\r\n” |
ftp_format_retr | Format RETR command: “RETR name\r\n” |
ftp_format_cwd | Format CWD command: “CWD path\r\n” |
ftp_format_list | Format LIST command: “LIST\r\n” |
ftp_parse_reply | Parse FTP reply code from buffer (first 3 digits). |
_ftp_parse_num | Internal: parse a decimal number from buf starting at pos, until comma or ‘)’. |
_ftp_skip_num | Internal: find next comma or ‘)’ position from pos. |
ftp_parse_pasv | Parse PASV response: “227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).” Extract… |
Details
_ftp_byte_at
fn _ftp_byte_at(buf: &i8, idx: i64) -> i64Internal byte reader.
_ftp_copy
fn _ftp_copy(dst: &i8, doff: i64, src: &i8, soff: i64, n: i64) -> i64Internal: copy bytes.
_ftp_crlf
fn _ftp_crlf(out: &i8, pos: i64) -> i64Internal: write CRLF.
ftp_format_user
fn ftp_format_user(user: &i8, ulen: i64, out: &i8) -> i64Format USER command: “USER user\r\n”
ftp_format_pass
fn ftp_format_pass(pass: &i8, plen: i64, out: &i8) -> i64Format PASS command: “PASS pass\r\n”
ftp_format_retr
fn ftp_format_retr(name: &i8, nlen: i64, out: &i8) -> i64Format RETR command: “RETR name\r\n”
ftp_format_cwd
fn ftp_format_cwd(path: &i8, plen: i64, out: &i8) -> i64Format CWD command: “CWD path\r\n”
ftp_format_list
fn ftp_format_list(out: &i8) -> i64Format LIST command: “LIST\r\n”
ftp_parse_reply
fn ftp_parse_reply(buf: &i8, len: i64) -> i64Parse FTP reply code from buffer (first 3 digits).
_ftp_parse_num
fn _ftp_parse_num(buf: &i8, pos: i64, len: i64) -> i64Internal: parse a decimal number from buf starting at pos, until comma or ‘)’.
_ftp_skip_num
fn _ftp_skip_num(buf: &i8, pos: i64, len: i64) -> i64Internal: find next comma or ‘)’ position from pos.
ftp_parse_pasv
fn ftp_parse_pasv(buf: &i8, len: i64, out_port: &i64) -> i64Parse PASV response: “227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).” Extracts port = p1*256 + p2 into out_port[0]. Returns 1 if ok.