FtpGateway.cc File Reference
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "clients/forward.h"
#include "clients/FtpClient.h"
#include "comm.h"
#include "comm/ConnOpener.h"
#include "comm/Read.h"
#include "comm/TcpAcceptor.h"
#include "CommCalls.h"
#include "compat/strtoll.h"
#include "errorpage.h"
#include "fd.h"
#include "fde.h"
#include "FwdState.h"
#include "html_quote.h"
#include "HttpHdrContRange.h"
#include "HttpHeader.h"
#include "HttpHeaderRange.h"
#include "HttpReply.h"
#include "ip/tools.h"
#include "MemBuf.h"
#include "mime.h"
#include "rfc1738.h"
#include "SquidConfig.h"
#include "SquidString.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "Store.h"
#include "tools.h"
#include "URL.h"
#include "util.h"
#include "wordlist.h"
#include "DelayPools.h"
#include "MemObject.h"
#include <cerrno>
Include dependency graph for FtpGateway.cc:

Go to the source code of this file.

Classes

struct  Ftp::GatewayFlags
 
class  Ftp::Gateway
 
struct  ftpListParts
 

Namespaces

 Ftp
 

Macros

#define CTRL_BUFLEN   16*1024
 
#define MAX_TOKENS   64
 

Typedefs

typedef void( Ftp::StateMethod )(Ftp::Gateway *)
 
typedef Ftp::StateMethod FTPSM
 

Functions

 CBDATA_NAMESPACED_CLASS_INIT (Ftp, Gateway)
 
static int is_month (const char *buf)
 
static void ftpListPartsFree (ftpListParts **parts)
 
static ftpListPartsftpListParseParts (const char *buf, struct Ftp::GatewayFlags flags)
 
static void ftpReadWelcome (Ftp::Gateway *ftpState)
 
static void ftpSendUser (Ftp::Gateway *ftpState)
 
static void ftpReadUser (Ftp::Gateway *ftpState)
 
static void ftpSendPass (Ftp::Gateway *ftpState)
 
static void ftpReadPass (Ftp::Gateway *ftpState)
 
static void ftpSendType (Ftp::Gateway *ftpState)
 
static void ftpReadType (Ftp::Gateway *ftpState)
 
static void ftpTraverseDirectory (Ftp::Gateway *ftpState)
 
static void ftpSendCwd (Ftp::Gateway *ftpState)
 
static void ftpReadCwd (Ftp::Gateway *ftpState)
 
static void ftpSendMkdir (Ftp::Gateway *ftpState)
 
static void ftpReadMkdir (Ftp::Gateway *ftpState)
 
static void ftpGetFile (Ftp::Gateway *ftpState)
 
static void ftpListDir (Ftp::Gateway *ftpState)
 
static void ftpSendMdtm (Ftp::Gateway *ftpState)
 
static void ftpReadMdtm (Ftp::Gateway *ftpState)
 
static void ftpSendSize (Ftp::Gateway *ftpState)
 
static void ftpReadSize (Ftp::Gateway *ftpState)
 
static void ftpReadEPSV (Ftp::Gateway *ftpState)
 
static void ftpSendPassive (Ftp::Gateway *ftpState)
 
static void ftpReadPasv (Ftp::Gateway *ftpState)
 
static void ftpOpenListenSocket (Ftp::Gateway *ftpState, int fallback)
 
static void ftpSendPORT (Ftp::Gateway *ftpState)
 
static void ftpReadPORT (Ftp::Gateway *ftpState)
 
static void ftpReadEPRT (Ftp::Gateway *ftpState)
 
static void ftpRestOrList (Ftp::Gateway *ftpState)
 
static void ftpSendStor (Ftp::Gateway *ftpState)
 
static void ftpReadStor (Ftp::Gateway *ftpState)
 
static void ftpSendRest (Ftp::Gateway *ftpState)
 
static void ftpReadRest (Ftp::Gateway *ftpState)
 
static void ftpSendList (Ftp::Gateway *ftpState)
 
static void ftpSendNlst (Ftp::Gateway *ftpState)
 
static void ftpReadList (Ftp::Gateway *ftpState)
 
static void ftpSendRetr (Ftp::Gateway *ftpState)
 
static void ftpReadRetr (Ftp::Gateway *ftpState)
 
static void ftpReadTransferDone (Ftp::Gateway *ftpState)
 
static void ftpWriteTransferDone (Ftp::Gateway *ftpState)
 
static void ftpSendQuit (Ftp::Gateway *ftpState)
 
static void ftpReadQuit (Ftp::Gateway *ftpState)
 
static void ftpTrySlashHack (Ftp::Gateway *ftpState)
 
static void ftpFail (Ftp::Gateway *ftpState)
 
static void ftpSendReply (Ftp::Gateway *ftpState)
 

Variables

static char cbuf [CTRL_BUFLEN]
 
static FTPSM ftpReadWelcome
 
static FTPSM ftpSendUser
 
static FTPSM ftpReadUser
 
static FTPSM ftpSendPass
 
static FTPSM ftpReadPass
 
static FTPSM ftpSendType
 
static FTPSM ftpReadType
 
static FTPSM ftpSendMdtm
 
static FTPSM ftpReadMdtm
 
static FTPSM ftpSendSize
 
static FTPSM ftpReadSize
 
static FTPSM ftpReadEPRT
 
static FTPSM ftpSendPORT
 
static FTPSM ftpReadPORT
 
static FTPSM ftpSendPassive
 
static FTPSM ftpReadEPSV
 
static FTPSM ftpReadPasv
 
static FTPSM ftpTraverseDirectory
 
static FTPSM ftpListDir
 
static FTPSM ftpGetFile
 
static FTPSM ftpSendCwd
 
static FTPSM ftpReadCwd
 
static FTPSM ftpRestOrList
 
static FTPSM ftpSendList
 
static FTPSM ftpSendNlst
 
static FTPSM ftpReadList
 
static FTPSM ftpSendRest
 
static FTPSM ftpReadRest
 
static FTPSM ftpSendRetr
 
static FTPSM ftpReadRetr
 
static FTPSM ftpReadTransferDone
 
static FTPSM ftpSendStor
 
static FTPSM ftpReadStor
 
static FTPSM ftpWriteTransferDone
 
static FTPSM ftpSendReply
 
static FTPSM ftpSendMkdir
 
static FTPSM ftpReadMkdir
 
static FTPSM ftpFail
 
static FTPSM ftpSendQuit
 
static FTPSM ftpReadQuit
 
FTPSMFTP_SM_FUNCS []
 
static const char * Month []
 

Macro Definition Documentation

#define MAX_TOKENS   64

Definition at line 527 of file FtpGateway.cc.

Referenced by ftpListParseParts().

Typedef Documentation

Definition at line 178 of file FtpGateway.cc.

Function Documentation

CBDATA_NAMESPACED_CLASS_INIT ( Ftp  ,
Gateway   
)
static void ftpGetFile ( Ftp::Gateway ftpState)
static
static void ftpListPartsFree ( ftpListParts **  parts)
static

Definition at line 518 of file FtpGateway.cc.

References safe_free.

Referenced by ftpListParseParts(), and Ftp::Gateway::htmlifyListEntry().

static void ftpReadEPRT ( Ftp::Gateway ftpState)
static
static void ftpReadEPSV ( Ftp::Gateway ftpState)
static
static void ftpReadPass ( Ftp::Gateway ftpState)
static
static void ftpReadPasv ( Ftp::Gateway ftpState)
static
static void ftpReadPORT ( Ftp::Gateway ftpState)
static
static void ftpReadQuit ( Ftp::Gateway ftpState)
static

Completes a client FTP operation with success or other page generated and stored in the entry field by the code issuing QUIT.

Definition at line 2359 of file FtpGateway.cc.

References Client::serverComplete().

static void ftpReadStor ( Ftp::Gateway ftpState)
static
Deprecated:
use ftpState->readStor() instead.

Definition at line 2069 of file FtpGateway.cc.

References Ftp::Gateway::readStor().

static void ftpReadUser ( Ftp::Gateway ftpState)
static
static void ftpSendPassive ( Ftp::Gateway ftpState)
static

Send Passive connection request. Default method is to use modern EPSV request. The failover mechanism should check for previous state and re-call with alternates on failure.

Checks the server control channel is still available before running.

Checks for 'HEAD' method request and passes off for special handling by Ftp::Gateway::processHeadResponse().

Definition at line 1682 of file FtpGateway.cc.

References debugs, Ftp::GatewayFlags::epsv_all_sent, Ftp::Gateway::flags, Ftp::Gateway::haveControlChannel(), HERE(), Ftp::GatewayFlags::isdir, HttpRequest::method, Http::METHOD_HEAD, Ftp::Gateway::processHeadResponse(), Client::request, Ftp::Client::sendPassive(), Ftp::Client::SENT_EPSV_ALL, Ftp::Client::state, and Ftp::Gateway::theSize.

static void ftpSendQuit ( Ftp::Gateway ftpState)
static
static int is_month ( const char *  buf)
static

Definition at line 506 of file FtpGateway.cc.

References i, and Month.

Referenced by ftpListParseParts().

Variable Documentation

FTPSM* FTP_SM_FUNCS[]
Initial value:
= {
NULL,
NULL,
NULL,
NULL,
NULL
}
static FTPSM ftpReadStor
Definition: FtpGateway.cc:235
static FTPSM ftpReadTransferDone
Definition: FtpGateway.cc:233
static FTPSM ftpReadPass
Definition: FtpGateway.cc:204
static FTPSM ftpReadEPRT
Definition: FtpGateway.cc:214
static FTPSM ftpReadSize
Definition: FtpGateway.cc:210
static FTPSM ftpReadMkdir
Definition: FtpGateway.cc:239
static FTPSM ftpReadMdtm
Definition: FtpGateway.cc:208
static FTPSM ftpReadPasv
Definition: FtpGateway.cc:219
static FTPSM ftpReadEPSV
Definition: FtpGateway.cc:218
static FTPSM ftpReadUser
Definition: FtpGateway.cc:202
static FTPSM ftpReadPORT
Definition: FtpGateway.cc:216
static FTPSM ftpReadRest
Definition: FtpGateway.cc:230
static FTPSM ftpReadList
Definition: FtpGateway.cc:228
static FTPSM ftpReadRetr
Definition: FtpGateway.cc:232
static FTPSM ftpReadCwd
Definition: FtpGateway.cc:224
static FTPSM ftpReadWelcome
Definition: FtpGateway.cc:200
static FTPSM ftpWriteTransferDone
Definition: FtpGateway.cc:236
static FTPSM ftpReadQuit
Definition: FtpGateway.cc:242
static FTPSM ftpReadType
Definition: FtpGateway.cc:206
#define NULL
Definition: types.h:166

Definition at line 286 of file FtpGateway.cc.

Referenced by Ftp::Gateway::handleControlReply().

FTPSM ftpGetFile
static

Definition at line 222 of file FtpGateway.cc.

Referenced by ftpTraverseDirectory(), and ftpTrySlashHack().

FTPSM ftpListDir
static

Definition at line 221 of file FtpGateway.cc.

Referenced by ftpReadType(), and ftpTraverseDirectory().

FTPSM ftpReadCwd
static

Definition at line 224 of file FtpGateway.cc.

FTPSM ftpReadEPRT
static

Definition at line 214 of file FtpGateway.cc.

FTPSM ftpReadEPSV
static

Definition at line 218 of file FtpGateway.cc.

FTPSM ftpReadList
static

Definition at line 228 of file FtpGateway.cc.

FTPSM ftpReadMdtm
static

Definition at line 208 of file FtpGateway.cc.

FTPSM ftpReadMkdir
static

Definition at line 239 of file FtpGateway.cc.

FTPSM ftpReadPass
static

Definition at line 204 of file FtpGateway.cc.

Referenced by ftpReadUser().

FTPSM ftpReadPasv
static

Definition at line 219 of file FtpGateway.cc.

FTPSM ftpReadPORT
static

Definition at line 216 of file FtpGateway.cc.

Referenced by ftpSendPORT().

FTPSM ftpReadQuit
static

Definition at line 242 of file FtpGateway.cc.

FTPSM ftpReadRest
static

Definition at line 230 of file FtpGateway.cc.

FTPSM ftpReadRetr
static

Definition at line 232 of file FtpGateway.cc.

FTPSM ftpReadSize
static

Definition at line 210 of file FtpGateway.cc.

FTPSM ftpReadStor
static

Definition at line 235 of file FtpGateway.cc.

FTPSM ftpReadTransferDone
static

Definition at line 233 of file FtpGateway.cc.

FTPSM ftpReadType
static

Definition at line 206 of file FtpGateway.cc.

FTPSM ftpReadUser
static

Definition at line 202 of file FtpGateway.cc.

FTPSM ftpReadWelcome
static

Definition at line 200 of file FtpGateway.cc.

FTPSM ftpRestOrList
static

Definition at line 225 of file FtpGateway.cc.

Referenced by Ftp::Gateway::dataChannelConnected(), ftpReadEPRT(), and ftpReadPORT().

FTPSM ftpSendCwd
static

Definition at line 223 of file FtpGateway.cc.

Referenced by ftpReadMkdir(), ftpReadRetr(), and ftpTraverseDirectory().

FTPSM ftpSendList
static

Definition at line 226 of file FtpGateway.cc.

Referenced by ftpRestOrList().

FTPSM ftpSendMdtm
static

Definition at line 207 of file FtpGateway.cc.

Referenced by ftpGetFile().

FTPSM ftpSendMkdir
static

Definition at line 238 of file FtpGateway.cc.

Referenced by ftpReadCwd(), and ftpRestOrList().

FTPSM ftpSendNlst
static

Definition at line 227 of file FtpGateway.cc.

Referenced by ftpReadList(), and ftpRestOrList().

FTPSM ftpSendPass
static

Definition at line 203 of file FtpGateway.cc.

Referenced by ftpReadUser().

FTPSM ftpSendPassive
static
FTPSM ftpSendPORT
static

Definition at line 215 of file FtpGateway.cc.

Referenced by ftpReadEPRT().

FTPSM ftpSendQuit
static
FTPSM ftpSendReply
static

Definition at line 237 of file FtpGateway.cc.

Referenced by ftpReadMkdir(), ftpSendStor(), and ftpWriteTransferDone().

FTPSM ftpSendRest
static

Definition at line 229 of file FtpGateway.cc.

Referenced by ftpRestOrList().

FTPSM ftpSendRetr
static

Definition at line 231 of file FtpGateway.cc.

Referenced by ftpReadRest(), and ftpRestOrList().

FTPSM ftpSendSize
static

Definition at line 209 of file FtpGateway.cc.

Referenced by ftpReadMdtm().

FTPSM ftpSendStor
static

Definition at line 234 of file FtpGateway.cc.

Referenced by ftpRestOrList().

FTPSM ftpSendType
static

Definition at line 205 of file FtpGateway.cc.

Referenced by ftpReadPass().

FTPSM ftpSendUser
static

Definition at line 201 of file FtpGateway.cc.

Referenced by ftpReadWelcome().

FTPSM ftpTraverseDirectory
static

Definition at line 220 of file FtpGateway.cc.

Referenced by ftpReadCwd(), and ftpReadType().

FTPSM ftpWriteTransferDone
static

Definition at line 236 of file FtpGateway.cc.

const char* Month[]
static
Initial value:
= {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}

Definition at line 500 of file FtpGateway.cc.

Referenced by is_month().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors