/* conn.h: BetaFTPD connection class Copyright (C) 1999-2000 Steinar H. Gunderson, 2001 Dan Kegel This program is is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 if the License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef CONN_H #define CONN_H 1 class FtpServer; /* FIXME: these should be methods */ #if WANT_MESSAGE void dump_file(struct conn * const c, const int num, const char * const filename); void list_readmes(struct conn * const c); #endif /* doubly linked list of active connections */ class conn : public Poller::Client, public list_element { public: /* Public Methods */ conn *init(FtpServer *container, const int sock); void shutdown(); void numeric(const int numeric, const char * const format, ...); virtual int notifyPollEvent(Poller::PollEvent *e); /* Public Data Members */ /* FIXME: all should be private */ #define c_prev_conn prev #define c_next_conn next struct ftran *c_transfer; time_t c_last_transfer; int c_rest_pos; private: /* Private Data Members */ int c_sock; #if WANT_STAT struct sockaddr c_addr; #endif char c_recv_buf[256]; #if WANT_FULLSCREEN char c_last_cmd[256]; #endif char c_rename_from[256]; int c_buf_len; int c_auth; char c_username[17]; uid_t c_uid; char c_root_dir[256]; char c_curr_dir[256]; #if WANT_ASCII int c_ascii_mode; #endif static const struct handler handler_table[]; /* Private methods */ void parse_command(); int do_chdir(const char * const newd); char *do_pwd(char * const retbuf, const char * const dir); void do_store(const int append); void cmd_cwd_internal(const char * const newd); char *translate_path(char * const path); int do_openfile(char * const path, char * const filename, const int flags #if WANT_NONROOT , const int check_permission #endif ); int prepare_for_listing(char ** const ptr, struct list_options * const lo); void do_listing(struct list_options * const lo); int get_num_files(const char * const path, struct list_options * const lo); int list_core(const char * const pathname, char * const disp_pathname, struct list_options * const lo #if HAVE_MMAP , const int size, int pos #endif ); void remove_bytes(const int i); int cmd_user(void); int cmd_pass(void); int cmd_acct(void); int cmd_port(void); int cmd_pasv(void); int cmd_pwd(void); int cmd_cwd(void); int cmd_cdup(void); int cmd_rest(void); int cmd_retr(void); int cmd_size(void); int cmd_mdtm(void); int cmd_abor(void); int cmd_dele(void); int cmd_rnfr(void); int cmd_rnto(void); int cmd_mkd(void); int cmd_rmd(void); int cmd_allo(void); int cmd_stat(void); int cmd_list(void); int cmd_nlst(void); int cmd_syst(void); int cmd_noop(void); int cmd_type(void); int cmd_mode(void); int cmd_stru(void); int cmd_help(void); int cmd_quit(void); int cmd_rein(void); #if WANT_UPLOAD int cmd_stor(void); int cmd_appe(void); #endif #if DOING_PROFILING int cmd_exit(void); #endif }; #endif