1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3
* The contents of this file are subject to the Netscape Public
4
* License Version 1.1 (the "License"); you may not use this file
5
* except in compliance with the License. You may obtain a copy of
6
* the License at http://www.mozilla.org/NPL/
8
* Software distributed under the License is distributed on an "AS
9
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
* implied. See the License for the specific language governing
11
* rights and limitations under the License.
13
* The Original Code is Mozilla Communicator client code,
14
* released March 31, 1998.
16
* The Initial Developer of the Original Code is Netscape Communications
17
* Corporation. Portions created by Netscape are
18
* Copyright (C) 1998 Netscape Communications Corporation. All
22
* Samir Gehani <sgehani@netscape.com>
25
#ifndef _NS_FTPCONN_H_
26
#define _NS_FTPCONN_H_
30
typedef int (*FTPGetCB)(int aBytesRd, int aTotal);
35
nsFTPConn(char *aHost);
36
nsFTPConn(char *aHost, int (*aEventPumpCB)(void));
46
/* connection state */
55
int Open(char *aHost);
56
int ResumeOrGet(char *aSrvPath, char *aLoclPath, int aType,
57
int aOvWrite, FTPGetCB aCBFunc);
58
int Get(char *aSrvPath, char *aLoclPath, int aType,
59
int aOvWrite, FTPGetCB aCBFunc);
60
int Get(char *aSrvPath, char *aLoclPath, int aType, int aResumePos,
61
int aOvWrite, FTPGetCB aCBFunc);
64
/*--------------------------------------------------------------------*
66
*--------------------------------------------------------------------*/
70
E_MEM = -801, /* out of memory */
71
E_PARAM = -802, /* parameter null or incorrect */
72
E_ALREADY_OPEN = -803, /* connection already established */
73
E_NOT_OPEN = -804, /* connection not established, can't use */
74
E_CMD_ERR = -805, /* ftp command error */
75
E_CMD_FAIL = -806, /* ftp command failed */
76
E_CMD_UNEXPECTED = -807, /* ftp command unexpected response */
77
E_WRITE = -808, /* write to socket/fd failed */
78
E_READ = -809, /* read on socket/fd failed */
79
E_SMALL_BUF = -810, /* buffer too small, provide bigger one */
80
E_CANT_OVWRITE = -811, /* cannot overwrite existing file */
81
E_LOCL_INIT = -812, /* local file open/init failed */
82
E_USER_CANCEL = -813, /* user canceled the download */
83
E_INVALID_ADDR = -814 /* couldn't parse address/port */
87
int FlushCntlSock(nsSocket *aSock, int bailOnTimeOut = 1);
88
int IssueCmd(const char *aCmd, char *aResp, int aRespSize,
90
int ParseAddr(char *aBuf, char **aHost, int *aPort);
91
int DataInit(char *aHost, int aPort, nsSocket **aSock);
93
int (*mEventPumpCB)(void);
117
#if defined(DEBUG) || defined(DEBUG_sgehani)
118
#define DUMP(_msg) printf("%s %d: %s\n", __FILE__, __LINE__, _msg);
124
#define ERR_CHECK(_func) \
133
#endif /* _NS_FTPCONN_H_ */