⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 warsvrprotocolftpmsgs.cpp

📁 ftpserver very good sample
💻 CPP
字号:
#include "StdAfx.h"#include "WarSvrProtocolFtpMsgs.h"   // class implementedusing namespace std;/////////////////////////////// PUBLIC ///////////////////////////////////////// NB: If you want to modify the server messages, do not// modify here - make a textfile with your messages, as// described in the documentationstatic const war_ccstr_t Msgs[WarSvrProtocolFtpEnums::INVALID +1] ={    {"[$systemname]\r\n[$programname] [$programversion] ([$builddate]) Ready\r\n[$prgcopyright]\r\n[sysmsg0.txt]Please enter your user name."},    {"[$systemname] ready"}, // SM_WELCOME_STELTH    {"The command failed."}, // SM_GENERIC_FAIL    {"Idle time ([$idletimelm] seconds) expiered. Goodbye."}, // SM_IDLE_TIMEOUT    {"Control connection closed. [$explainerr] Goodbye."}, // SM_CTRLC_CLOSED_ERR    {"Nice try moron. Bye!"}, // SM_HACKER_BUFFER_ATTACK    {"Silly you! Please enter a command."}, // SM_ERR_EMPTY_CMD    {"This command is not valid in the current state. Use ABOR to abort the current operation."}, // SM_USE_ABOR    {"User name okay; need password."}, // SM_NEED_PASSWD    {"Anonymous access is allowed. Please enter your full Email address as password."}, //SM_NEED_EMAIL    {"Server error. Closing connection."}, // SM_ERR_BYE    {"I dont know you - and my mum woun't let me play with strangers. Bye."}, // SM_DONT_KNOW_YOU    {"You are not allowed to login at this time of day. [sysmsg12.txt]Goodbye"}, // SM_RIGHT_PLACE_WRONG_TIME    {"Your IP address is not welcome here. [sysmsg11.txt]Goodbye"}, // SM_BAD_IP    {"Hey, moron - hackers are not welcome here. [sysmsg10.txt]Goodbye"}, // SM_HACKERS_NOT_WELCOME    {"Too many unsuccessful login attempts. Goodbye."}, // SM_TOO_MANY_FAILED_LOGINS    {"Too many connections on this account. [sysmsg6.txt]Goodbye"}, // SM_TMC_ACCOUNT    {"This server has reached the limit of allowed connections. Please try again later."}, // SM_TMC_TOTAL    {"Too many connections from your IP address. [sysmsg13.txt]Goodbye"}, // SM_TMC_IP    {"The system is shutting down. [sysmsg3.txt]Goodbye"}, // SM_SHUTTING_DOWN    {"Anonymous access not allowed. [sysmsg5.txt]Goodbye"}, // SM_ANON_DENIED    {"Password not accepted."}, // SM_PASSWD_NOT_ACCEPTED    {"[$greeting][sysmsg1.txt][$dirmsg]User [$user] logged in."}, // SM_LOGGED_IN    {"Alredy logged in."}, // SM_ALREADY_LOGGED_ON    {"Bad sequence of commands."}, // SM_BAD_SEQ_OF_CMDS    {"Missing parameter in command: [$currentcmd]"}, // SM_MISSING_PARAMETER_IN_CMD    {"[$currentcmd]: Syntax error, command not recognized."}, // SM_UNKNOWN_CMD    {"[$currentcmd]: The specified parameter/option is not supported"}, // SM_PARAMETER_NOT_SUPPORTED    {"Please login with USER and PASS."}, // SM_BAD_LEVEL    {"[$currentcmd]: command not understood."}, // SM_UNKNOWN_PARAMETER    {"[$currentcmd]: command not implemented."}, // SM_CMD_NOT_IMPLEMENTERD    {"Goodbye. Control connection closed. [sysmsg2.txt]"}, // SM_GOODBYE_QUIT    {"ACCT Command ok."}, // SM_ACCT_OK    {"Service ready for new user. Please enter your user."}, // SM_REIN_OK    {"The PORT command is disabled. Use the PASV command."}, // SM_PORT_DISABLED    {"PORT command successful."}, // SM_PORT_OK    {"The PASV command is disabled. Use the PORT command."}, // SM_PASV_DISABLED    {"PASV command rejected. A passive connection is already pending."}, // SM_PASV_FLOOD    {"Entering Passive Mode"}, // SM_PASV_OK    {"Type set to A (ASCII)."}, // SM_TYPE_A    {"Type set to I (Binary)."}, // SM_TYPE_I    {"Type set to L (byte size 8)."}, // SM_TYPE_L8    {"EBCDIC not supported."}, // SM_TYPE_E    {"STRU F ok."}, // SM_STRU_OK    {"MODE S ok."}, // SM_MODE_S    {"No such file or access denied."}, // SM_NO_FILE_OR_N0_ACCESS    {"Access denied. The file or directory already exist."}, // SM_NAME_EXIST_DENIED_ACCESS    {"The path is a directory."}, // SM_THE_PATH_IS_A_DIR    {"Not a regular file."}, // SM_NOT_A_REGULAR_FILE    {"The file is too long for ASCII mode. Use IMAGE (binary) mode."}, // SM_THE_FILE_IS_TOO_LARGE_FOR_ASCII    {"Access denied."}, // SM_ACCESS_DENIED    {"Restarting at byte offset [$rest]. Send STORE or RETRIEVE to initiate transfer."}, // SM_REST_OK    {"ABOR ok. No transfer in progress."}, // SM_ABOR_OK_NO_TRANS    {"Could not change directory."}, // SM_CWD_FAIL    {"[$dirmsg]\"[$pwd,\"]\" is current directory."}, // SM_CWD_OK    {"No such directory or access denied."}, // SM_LIST_FAIL    {"Ok. I ain't doing nothing anyway..."}, // SM_NOOP_OK    {"Yea, Right!"}, // SM_NOOP_OK_NORESET    {"\"[$pwd,\"]\" is current directory."}, // SM_PWD_OK    {"[$isoname] Type: L8 Server: \"[$programname] [$programversion]\" OS: \"[$osname]\""}, // SM_SYST_OK_IDLE    {"[$isoname] Type: L8"}, // SM_SYST_OK_IDLE_STELTH    {"The server is shutting down."}, //SM_SERVER_SHUTTING_DOWN    {"Ready to send [$currentfilename] [$currentfilelen,bytes ]using [$currenttype] mode data connection."}, //SM_STARTING_RETR    {"Ready to receive: [$currentfilename]"}, // SM_STARTING_STOU    {"Ready to receive [$currentfilename] using [$currenttype] mode data connection."}, //SM_STARTING_RETR    {"Transfer complete. [$currenttransbytes] bytes in [$currenttranstime] sec. ([$currenttransrate,m] megabytes/sec)[sysmsg9.txt]"}, // SM_TRANSFER_DONE_OK    {"Transfer failed."}, // SM_TRANSFER_FAILED    {"Command not allowed during transfer. Use ABOR to abort."}, // SM_CMD_NOT_ALLOWED_DURING_XMIT    {"The operation failed due to a server configuration error."}, // SM_SERVER_CONFIGURATION_ERROR    {"Invalid path!"}, // SM_ILLEGAL_PATH    {"Recursive directory-listings are not allowed."}, // SM_RECURSIVE_LISTINGS_FORBIDDEN    {"[$currentcmd]: This command has been disabled at this site."}, // SM_COMMAND_FORBIDDEN    {"Restart of files in ACSII mode has been disabled at this site. Please use binary mode."}, // SM_NO_ASCII_RESTART    {"Restart marker/value is out of range."}, // SM_RESTART_OUT_OF_RANGE    {"The following commands are recognized (* =>'s unimplemented).\n[$helpcmds]Direct comments to [$email]"}, // SM_HELP_ALL    {"The requested storage space is available."}, // SM_ALLO_OK    {"The requested storage space is NOT available."}, // SM_ALLO_FAIL    {"The ALLO command does not support the optional argument in this implementation."}, // SM_ALLO_NOT_IMPLEMENTED_PARAM    {"The path exist and can be renamed. Please give the RNTO command."}, // SM_RNFR_OK    {"Bad sequence of commands."}, // SM_BAD_SEQUENCE_OF_COMMANDS    {"The source and the destination are not on the same device."}, // SM_RNTO_NOT_SAME_DEVICE    {"The file or directory was successfully renamed."}, // SM_RNTO_OK    {"The destination path already exist."}, // SM_DESTINATION_EXIST    {"File transfer aborted by user."}, // SM_ABOR_INTERRUPTED    {"The ABOR command was successful."}, // SM_ABOR_OK    {"The file was deleted."}, // SM_DELETE_OK    {"Could not delete the file."}, // SM_DELE_FAILED    {"The specified path is a directory. Use RMD to delete."}, // SM_DELE_FAILED_IS_DIR    {"The directory was deleted."}, // SM_RMD_OK    {"Failed to delete directory."}, // SM_RMD_FAILED    {"The specified path is not a directory. Try to use DELE to delete."}, // SM_RMD_FAILED_IS_FILE    {"\"[$currentpath,\"]\" The directory was created"}, // SM_MKD_OK    {"Could not create the directory."}, // SM_MKD_FAILED    {"Could not create the directory. The path already exists."}, // SM_MKD_FAILED_PATH_EXIST    {"[$hostdomainname] FTP server status:\n"    "Version [$programname] [$programversion] [$builddate]\n"    "Connected to [$remotedomainname] ([$remoteaddress])\n"    "Logged in as [$user]\n"    "TYPE: [$currenttype], FORM: [$currentform]; STRUcture: [$currentstructure]; transfer MODE: [$currentmode]\n"    "[$dataconn,No data connection,Data connection established]\n"    "[$rcvbytes] data bytes received in [$rcvfiles] files\n"    "[$sndbytes] data bytes transmitted in [$sndfiles] files\n"    "[$numbytes] data bytes total in [$numfiles] files\n"    "[$trafficinbytes] traffic bytes received in [$rcvtransfers] transfers\n"    "[$trafficoutbytes] traffic bytes transmitted in [$sndtransfers] transfers\n"    "[$trafficnumbytes] traffic bytes total in [$numtransfers] transfers\n"    "End of status"}, // SM_STATUS_IDLE    {"[$hostdomainname] FTP server status:\n"    "Connected to [$remotedomainname] ([$remoteaddress])\n"    "Logged in as [$user]\n"    "TYPE: [$currenttype], FORM: [$currentform]; STRUcture: [$currentstructure]; transfer MODE: [$currentmode]\n"    "[$dataconn,No data connection,The data connection is established]\n"    "[$rcvbytes] data bytes received in [$rcvfiles] files\n"    "[$sndbytes] data bytes transmitted in [$sndfiles] files\n"    "[$numbytes] data bytes total in [$numfiles] files\n"    "[$trafficinbytes] traffic bytes received in [$rcvtransfers] transfers\n"    "[$trafficoutbytes] traffic bytes transmitted in [$sndtransfers] transfers\n"    "[$trafficnumbytes] traffic bytes total in [$numtransfers] transfers\n"    "End of status"}, // SM_STATUS_IDLE_STELTH    {"The path is a file"}, // SM_STATUS_WITH_ARGUMENT_IS_FILE    {"The path is a directory"}, // SM_STATUS_WITH_ARGUMENT_IS_DIR    {"The path is a link or special file. No appropriate reply code."}, // SM_STATUS_WITH_ARGUMENT_FAILED_TYPE    {"The path could not be found."}, // SM_STATUS_WITH_ARGUMENT_FAILED_VOID    {"Transfer is progress"}, // SM_STATUS_TRANSFER#if WAR_RFC2389    {"Extensions supported:[$features]\nEND"}, // SM_FEAT_OK    {"Option accepted."}, // SM_OPTS_OK    {"Option failed."}, // SM_OPTS_FAILED#endif#if WAR_RFC2577    {"Restricted port. A security notice is written to the logfile."}, // SM_PORT_RESTRICTED    {"Invalid IP address."}, // SM_INVALID_IP_ADDRESS    {"This server does not allow server to server (proxy) transfers."}, //SM_NO_FTP_PROXY#endif    {""}};static const war_ccstr_t MacroNames[WarSvrProtocolFtpEnums::INVALID +1] ={    {"SM_WELCOME"},    {"SM_WELCOME_STELTH"},    {"SM_GENERIC_FAIL"},    {"SM_IDLE_TIMEOUT"},    {"SM_CTRLC_CLOSED_ERR"},    {"SM_HACKER_BUFFER_ATTACK"},    {"SM_ERR_EMPTY_CMD"},    {"SM_USE_ABOR"},    {"SM_NEED_PASSWD"},    {"SM_NEED_EMAIL"},    {"SM_ERR_BYE"},    {"SM_DONT_KNOW_YOU"},    {"SM_RIGHT_PLACE_WRONG_TIME"},    {"SM_BAD_IP"},    {"SM_HACKERS_NOT_WELCOME"},    {"SM_TOO_MANY_FAILED_LOGINS"},    {"SM_TMC_ACCOUNT"},    {"SM_TMC_TOTAL"},    {"SM_TMC_IP"},    {"SM_SHUTTING_DOWN"},    {"SM_ANON_DENIED"},    {"SM_PASSWD_NOT_ACCEPTED"},    {"SM_LOGGED_IN"},    {"SM_ALREADY_LOGGED_ON"},    {"SM_BAD_SEQ_OF_CMDS"},    {"SM_MISSING_PARAMETER_IN_CMD"},    {"SM_UNKNOWN_CMD"},    {"SM_PARAMETER_NOT_SUPPORTED"},    {"SM_BAD_LEVEL"},    {"SM_UNKNOWN_PARAMETER"},    {"SM_CMD_NOT_IMPLEMENTERD"},    {"SM_GOODBYE_QUIT"},    {"SM_ACCT_OK"},    {"SM_REIN_OK"},    {"SM_PORT_DISABLED"},    {"SM_PORT_OK"},    {"SM_PASV_DISABLED"},    {"SM_PASV_FLOOD"},    {"SM_TYPE_A"},    {"SM_TYPE_I"},    {"SM_TYPE_L8"},    {"SM_TYPE_E"},    {"SM_STRU_OK"},    {"SM_MODE_S"},    {"SM_NO_FILE_OR_N0_ACCESS"},    {"SM_NAME_EXIST_DENIED_ACCESS"},    {"SM_THE_PATH_IS_A_DIR"},    {"SM_NOT_A_REGULAR_FILE"},    {"SM_THE_FILE_IS_TOO_LARGE_FOR_ASCII"},    {"SM_ACCESS_DENIED"},    {"SM_REST_OK"},    {"SM_ABOR_OK_NO_TRANS"},    {"SM_CWD_FAIL"},    {"SM_CWD_OK"},    {"SM_LIST_FAIL"},    {"SM_NOOP_OK"},    {"SM_NOOP_OK_NORESET"},    {"SM_PWD_OK"},    {"SM_SYST_OK_IDLE"},    {"SM_SYST_OK_IDLE_STELTH"},    {"SM_SERVER_SHUTTING_DOWN"},    {"SM_STARTING_RETR"},    {"SM_STARTING_STOU"},    {"SM_STARTING_SEND"},    {"SM_TRANSFER_DONE_OK"},    {"SM_TRANSFER_FAILED"},    {"SM_CMD_NOT_ALLOWED_DURING_XMIT"},    {"SM_SERVER_CONFIGURATION_ERROR"},    {"SM_ILLEGAL_PATH"},    {"SM_RECURSIVE_LISTINGS_FORBIDDEN"},    {"SM_COMMAND_FORBIDDEN"},    {"SM_NO_ASCII_RESTART"},    {"SM_RESTART_OUT_OF_RANGE"},    {"SM_HELP_ALL"},    {"SM_ALLO_OK"},    {"SM_ALLO_FAIL"},    {"SM_ALLO_NOT_IMPLEMENTED_PARAM"},    {"SM_RNFR_OK"},    {"SM_BAD_SEQUENCE_OF_COMMANDS"},    {"SM_RNTO_NOT_SAME_DEVICE"},    {"SM_RNTO_OK"},    {"SM_DESTINATION_EXIST"},    {"SM_ABOR_INTERRUPTED"},    {"SM_ABOR_OK"},    {"SM_DELETE_OK"},    {"SM_DELE_FAILED"},    {"SM_DELE_FAILED_IS_DIR"},    {"SM_RMD_OK"},    {"SM_RMD_FAILED"},    {"SM_RMD_FAILED_IS_FILE"},    {"SM_MKD_OK"},    {"SM_MKD_FAILED"},    {"SM_MKD_FAILED_PATH_EXIST"},    {"SM_STATUS_IDLE"},    {"SM_STATUS_IDLE_STELTH"},    {"SM_STATUS_WITH_ARGUMENT_IS_FILE"},    {"SM_STATUS_WITH_ARGUMENT_IS_DIR"},    {"SM_STATUS_WITH_ARGUMENT_FAILED_TYPE"},    {"SM_STATUS_WITH_ARGUMENT_FAILED_VOID"},    {"SM_STATUS_TRANSFER"},#if WAR_RFC2389    {"SM_FEAT_OK"},    {"SM_OPTS_OK"},    {"SM_OPTS_FAILED"},#endif#if WAR_RFC2577    {"SM_PORT_RESTRICTED"},    {"SM_INVALID_IP_ADDRESS"},    {"SM_NO_FTP_PROXY"},#endif    {"INVALID"}};const war_ccstr_t *WarSvrProtocolMsgs<WarSvrProtocolFtpEnums::FtpSvrMsgsE>::msDefMsg = Msgs;const war_ccstr_t *WarSvrProtocolMsgs<WarSvrProtocolFtpEnums::FtpSvrMsgsE>::msMacroName = MacroNames;const size_t WarSvrProtocolMsgs<WarSvrProtocolFtpEnums::FtpSvrMsgsE>::mArraySize = WarSvrProtocolFtpEnums::INVALID;//============================= LIFECYCLE ====================================//============================= OPERATORS ====================================//============================= OPERATIONS ===================================//============================= ACCESS     ===================================//============================= INQUIRY    ===================================/////////////////////////////// PROTECTED  ////////////////////////////////////////////////////////////////// PRIVATE    ///////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -