1996-06-17 12:26:06 +00:00
|
|
|
#ifndef _FTP_H_INCLUDE
|
|
|
|
#define _FTP_H_INCLUDE
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
1997-05-05 11:18:55 +00:00
|
|
|
#include <sys/cdefs.h>
|
1996-09-19 17:28:34 +00:00
|
|
|
#include <stdio.h>
|
1996-06-17 12:26:06 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
* "THE BEER-WARE LICENSE" (Revision 42):
|
2002-03-25 13:52:45 +00:00
|
|
|
* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
|
1996-06-17 12:26:06 +00:00
|
|
|
* can do whatever you want with this stuff. If we meet some day, and you think
|
|
|
|
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Major Changelog:
|
|
|
|
*
|
|
|
|
* Jordan K. Hubbard
|
|
|
|
* 17 Jan 1996
|
|
|
|
*
|
|
|
|
* Turned inside out. Now returns xfers as new file ids, not as a special
|
|
|
|
* `state' of FTP_t
|
|
|
|
*
|
1999-08-28 00:22:10 +00:00
|
|
|
* $FreeBSD$
|
1996-06-17 12:26:06 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Internal housekeeping data structure for FTP sessions */
|
|
|
|
typedef struct {
|
1996-11-14 05:22:12 +00:00
|
|
|
enum { init, isopen, quit } con_state;
|
1996-06-17 12:26:06 +00:00
|
|
|
int fd_ctrl;
|
|
|
|
int addrtype;
|
|
|
|
char *host;
|
|
|
|
char *file;
|
1997-12-20 04:06:06 +00:00
|
|
|
int error;
|
1996-06-22 21:43:56 +00:00
|
|
|
int is_binary;
|
|
|
|
int is_passive;
|
1996-07-04 00:55:21 +00:00
|
|
|
int is_verbose;
|
1996-06-17 12:26:06 +00:00
|
|
|
} *FTP_t;
|
|
|
|
|
1996-08-21 01:12:11 +00:00
|
|
|
/* Structure we use to match FTP error codes with readable strings */
|
|
|
|
struct ftperr {
|
|
|
|
const int num;
|
|
|
|
const char *string;
|
|
|
|
};
|
1997-05-05 11:18:55 +00:00
|
|
|
|
|
|
|
__BEGIN_DECLS
|
1996-08-21 01:12:11 +00:00
|
|
|
extern struct ftperr ftpErrList[];
|
|
|
|
extern int const ftpErrListLength;
|
|
|
|
|
1996-06-17 12:26:06 +00:00
|
|
|
/* Exported routines - deal only with FILE* type */
|
1996-11-14 06:59:41 +00:00
|
|
|
extern FILE *ftpLogin(char *host, char *user, char *passwd, int port, int verbose, int *retcode);
|
1996-06-17 12:26:06 +00:00
|
|
|
extern int ftpChdir(FILE *fp, char *dir);
|
|
|
|
extern int ftpErrno(FILE *fp);
|
1996-09-19 17:28:34 +00:00
|
|
|
extern off_t ftpGetSize(FILE *fp, char *file);
|
|
|
|
extern FILE *ftpGet(FILE *fp, char *file, off_t *seekto);
|
1996-06-17 12:26:06 +00:00
|
|
|
extern FILE *ftpPut(FILE *fp, char *file);
|
1996-06-22 21:43:56 +00:00
|
|
|
extern int ftpAscii(FILE *fp);
|
|
|
|
extern int ftpBinary(FILE *fp);
|
1996-06-17 12:26:06 +00:00
|
|
|
extern int ftpPassive(FILE *fp, int status);
|
1996-07-04 00:55:21 +00:00
|
|
|
extern void ftpVerbose(FILE *fp, int status);
|
1996-11-14 06:59:41 +00:00
|
|
|
extern FILE *ftpGetURL(char *url, char *user, char *passwd, int *retcode);
|
|
|
|
extern FILE *ftpPutURL(char *url, char *user, char *passwd, int *retcode);
|
1996-06-26 20:31:11 +00:00
|
|
|
extern time_t ftpGetModtime(FILE *fp, char *s);
|
1997-12-20 04:06:06 +00:00
|
|
|
extern const char *ftpErrString(int error);
|
2000-07-05 19:34:43 +00:00
|
|
|
extern FILE *ftpLoginAf(char *host, int af, char *user, char *passwd, int port, int verbose, int *retcode);
|
|
|
|
extern FILE *ftpGetURLAf(char *url, int af, char *user, char *passwd, int *retcode);
|
|
|
|
extern FILE *ftpPutURLAf(char *url, int af, char *user, char *passwd, int *retcode);
|
1997-05-05 11:18:55 +00:00
|
|
|
__END_DECLS
|
1996-06-17 12:26:06 +00:00
|
|
|
|
|
|
|
#endif /* _FTP_H_INCLUDE */
|