ELinks 0.18.0
ftp.c File Reference
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "elinks.h"
#include "cache/cache.h"
#include "config/options.h"
#include "intl/libintl.h"
#include "main/select.h"
#include "main/module.h"
#include "network/connection.h"
#include "network/progress.h"
#include "network/socket.h"
#include "osdep/osdep.h"
#include "osdep/stat.h"
#include "protocol/auth/auth.h"
#include "protocol/common.h"
#include "protocol/curl/ftpes.h"
#include "protocol/ftp/ftp.h"
#include "protocol/ftpparse.h"
#include "protocol/uri.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/memory.h"
#include "util/string.h"
Include dependency graph for ftp.c:

Data Structures

struct  ftp_connection_info
struct  ftp_dir_html_format
 How to format an FTP directory listing in HTML. More...

Macros

#define FTP_BUF_SIZE   16384
#define FTP_PERM(perms, buffer, flag, index, id)
#define ADD_CONST(str)

Functions

static void ftp_login (struct socket *)
static void ftp_send_retr_req (struct connection *, struct connection_state)
static void ftp_got_info (struct socket *, struct read_buffer *)
static void ftp_got_user_info (struct socket *, struct read_buffer *)
static void ftp_pass (struct connection *)
static void ftp_pass_info (struct socket *, struct read_buffer *)
static void ftp_retr_file (struct socket *, struct read_buffer *)
static void ftp_got_final_response (struct socket *, struct read_buffer *)
static void got_something_from_data_connection (struct connection *)
static void ftp_end_request (struct connection *, struct connection_state)
static struct ftp_connection_infoadd_file_cmd_to_str (struct connection *)
static void ftp_data_accept (struct connection *conn)
static int parse_psv_resp (char *data, int *n, int max_value)
static int get_ftp_response (struct connection *conn, struct read_buffer *rb, int part, struct sockaddr_storage *sa, off_t *est_length)
void ftp_protocol_handler (struct connection *conn)
static void send_cmd (struct connection *conn, struct string *cmd, void *callback, struct connection_state state)
static int auth_user_matching_uri (struct auth_entry *auth, struct uri *uri)
static void prompt_username_pw (struct connection *conn)
static void add_portcmd_to_string (struct string *string, char *pc)
static int get_ftp_data_socket (struct connection *conn, struct string *command)
static int is_ftp_pathname_safe (const struct string *s)
static void send_it_line_by_line (struct connection *conn, struct string *cmd)
static off_t get_filesize_from_RETR (char *data, int data_len, int *resume)
static int ftp_data_connect (struct connection *conn, int pf, struct sockaddr_storage *sa, int size_of_sockaddr)
static int display_dir_entry (struct cache_entry *cached, off_t *pos, int *tries, const struct ftp_dir_html_format *format, struct ftp_file_info *ftp_info)
static int ftp_get_line (struct cache_entry *cached, char *buf, int bufl, int last, int *len)

Variables

union option_info ftp_options []
struct module ftp_protocol_module

Macro Definition Documentation

◆ ADD_CONST

#define ADD_CONST ( str)
Value:
{ \
add_fragment(conn->cached, conn->from, str, sizeof(str) - 1); \
conn->from += (sizeof(str) - 1); }

◆ FTP_BUF_SIZE

#define FTP_BUF_SIZE   16384

◆ FTP_PERM

#define FTP_PERM ( perms,
buffer,
flag,
index,
id )
Value:
if ((perms) & (flag)) (buffer)[(index)] = (id);

Function Documentation

◆ add_file_cmd_to_str()

struct ftp_connection_info * add_file_cmd_to_str ( struct connection * conn)
static

◆ add_portcmd_to_string()

void add_portcmd_to_string ( struct string * string,
char * pc )
static

◆ auth_user_matching_uri()

int auth_user_matching_uri ( struct auth_entry * auth,
struct uri * uri )
static

◆ display_dir_entry()

int display_dir_entry ( struct cache_entry * cached,
off_t * pos,
int * tries,
const struct ftp_dir_html_format * format,
struct ftp_file_info * ftp_info )
static

◆ ftp_data_accept()

void ftp_data_accept ( struct connection * conn)
static

◆ ftp_data_connect()

int ftp_data_connect ( struct connection * conn,
int pf,
struct sockaddr_storage * sa,
int size_of_sockaddr )
static

◆ ftp_end_request()

void ftp_end_request ( struct connection * ,
struct connection_state  )
static

◆ ftp_get_line()

int ftp_get_line ( struct cache_entry * cached,
char * buf,
int bufl,
int last,
int * len )
static

◆ ftp_got_final_response()

void ftp_got_final_response ( struct socket * socket,
struct read_buffer * rb )
static

◆ ftp_got_info()

void ftp_got_info ( struct socket * socket,
struct read_buffer * rb )
static

◆ ftp_got_user_info()

void ftp_got_user_info ( struct socket * socket,
struct read_buffer * rb )
static

◆ ftp_login()

void ftp_login ( struct socket * socket)
static

◆ ftp_pass()

void ftp_pass ( struct connection * conn)
static

◆ ftp_pass_info()

void ftp_pass_info ( struct socket * socket,
struct read_buffer * rb )
static

◆ ftp_protocol_handler()

void ftp_protocol_handler ( struct connection * conn)

◆ ftp_retr_file()

void ftp_retr_file ( struct socket * socket,
struct read_buffer * rb )
static

◆ ftp_send_retr_req()

void ftp_send_retr_req ( struct connection * conn,
struct connection_state state )
static

◆ get_filesize_from_RETR()

off_t get_filesize_from_RETR ( char * data,
int data_len,
int * resume )
static

◆ get_ftp_data_socket()

int get_ftp_data_socket ( struct connection * conn,
struct string * command )
static

◆ get_ftp_response()

int get_ftp_response ( struct connection * conn,
struct read_buffer * rb,
int part,
struct sockaddr_storage * sa,
off_t * est_length )
static

◆ got_something_from_data_connection()

void got_something_from_data_connection ( struct connection * )
static

◆ is_ftp_pathname_safe()

int is_ftp_pathname_safe ( const struct string * s)
static

◆ parse_psv_resp()

int parse_psv_resp ( char * data,
int * n,
int max_value )
static

◆ prompt_username_pw()

void prompt_username_pw ( struct connection * conn)
static

◆ send_cmd()

void send_cmd ( struct connection * conn,
struct string * cmd,
void * callback,
struct connection_state state )
static

◆ send_it_line_by_line()

void send_it_line_by_line ( struct connection * conn,
struct string * cmd )
static

Variable Documentation

◆ ftp_options

union option_info ftp_options[]

◆ ftp_protocol_module

struct module ftp_protocol_module
Initial value:
N_("FTP"),
)
#define NULL
Definition explodename.c:35
union option_info ftp_options[]
Definition ftp.c:60
#define N_(msg)
Definition libintl.h:25
#define struct_module(name, options, hooks, submods, data, init, done, getname)
Definition module.h:47