D:/opendownloadmanager/ODM-1.x/InetFile/cURL_lib/ftp.c File Reference

#include "setup.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <curl/curl.h>
#include "urldata.h"
#include "sendf.h"
#include "easyif.h"
#include "if2ip.h"
#include "hostip.h"
#include "progress.h"
#include "transfer.h"
#include "escape.h"
#include "http.h"
#include "socks.h"
#include "ftp.h"
#include "strtoofft.h"
#include "strequal.h"
#include "sslgen.h"
#include "connect.h"
#include "strerror.h"
#include "memory.h"
#include "inet_ntop.h"
#include "select.h"
#include "parsedate.h"
#include "sockaddr.h"
#include "multiif.h"
#include <curl/mprintf.h>

Go to the source code of this file.

Defines

#define _MPRINTF_REPLACE
#define NIFLAGS   NI_NUMERICHOST | NI_NUMERICSERV
#define FTPSENDF(x, y, z)
#define NBFTPSENDF(x, y, z)
#define lastline(line)
#define NEWHOST_BUFSIZE   48
#define SBUF_SIZE   1024

Enumerations

enum  ftpport { EPRT, PORT, DONE }

Functions

static CURLcode ftp_sendquote (struct connectdata *conn, struct curl_slist *quote)
static CURLcode ftp_quit (struct connectdata *conn)
static CURLcode ftp_parse_url_path (struct connectdata *conn)
static CURLcode ftp_regular_transfer (struct connectdata *conn, bool *done)
static void ftp_pasv_verbose (struct connectdata *conn, Curl_addrinfo *ai, char *newhost, int port)
static CURLcode ftp_state_post_rest (struct connectdata *conn)
static CURLcode ftp_state_post_cwd (struct connectdata *conn)
static CURLcode ftp_state_quote (struct connectdata *conn, bool init, ftpstate instate)
static CURLcode ftp_nb_type (struct connectdata *conn, bool ascii, ftpstate state)
static int ftp_need_type (struct connectdata *conn, bool ascii)
static void freedirs (struct connectdata *conn)
static bool isBadFtpString (const char *string)
static CURLcode AllowServerConnect (struct connectdata *conn)
static void ftp_respinit (struct connectdata *conn)
static CURLcode ftp_readresp (curl_socket_t sockfd, struct connectdata *conn, int *ftpcode, size_t *size)
CURLcode Curl_GetFTPResponse (ssize_t *nreadp, struct connectdata *conn, int *ftpcode)
static void state (struct connectdata *conn, ftpstate state)
static CURLcode ftp_state_user (struct connectdata *conn)
static CURLcode ftp_state_pwd (struct connectdata *conn)
int Curl_ftp_getsock (struct connectdata *conn, curl_socket_t *socks, int numsocks)
static CURLcode ftp_state_cwd (struct connectdata *conn)
static CURLcode ftp_state_use_port (struct connectdata *conn, ftpport fcmd)
static CURLcode ftp_state_use_pasv (struct connectdata *conn)
static CURLcode ftp_state_post_size (struct connectdata *conn)
static CURLcode ftp_state_post_type (struct connectdata *conn)
static CURLcode ftp_state_post_listtype (struct connectdata *conn)
static CURLcode ftp_state_post_retrtype (struct connectdata *conn)
static CURLcode ftp_state_post_stortype (struct connectdata *conn)
static CURLcode ftp_state_post_mdtm (struct connectdata *conn)
static CURLcode ftp_state_ul_setup (struct connectdata *conn, bool sizechecked)
static CURLcode ftp_state_pasv_resp (struct connectdata *conn, int ftpcode)
static CURLcode ftp_state_port_resp (struct connectdata *conn, int ftpcode)
static CURLcode ftp_state_mdtm_resp (struct connectdata *conn, int ftpcode)
static CURLcode ftp_state_type_resp (struct connectdata *conn, int ftpcode, ftpstate instate)
static CURLcode ftp_state_post_retr_size (struct connectdata *conn, curl_off_t filesize)
static CURLcode ftp_state_size_resp (struct connectdata *conn, int ftpcode, ftpstate instate)
static CURLcode ftp_state_rest_resp (struct connectdata *conn, int ftpcode, ftpstate instate)
static CURLcode ftp_state_stor_resp (struct connectdata *conn, int ftpcode)
static CURLcode ftp_state_get_resp (struct connectdata *conn, int ftpcode, ftpstate instate)
static CURLcode ftp_state_loggedin (struct connectdata *conn)
static CURLcode ftp_state_user_resp (struct connectdata *conn, int ftpcode, ftpstate instate)
static CURLcode ftp_state_acct_resp (struct connectdata *conn, int ftpcode)
static CURLcode ftp_statemach_act (struct connectdata *conn)
static long ftp_state_timeout (struct connectdata *conn)
CURLcode Curl_ftp_multi_statemach (struct connectdata *conn, bool *done)
static CURLcode ftp_easy_statemach (struct connectdata *conn)
static CURLcode ftp_init (struct connectdata *conn)
CURLcode Curl_ftp_connect (struct connectdata *conn, bool *done)
CURLcode Curl_ftp_done (struct connectdata *conn, CURLcode status, bool premature)
static CURLcode ftp_range (struct connectdata *conn)
CURLcode Curl_ftp_nextconnect (struct connectdata *conn)
static CURLcode ftp_perform (struct connectdata *conn, bool *connected, bool *dophase_done)
CURLcode Curl_ftp (struct connectdata *conn, bool *done)
CURLcode Curl_nbftpsendf (struct connectdata *conn, const char *fmt,...)
CURLcode Curl_ftpsendf (struct connectdata *conn, const char *fmt,...)
CURLcode Curl_ftp_disconnect (struct connectdata *conn)
static CURLcode ftp_dophase_done (struct connectdata *conn, bool connected)
CURLcode Curl_ftp_doing (struct connectdata *conn, bool *dophase_done)


Define Documentation

#define _MPRINTF_REPLACE

Definition at line 98 of file ftp.c.

#define FTPSENDF ( x,
y,
 ) 

Value:

if ((result = Curl_ftpsendf(x,y,z)) != CURLE_OK) \
                              return result

Definition at line 138 of file ftp.c.

Referenced by ftp_sendquote().

#define lastline ( line   ) 

Value:

(ISDIGIT(line[0]) && ISDIGIT(line[1]) && \
                        ISDIGIT(line[2]) && (' ' == line[3]))

Definition at line 278 of file ftp.c.

Referenced by Curl_GetFTPResponse(), and ftp_readresp().

#define NBFTPSENDF ( x,
y,
 ) 

#define NEWHOST_BUFSIZE   48

Referenced by ftp_state_pasv_resp().

#define NIFLAGS   NI_NUMERICHOST | NI_NUMERICSERV

Definition at line 109 of file ftp.c.

Referenced by ftp_state_use_port().

#define SBUF_SIZE   1024

Referenced by Curl_ftpsendf(), and Curl_nbftpsendf().


Enumeration Type Documentation

enum ftpport

Enumerator:
EPRT 
PORT 
DONE 

Definition at line 839 of file ftp.c.


Function Documentation

static CURLcode AllowServerConnect ( struct connectdata conn  )  [static]

CURLcode Curl_ftp ( struct connectdata conn,
bool done 
)

Definition at line 3478 of file ftp.c.

References CURLE_OK, FALSE, ftp_init(), ftp_parse_url_path(), and ftp_regular_transfer().

Referenced by CreateConnection().

CURLcode Curl_ftp_connect ( struct connectdata conn,
bool done 
)

CURLcode Curl_ftp_disconnect ( struct connectdata conn  ) 

CURLcode Curl_ftp_doing ( struct connectdata conn,
bool dophase_done 
)

Definition at line 3907 of file ftp.c.

References Curl_ftp_multi_statemach(), connectdata::data, DEBUGF, FALSE, ftp_dophase_done(), and infof.

Referenced by CreateConnection().

CURLcode Curl_ftp_done ( struct connectdata conn,
CURLcode  status,
bool  premature 
)

int Curl_ftp_getsock ( struct connectdata conn,
curl_socket_t socks,
int  numsocks 
)

CURLcode Curl_ftp_multi_statemach ( struct connectdata conn,
bool done 
)

CURLcode Curl_ftp_nextconnect ( struct connectdata conn  ) 

CURLcode Curl_ftpsendf ( struct connectdata conn,
const char *  fmt,
  ... 
)

CURLcode Curl_GetFTPResponse ( ssize_t *  nreadp,
struct connectdata conn,
int *  ftpcode 
)

CURLcode Curl_nbftpsendf ( struct connectdata conn,
const char *  fmt,
  ... 
)

static void freedirs ( struct connectdata conn  )  [static]

static CURLcode ftp_dophase_done ( struct connectdata conn,
bool  connected 
) [static]

static CURLcode ftp_easy_statemach ( struct connectdata conn  )  [static]

static CURLcode ftp_init ( struct connectdata conn  )  [static]

static CURLcode ftp_nb_type ( struct connectdata conn,
bool  ascii,
ftpstate  state 
) [static]

static int ftp_need_type ( struct connectdata conn,
bool  ascii 
) [static]

Definition at line 3246 of file ftp.c.

References connectdata::ftpc, connectdata::proto, and ftp_conn::transfertype.

Referenced by ftp_state_post_mdtm().

static CURLcode ftp_parse_url_path ( struct connectdata conn  )  [static]

static void ftp_pasv_verbose ( struct connectdata conn,
Curl_addrinfo ai,
char *  newhost,
int  port 
) [static]

Definition at line 3291 of file ftp.c.

References Curl_printable_address(), connectdata::data, and infof.

Referenced by ftp_state_pasv_resp().

static CURLcode ftp_perform ( struct connectdata conn,
bool connected,
bool dophase_done 
) [static]

static CURLcode ftp_quit ( struct connectdata conn  )  [static]

static CURLcode ftp_range ( struct connectdata conn  )  [static]

static CURLcode ftp_readresp ( curl_socket_t  sockfd,
struct connectdata conn,
int *  ftpcode,
size_t *  size 
) [static]

static CURLcode ftp_regular_transfer ( struct connectdata conn,
bool done 
) [static]

static void ftp_respinit ( struct connectdata conn  )  [static]

static CURLcode ftp_sendquote ( struct connectdata conn,
struct curl_slist quote 
) [static]

static CURLcode ftp_state_acct_resp ( struct connectdata conn,
int  ftpcode 
) [static]

Definition at line 2419 of file ftp.c.

References CURLE_FTP_WEIRD_PASS_REPLY, CURLE_OK, connectdata::data, failf, and ftp_state_loggedin().

Referenced by ftp_statemach_act().

static CURLcode ftp_state_cwd ( struct connectdata conn  )  [static]

static CURLcode ftp_state_get_resp ( struct connectdata conn,
int  ftpcode,
ftpstate  instate 
) [static]

static CURLcode ftp_state_loggedin ( struct connectdata conn  )  [static]

static CURLcode ftp_state_mdtm_resp ( struct connectdata conn,
int  ftpcode 
) [static]

static CURLcode ftp_state_pasv_resp ( struct connectdata conn,
int  ftpcode 
) [static]

static CURLcode ftp_state_port_resp ( struct connectdata conn,
int  ftpcode 
) [static]

static CURLcode ftp_state_post_cwd ( struct connectdata conn  )  [static]

static CURLcode ftp_state_post_listtype ( struct connectdata conn  )  [static]

static CURLcode ftp_state_post_mdtm ( struct connectdata conn  )  [static]

static CURLcode ftp_state_post_rest ( struct connectdata conn  )  [static]

static CURLcode ftp_state_post_retr_size ( struct connectdata conn,
curl_off_t  filesize 
) [static]

static CURLcode ftp_state_post_retrtype ( struct connectdata conn  )  [static]

Definition at line 1357 of file ftp.c.

References CURLE_OK, FTP_RETR_PREQUOTE, ftp_state_quote(), and TRUE.

Referenced by ftp_state_type_resp().

static CURLcode ftp_state_post_size ( struct connectdata conn  )  [static]

static CURLcode ftp_state_post_stortype ( struct connectdata conn  )  [static]

Definition at line 1368 of file ftp.c.

References CURLE_OK, ftp_state_quote(), FTP_STOR_PREQUOTE, and TRUE.

Referenced by ftp_state_type_resp().

static CURLcode ftp_state_post_type ( struct connectdata conn  )  [static]

static CURLcode ftp_state_pwd ( struct connectdata conn  )  [static]

Definition at line 765 of file ftp.c.

References CURLE_OK, FTP_PWD, NBFTPSENDF, NULL, and state().

Referenced by ftp_state_loggedin(), and ftp_statemach_act().

static CURLcode ftp_state_quote ( struct connectdata conn,
bool  init,
ftpstate  instate 
) [static]

static CURLcode ftp_state_rest_resp ( struct connectdata conn,
int  ftpcode,
ftpstate  instate 
) [static]

static CURLcode ftp_state_size_resp ( struct connectdata conn,
int  ftpcode,
ftpstate  instate 
) [static]

static CURLcode ftp_state_stor_resp ( struct connectdata conn,
int  ftpcode 
) [static]

static long ftp_state_timeout ( struct connectdata conn  )  [static]

static CURLcode ftp_state_type_resp ( struct connectdata conn,
int  ftpcode,
ftpstate  instate 
) [static]

static CURLcode ftp_state_ul_setup ( struct connectdata conn,
bool  sizechecked 
) [static]

static CURLcode ftp_state_use_pasv ( struct connectdata conn  )  [static]

static CURLcode ftp_state_use_port ( struct connectdata conn,
ftpport  fcmd 
) [static]

static CURLcode ftp_state_user ( struct connectdata conn  )  [static]

static CURLcode ftp_state_user_resp ( struct connectdata conn,
int  ftpcode,
ftpstate  instate 
) [static]

static CURLcode ftp_statemach_act ( struct connectdata conn  )  [static]

Definition at line 2435 of file ftp.c.

References UrlState::buffer, ftp_conn::count1, ftp_conn::count2, ftp_conn::count3, Curl_nbftpsendf(), Curl_sec_login(), Curl_sec_request_prot(), Curl_ssl_connect(), Curl_ssl_shutdown(), Curl_tvnow, Curl_write(), CURLE_FAILED_INIT, CURLE_FTP_ACCESS_DENIED, CURLE_FTP_QUOTE_ERROR, CURLE_FTP_SSL_FAILED, CURLE_FTP_WEIRD_SERVER_REPLY, CURLE_OK, CURLE_OUT_OF_MEMORY, CURLFTPAUTH_DEFAULT, CURLFTPAUTH_SSL, CURLFTPAUTH_TLS, CURLFTPSSL_CONTROL, CURLFTPSSL_TRY, ftp_conn::cwdfail, connectdata::data, DEBUGF, ftp_conn::dirdepth, ftp_conn::dirs, ftp_conn::entrypath, failf, FALSE, FIRSTSOCKET, free, FTP_ACCT, FTP_AUTH, FTP_CCC, UserDefined::ftp_ccc, UserDefined::ftp_create_missing_dirs, FTP_CWD, FTP_LIST, FTP_LIST_TYPE, FTP_MDTM, FTP_MKD, FTP_PASS, FTP_PASV, FTP_PBSZ, FTP_PORT, FTP_POSTQUOTE, FTP_PROT, FTP_PWD, FTP_QUIT, FTP_QUOTE, ftp_readresp(), FTP_REST, FTP_RETR, FTP_RETR_PREQUOTE, FTP_RETR_REST, FTP_RETR_SIZE, FTP_RETR_TYPE, FTP_SIZE, UserDefined::ftp_ssl, ftp_state_acct_resp(), ftp_state_get_resp(), ftp_state_mdtm_resp(), ftp_state_pasv_resp(), ftp_state_port_resp(), ftp_state_post_cwd(), ftp_state_pwd(), ftp_state_quote(), ftp_state_rest_resp(), ftp_state_size_resp(), ftp_state_stor_resp(), ftp_state_type_resp(), ftp_state_user(), ftp_state_user_resp(), FTP_STOP, FTP_STOR, FTP_STOR_PREQUOTE, FTP_STOR_SIZE, FTP_STOR_TYPE, FTP_TYPE, FTP_USER, FTP_WAIT220, connectdata::ftpc, UserDefined::ftpsslauth, infof, UserDefined::krb, UserDefined::krb_level, malloc, UrlState::most_recent_ftp_entrypath, NBFTPSENDF, NULL, PROT_FTPS, connectdata::proto, connectdata::protocol, ftp_conn::response, SECONDARYSOCKET, ftp_conn::sendleft, ftp_conn::sendsize, ftp_conn::sendthis, SessionHandle::set, connectdata::sock, ssize_t, connectdata::ssl, SessionHandle::state, state(), ftp_conn::state, TRUE, and ssl_connect_data::use.

Referenced by Curl_ftp_multi_statemach(), and ftp_easy_statemach().

static bool isBadFtpString ( const char *  string  )  [static]

Definition at line 171 of file ftp.c.

References NULL.

Referenced by ftp_init(), and ftp_parse_url_path().

static void state ( struct connectdata conn,
ftpstate  state 
) [static]

Definition at line 703 of file ftp.c.

References connectdata::data, connectdata::ftpc, infof, connectdata::proto, and ftp_conn::state.

Referenced by bind_torrent_status(), CBaseStreamControl::CheckStreamState(), fsInternetDownloader::CreateAdditionalSection(), Curl_ftp_connect(), Curl_parsenetrc(), Curl_tftp(), Curl_tftp_connect(), libtorrent::torrent::filter_pieces(), ftp_nb_type(), ftp_quit(), ftp_state_cwd(), ftp_state_get_resp(), ftp_state_loggedin(), ftp_state_mdtm_resp(), ftp_state_pasv_resp(), ftp_state_port_resp(), ftp_state_post_cwd(), ftp_state_post_listtype(), ftp_state_post_rest(), ftp_state_post_retr_size(), ftp_state_post_size(), ftp_state_post_type(), ftp_state_pwd(), ftp_state_quote(), ftp_state_rest_resp(), ftp_state_stor_resp(), ftp_state_ul_setup(), ftp_state_use_pasv(), ftp_state_use_port(), ftp_state_user(), ftp_state_user_resp(), ftp_statemach_act(), fsInternetDownloader::GetDoneSectionCount(), fsInternetDownloader::GetDownloadingSectionCount(), fsInternetDownloader::GetStoppedSectionCount(), inflate(), inflate_fast(), inflateBack(), inflateBackInit_(), inflateCopy(), inflateEnd(), inflateGetHeader(), inflateInit2_(), inflatePrime(), inflateReset(), inflateSetDictionary(), inflateSync(), inflateSyncPoint(), fsInternetDownloader::IsAllSectionsOk(), fsInternetDownloader::IsDone(), fsInternetDownloader::IsDownloading(), fsInternetDownloader::LaunchOneMoreSection(), multi_runsingle(), CListCtrlEx::OnParentNotify(), CChildView::OnUpdatePluginCommand(), fsInternetDownloader::RemoveMirror(), fsDownloadMgr::SaveState(), and updatewindow().


Generated on Sun May 25 00:20:05 2008 by  doxygen 1.5.6