Merge from vendor branch TCPDUMP:
[dragonfly.git] / lib / libftpio / ftpio.h
1 #ifndef _FTP_H_INCLUDE
2 #define _FTP_H_INCLUDE
3
4 #include <sys/types.h>
5 #include <sys/cdefs.h>
6 #include <stdio.h>
7 #include <time.h>
8
9 /*
10  * ----------------------------------------------------------------------------
11  * "THE BEER-WARE LICENSE" (Revision 42):
12  * <phk@login.dknet.dk> wrote this file.  As long as you retain this notice you
13  * can do whatever you want with this stuff. If we meet some day, and you think
14  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
15  * ----------------------------------------------------------------------------
16  *
17  * Major Changelog:
18  *
19  * Jordan K. Hubbard
20  * 17 Jan 1996
21  *
22  * Turned inside out. Now returns xfers as new file ids, not as a special
23  * `state' of FTP_t
24  *
25  * $FreeBSD: src/lib/libftpio/ftpio.h,v 1.15.2.1 2000/07/15 07:24:03 kris Exp $
26  * $DragonFly: src/lib/libftpio/ftpio.h,v 1.2 2003/06/17 04:26:49 dillon Exp $
27  */
28
29 /* Internal housekeeping data structure for FTP sessions */
30 typedef struct {
31     enum { init, isopen, quit } con_state;
32     int         fd_ctrl;
33     int         addrtype;
34     char        *host;
35     char        *file;
36     int         error;
37     int         is_binary;
38     int         is_passive;
39     int         is_verbose;
40 } *FTP_t;
41
42 /* Structure we use to match FTP error codes with readable strings */
43 struct ftperr {
44   const int     num;
45   const char    *string;
46 };
47
48 __BEGIN_DECLS
49 extern struct   ftperr ftpErrList[];
50 extern int      const ftpErrListLength;
51
52 /* Exported routines - deal only with FILE* type */
53 extern FILE     *ftpLogin(char *host, char *user, char *passwd, int port, int verbose, int *retcode);
54 extern int      ftpChdir(FILE *fp, char *dir);
55 extern int      ftpErrno(FILE *fp);
56 extern off_t    ftpGetSize(FILE *fp, char *file);
57 extern FILE     *ftpGet(FILE *fp, char *file, off_t *seekto);
58 extern FILE     *ftpPut(FILE *fp, char *file);
59 extern int      ftpAscii(FILE *fp);
60 extern int      ftpBinary(FILE *fp);
61 extern int      ftpPassive(FILE *fp, int status);
62 extern void     ftpVerbose(FILE *fp, int status);
63 extern FILE     *ftpGetURL(char *url, char *user, char *passwd, int *retcode);
64 extern FILE     *ftpPutURL(char *url, char *user, char *passwd, int *retcode);
65 extern time_t   ftpGetModtime(FILE *fp, char *s);
66 extern const    char *ftpErrString(int error);
67 extern FILE     *ftpLoginAf(char *host, int af, char *user, char *passwd,       int port, int verbose, int *retcode);
68 extern FILE     *ftpGetURLAf(char *url, int af, char *user, char *passwd, int *retcode);
69 extern FILE     *ftpPutURLAf(char *url, int af, char *user, char *passwd, int *retcode);
70 __END_DECLS
71
72 #endif  /* _FTP_H_INCLUDE */