xref: /dragonfly/lib/libftpio/ftpio.h (revision 984263bc)
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  */
27 
28 /* Internal housekeeping data structure for FTP sessions */
29 typedef struct {
30     enum { init, isopen, quit } con_state;
31     int		fd_ctrl;
32     int		addrtype;
33     char	*host;
34     char	*file;
35     int		error;
36     int		is_binary;
37     int		is_passive;
38     int		is_verbose;
39 } *FTP_t;
40 
41 /* Structure we use to match FTP error codes with readable strings */
42 struct ftperr {
43   const int	num;
44   const char	*string;
45 };
46 
47 __BEGIN_DECLS
48 extern struct	ftperr ftpErrList[];
49 extern int	const ftpErrListLength;
50 
51 /* Exported routines - deal only with FILE* type */
52 extern FILE	*ftpLogin(char *host, char *user, char *passwd,	int port, int verbose, int *retcode);
53 extern int	ftpChdir(FILE *fp, char *dir);
54 extern int	ftpErrno(FILE *fp);
55 extern off_t	ftpGetSize(FILE *fp, char *file);
56 extern FILE	*ftpGet(FILE *fp, char *file, off_t *seekto);
57 extern FILE	*ftpPut(FILE *fp, char *file);
58 extern int	ftpAscii(FILE *fp);
59 extern int	ftpBinary(FILE *fp);
60 extern int	ftpPassive(FILE *fp, int status);
61 extern void	ftpVerbose(FILE *fp, int status);
62 extern FILE	*ftpGetURL(char	*url, char *user, char *passwd,	int *retcode);
63 extern FILE	*ftpPutURL(char	*url, char *user, char *passwd,	int *retcode);
64 extern time_t	ftpGetModtime(FILE *fp, char *s);
65 extern const	char *ftpErrString(int error);
66 extern FILE	*ftpLoginAf(char *host, int af, char *user, char *passwd,	int port, int verbose, int *retcode);
67 extern FILE	*ftpGetURLAf(char *url, int af, char *user, char *passwd, int *retcode);
68 extern FILE	*ftpPutURLAf(char *url, int af, char *user, char *passwd, int *retcode);
69 __END_DECLS
70 
71 #endif	/* _FTP_H_INCLUDE */
72