11#ifndef SQUID_SRC_SERVERS_FTPSERVER_H
12#define SQUID_SRC_SERVERS_FTPSERVER_H
111 void start()
override;
141 void setReply(
const int code,
const char *msg);
#define RefCountable
The locking interface for use on Reference-Counted classes.
virtual const char * status() const
internal cleanup; do not call directly
Transaction information shared among our FTP client and server jobs.
int userDataDone
Squid will send or has sent this final status code to the FTP client.
SBuf workingDir
estimated current working directory for URI formation
ServerState serverState
what our FTP server is doing
Ip::Address clientDataAddr
address of our FTP client data connection
RefCount< MasterState > Pointer
Manages a control connection from an FTP client.
void writeCustomReply(const int code, const char *msg, const HttpReply *reply=nullptr)
void handleDataReply(const HttpReply *header, StoreIOBuffer receivedData)
bool gotEpsvAll
restrict data conn setup commands to just EPSV
void calcUri(const SBuf *file)
computes uri member from host and, if tracked, working dir with file name
AsyncCall::Pointer reader
set when we are reading FTP data
bool handlePasvRequest(String &cmd, String ¶ms)
bool handleDataRequest(String &cmd, String ¶ms)
bool originDataDownloadAbortedOnError
whether the origin data transfer aborted
bool handleUploadRequest(String &cmd, String ¶ms)
void writeForwardedReply(const HttpReply *reply)
void userDataCompletionCheckpoint(int finalStatusCode)
void connectedForData(const CommConnectCbParams ¶ms)
Done establishing a data connection to the user.
bool handleCdupRequest(String &cmd, String ¶ms)
void writeForwardedForeign(const HttpReply *reply)
static void AcceptCtrlConnection(const CommAcceptCbParams ¶ms)
accept a new FTP control connection and hand it to a dedicated Server
void maybeReadUploadData()
schedules another data connection read if needed
void handleEprtReply(const HttpReply *header, StoreIOBuffer receivedData)
void changeState(const Ftp::ServerState newState, const char *reason)
void wroteReply(const CommIoCbParams &io)
void handlePasvReply(const HttpReply *header, StoreIOBuffer receivedData)
Http::Stream * earlyError(const EarlyErrorKind eek)
creates a context filled with an error message for a given early error
void callException(const std::exception &e) override
called when the job throws during an async call
void completeDataDownload()
void handleFeatReply(const HttpReply *header, StoreIOBuffer receivedData)
bool handlePortRequest(String &cmd, String ¶ms)
size_t uploadAvailSize
number of yet unused uploadBuf bytes
void acceptDataConnection(const CommAcceptCbParams ¶ms)
bool handleFeatRequest(String &cmd, String ¶ms)
void writeErrorReply(const HttpReply *reply, const int status)
writes FTP error response with given status and reply-derived error details
void startWaitingForOrigin()
friend void StartListening()
accept connections on all configured ftp_ports
SBuf host
intended dest. of a transparently intercepted FTP conn
void writeReply(MemBuf &mb)
void resetLogin(const char *reason)
clear client and server login-related state after the old login is gone
void processParsedRequest(Http::StreamPointer &context) override
start processing a freshly parsed request
void noteBodyConsumerAborted(BodyPipe::Pointer ptr) override
void wroteReplyData(const CommIoCbParams &io)
called when we are done writing a chunk of the response data
JobWait< Comm::ConnOpener > dataConnWait
time_t idleTimeout() const override
timeout to use when waiting for the next request
void clientPinnedConnectionClosed(const CommCloseCbParams &io) override
Our close handler called by Comm when the pinned connection is closed.
bool writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call) override
handle a control message received by context from a peer and call back
AsyncCall::Pointer listener
set when we are passively listening
void(Ftp::Server::* ReplyHandler)(const HttpReply *reply, StoreIOBuffer data)
a method handling an FTP response; selected by handleReply()
void start() override
called by AsyncStart; do not call directly
void handlePortReply(const HttpReply *header, StoreIOBuffer receivedData)
void handleErrorReply(const HttpReply *header, StoreIOBuffer receivedData)
void notePeerConnection(Comm::ConnectionPointer conn) override
called just before a FwdState-dispatched job starts using connection
Http::Stream * parseOneRequest() override
char uploadBuf[CLIENT_REQ_BUF_SZ]
data connection input buffer
void handleReply(HttpReply *header, StoreIOBuffer receivedData) override
bool createDataConnection(Ip::Address cltAddr)
[Re]initializes dataConn for active data transfers. Does not connect.
bool handleEpsvRequest(String &cmd, String ¶ms)
void setReply(const int code, const char *msg)
bool(Ftp::Server::* RequestHandler)(String &cmd, String ¶ms)
a method handling an FTP command; selected by handleRequest()
void replyDataWritingCheckpoint()
ClientStream checks after (actual or skipped) reply data writing.
bool handlePassRequest(String &cmd, String ¶ms)
void handleEpsvReply(const HttpReply *header, StoreIOBuffer receivedData)
void wroteEarlyReply(const CommIoCbParams &io)
Http::Stream * handleUserRequest(const SBuf &cmd, SBuf ¶ms)
SBuf uri
a URI reconstructed from various FTP message details
void handleUploadReply(const HttpReply *header, StoreIOBuffer receivedData)
AsyncCall::Pointer onDataAcceptCall
who to call upon data conn acceptance
bool handleRequest(HttpRequest *)
void noteMoreBodySpaceAvailable(BodyPipe::Pointer) override
HttpReply::Pointer delayedReply
a response which writing was postponed until stopWaitingForOrigin()
void stopWaitingForOrigin(int status)
void shovelUploadData()
shovel upload data from the internal buffer to the body pipe if possible
unsigned int listenForDataConnection()
void writeForwardedReplyAndCall(const HttpReply *reply, AsyncCall::Pointer &call)
int pipelinePrefetchMax() const override
returning N allows a pipeline of 1+N requests (see pipeline_prefetch)
bool checkDataConnPost() const
Check that client data connection is ready for immediate I/O.
void doProcessRequest()
react to the freshly parsed request
Comm::ConnectionPointer dataListenConn
data connection listening socket
void readUploadData(const CommIoCbParams &io)
imports more upload data from the data connection
Comm::ConnectionPointer dataConn
data connection
bool handleCwdRequest(String &cmd, String ¶ms)
bool handleEprtRequest(String &cmd, String ¶ms)
void writeEarlyReply(const int code, const char *msg)
MasterState::Pointer master
info shared among our FTP client and server jobs
bool waitingForOrigin
whether we wait for the origin data transfer to end
void closeDataConnection()
#define CLIENT_REQ_BUF_SZ