1 /*
2  * wzdftpd - a modular and cool ftp server
3  * Copyright (C) 2002-2004  Pierre Chifflier
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  *
19  * As a special exemption, Pierre Chifflier
20  * and other respective copyright holders give permission to link this program
21  * with OpenSSL, and distribute the resulting executable, without including
22  * the source code for OpenSSL in the source distribution.
23  */
24 
25 #ifndef __WZD_ACTION__
26 #define __WZD_ACTION__
27 
28 /** \file wzd_action.h
29  * \brief Store last action from client
30  *
31  * \addtogroup libwzd_core
32  * @{
33  */
34 
35 typedef enum {
36   TOK_UNKNOWN=0,
37   TOK_HELP,
38   TOK_USER,
39   TOK_PASS,
40   TOK_AUTH,
41   TOK_QUIT,
42   TOK_TYPE,
43   TOK_MODE,
44   TOK_PORT,
45   TOK_PASV,
46   TOK_PWD,
47   TOK_NOOP,
48   TOK_SYST,
49   TOK_CWD,
50   TOK_CDUP,
51   TOK_LIST,
52   TOK_NLST,
53   TOK_STAT,
54   TOK_MKD,
55   TOK_RMD,
56   TOK_RETR,
57   TOK_STOR,
58   TOK_REST,
59   TOK_MDTM,
60   TOK_SIZE,
61   TOK_DELE,
62   TOK_ABOR,
63 
64   TOK_PBSZ,
65   TOK_PROT,
66   TOK_CPSV,
67   TOK_SSCN,
68 
69   TOK_ADAT,
70   TOK_MIC,
71 
72   TOK_SITE,
73   TOK_FEAT,
74   TOK_ALLO,
75   TOK_RNFR,
76   TOK_RNTO,
77   TOK_APPE,
78 
79   TOK_EPSV,
80   TOK_EPRT,
81   TOK_PRET,
82 
83   TOK_XCRC,
84   TOK_XMD5,
85 
86   TOK_OPTS,
87 
88   TOK_MLST,
89   TOK_MLSD,
90 
91   TOK_MODA,
92 
93   TOK_IDNT,
94 
95   TOK_SITE_ADDIP=64,
96   TOK_SITE_ADDUSER,
97   TOK_SITE_BACKEND,
98   TOK_SITE_CHACL,
99   TOK_SITE_CHANGE,
100   TOK_SITE_CHANGEGRP,
101   TOK_SITE_CHECKPERM,
102   TOK_SITE_CHGRP,
103   TOK_SITE_CHMOD,
104   TOK_SITE_CHOWN,
105   TOK_SITE_CHPASS,
106   TOK_SITE_CHRATIO,
107   TOK_SITE_CLOSE,
108   TOK_SITE_COLOR,
109   TOK_SITE_DELIP,
110   TOK_SITE_DELUSER,
111   TOK_SITE_FLAGS,
112   TOK_SITE_FREE,
113   TOK_SITE_GINFO,
114   TOK_SITE_GIVE,
115   TOK_SITE_GROUP,
116   TOK_SITE_GROUPS,
117   TOK_SITE_GRPADD,
118   TOK_SITE_GRPADDIP,
119   TOK_SITE_GRPCHANGE,
120   TOK_SITE_GRPDEL,
121   TOK_SITE_GRPDELIP,
122   TOK_SITE_GRPKILL,
123   TOK_SITE_GRPRATIO,
124   TOK_SITE_GRPREN,
125   TOK_SITE_GSINFO,
126   TOK_SITE_HELP,
127   TOK_SITE_IDLE,
128   TOK_SITE_INVITE,
129   TOK_SITE_KICK,
130   TOK_SITE_KILL,
131   TOK_SITE_KILLPATH,
132   TOK_SITE_LINK,
133   TOK_SITE_MSG,
134   TOK_SITE_PERM,
135   TOK_SITE_PURGE,
136   TOK_SITE_READD,
137   TOK_SITE_RELOAD,
138   TOK_SITE_REOPEN,
139   TOK_SITE_RUSAGE,
140   TOK_SITE_SAVECFG,
141   TOK_SITE_SECTIONS,
142   TOK_SITE_SHOWLOG,
143   TOK_SITE_SHUTDOWN,
144   TOK_SITE_SWHO,
145   TOK_SITE_SU,
146   TOK_SITE_TAGLINE,
147   TOK_SITE_TAKE,
148   TOK_SITE_TEST,
149   TOK_SITE_UNLOCK,
150   TOK_SITE_UPTIME,
151   TOK_SITE_USER,
152   TOK_SITE_USERS,
153   TOK_SITE_UTIME,
154   TOK_SITE_VARS,
155   TOK_SITE_VARS_GROUP,
156   TOK_SITE_VARS_USER,
157   TOK_SITE_VERSION,
158   TOK_SITE_VFSLS,
159   TOK_SITE_VFSADD,
160   TOK_SITE_VFSDEL,
161   TOK_SITE_WHO,
162   TOK_SITE_WIPE,
163 
164   TOK_CUSTOM,
165 
166   TOK_NOTHING=256,
167 } wzd_token_t;
168 
169 
170 struct last_file_t {
171     char	name[WZD_MAX_PATH];
172     time_t	time;
173     struct timeval tv;
174     u64_t	size;
175     u32_t crc;
176     unsigned int token;
177 };
178 
179 typedef struct wzd_action_t wzd_action_t;
180 
181 struct wzd_action_t {
182   unsigned int	token;
183   wzd_string_t  * command;
184   char		arg[HARD_LAST_COMMAND_LENGTH];
185 
186   fd_t		current_file;
187   u64_t	bytesnow;
188 
189   time_t	tm_start;
190   struct timeval tv_start;
191 };
192 
193 void set_action(wzd_context_t * context, const char *command);
194 
195 /** @} */
196 
197 #endif /* __WZD_ACTION__ */
198 
199