]> sjero.net Git - wget/blob - src/ftp.h
Updated config.guess, config.sub, install.sh.
[wget] / src / ftp.h
1 /* Declarations for FTP support.
2    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3    2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
5 This file is part of GNU Wget.
6
7 GNU Wget is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 GNU Wget is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Wget.  If not, see <http://www.gnu.org/licenses/>.
19
20 Additional permission under GNU GPL version 3 section 7
21
22 If you modify this program, or any covered work, by linking or
23 combining it with the OpenSSL project's OpenSSL library (or a
24 modified version of that library), containing parts covered by the
25 terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
26 grants you additional permission to convey the resulting work.
27 Corresponding Source for a non-source form of such a combination
28 shall include the source code for the parts of OpenSSL used as well
29 as that of the covered work.  */
30
31 #ifndef FTP_H
32 #define FTP_H
33
34 #include "host.h"
35
36 /* System types. */
37 enum stype
38 {
39   ST_UNIX,
40   ST_VMS,
41   ST_WINNT,
42   ST_MACOS,
43   ST_OS400,
44   ST_OTHER
45 };
46
47 extern char ftp_last_respline[];
48
49 uerr_t ftp_response (int, char **);
50 uerr_t ftp_login (int, const char *, const char *);
51 uerr_t ftp_port (int, int *);
52 uerr_t ftp_pasv (int, ip_address *, int *);
53 #ifdef ENABLE_IPV6
54 uerr_t ftp_lprt (int, int *);
55 uerr_t ftp_lpsv (int, ip_address *, int *);
56 uerr_t ftp_eprt (int, int *);
57 uerr_t ftp_epsv (int, ip_address *, int *);
58 #endif
59 uerr_t ftp_type (int, int);
60 uerr_t ftp_cwd (int, const char *);
61 uerr_t ftp_retr (int, const char *);
62 uerr_t ftp_rest (int, wgint);
63 uerr_t ftp_list (int, const char *, enum stype);
64 uerr_t ftp_syst (int, enum stype *);
65 uerr_t ftp_pwd (int, char **);
66 uerr_t ftp_size (int, const char *, wgint *);
67
68 #ifdef ENABLE_OPIE
69 const char *skey_response (int, const char *, const char *);
70 #endif
71
72 struct url;
73
74 /* File types.  */
75 enum ftype
76 {
77   FT_PLAINFILE,
78   FT_DIRECTORY,
79   FT_SYMLINK,
80   FT_UNKNOWN
81 };
82
83
84 /* Globbing (used by ftp_retrieve_glob).  */
85 enum
86 {
87   GLOB_GLOBALL, GLOB_GETALL, GLOB_GETONE
88 };
89
90 /* Information about one filename in a linked list.  */
91 struct fileinfo
92 {
93   enum ftype type;              /* file type */
94   char *name;                   /* file name */
95   wgint size;                   /* file size */
96   long tstamp;                  /* time-stamp */
97   int perms;                    /* file permissions */
98   char *linkto;                 /* link to which file points */
99   struct fileinfo *prev;        /* previous... */
100   struct fileinfo *next;        /* ...and next structure. */
101 };
102
103 /* Commands for FTP functions.  */
104 enum wget_ftp_command
105 {
106   DO_LOGIN      = 0x0001,       /* Connect and login to the server.  */
107   DO_CWD        = 0x0002,       /* Change current directory.  */
108   DO_RETR       = 0x0004,       /* Retrieve the file.  */
109   DO_LIST       = 0x0008,       /* Retrieve the directory list.  */
110   LEAVE_PENDING = 0x0010        /* Do not close the socket.  */
111 };
112
113 enum wget_ftp_fstatus
114 {
115   NOTHING       = 0x0000,       /* Nothing done yet.  */
116   ON_YOUR_OWN   = 0x0001,       /* The ftp_loop_internal sets the
117                                    defaults.  */
118   DONE_CWD      = 0x0002        /* The current working directory is
119                                    correct.  */
120 };
121
122 struct fileinfo *ftp_parse_ls (const char *, const enum stype);
123 uerr_t ftp_loop (struct url *, int *, struct url *, bool, bool);
124
125 uerr_t ftp_index (const char *, struct url *, struct fileinfo *);
126
127 char ftp_process_type (const char *);
128
129
130 #endif /* FTP_H */