1#ifndef __BFTPD_COMMANDS_H
2#define __BFTPD_COMMANDS_H
3
4#include <config.h>
5#include <stdio.h>
6#ifdef HAVE_SYS_TYPES_H
7  #include <sys/types.h>
8#endif
9#ifdef HAVE_NETINET_IN_H
10  #include <netinet/in.h>
11#endif
12
13#include "commands_admin.h"
14
15enum {
16    STATE_CONNECTED, STATE_USER, STATE_AUTHENTICATED, STATE_RENAME, STATE_ADMIN
17};
18
19enum {
20    TYPE_ASCII, TYPE_BINARY
21};
22
23#define USERLEN 30
24#define USERLEN_S "30"
25#define MAXCMD 255
26
27extern int state;
28extern char user[USERLEN + 1];
29extern struct sockaddr_in sa;
30extern char pasv;
31extern int sock;
32extern int transferring;
33extern int pasvsock;
34extern char *philename;
35extern int offset;
36extern int ratio_send, ratio_recv;
37extern unsigned long bytes_stored, bytes_recvd;
38extern int xfer_bufsize;
39
40void control_printf(char success, char *format, ...);
41
42void init_userinfo();
43void new_umask();
44int parsecmd(char *);
45int dataconn();
46void command_user(char *);
47void command_pass(char *);
48void command_pwd(char *);
49void command_type(char *);
50void command_port(char *);
51void command_stor(char *);
52void command_mget(char *);
53void command_mput(char *);
54void command_retr(char *);
55void command_list(char *);
56void command_syst(char *);
57void command_cwd(char *);
58void command_cdup(char *);
59void command_dele(char *);
60void command_mkd(char *);
61void command_rmd(char *);
62void command_noop(char *);
63void command_rnfr(char *);
64void command_rnto(char *);
65void command_rest(char *);
66void command_abor(char *);
67void command_quit(char *);
68void command_help(char *);
69void command_stat(char *);
70void command_feat(char *);
71
72struct command {
73  char *name;
74  char *syntax;
75  void (*function)(char *);
76  char state_needed;
77  char showinfeat;
78};
79
80/* File the size of the transfer buffer, divided by number of connetions */
81int get_buffer_size(int num_connections);
82
83/* Function which forks and runs a script. Returns TRUE on success
84and FALSE on failure. */
85int run_script(char *script, char *path);
86
87#endif
88
89