Annotation of libwww/Library/src/HTFTP.html, revision 2.14
2.7 timbl 1: <HTML>
2: <HEAD>
2.6 timbl 3: <TITLE>FTP access module for libwww</TITLE>
2.7 timbl 4: <NEXTID N="z1">
5: </HEAD>
2.6 timbl 6: <BODY>
2.9 frystyk 7: <H1>FTP access functions</H1>
2.14 ! frystyk 8:
! 9: This is the FTP load module that handles all communication with FTP-servers.<P>
! 10:
! 11: <B>Authors</B><P>
2.9 frystyk 12:
13: <UL>
2.14 ! frystyk 14: <LI>Tim Berners-lee, timbl@info.cern.ch
! 15: <LI>Denis DeLaRoca 310 825-4580, CSP1DWD@mvs.oac.ucla.edu
! 16: <LI>Lou Montulli, montulli@ukanaix.cc.ukans.edu
! 17: <LI>Foteos Macrides, macrides@sci.wfeb.edu
! 18: <LI>Henrik Frystyk, frystyk@dxcern.cern.ch
2.9 frystyk 19: </UL>
20:
2.6 timbl 21: <PRE>#ifndef HTFTP_H
2.1 timbl 22: #define HTFTP_H
2.9 frystyk 23: #include "HTChunk.h"
24: </PRE>
25:
2.14 ! frystyk 26: <H2>Public Functions</H2>
2.1 timbl 27:
2.14 ! frystyk 28: Theese are the public functions...
! 29:
! 30: <H3>Accessing FTP-Server</H3>
2.1 timbl 31:
2.9 frystyk 32: <PRE>
2.12 frystyk 33: extern int HTLoadFTP PARAMS((HTRequest * request));
2.6 timbl 34: </PRE>
2.9 frystyk 35:
2.14 ! frystyk 36: <H3>Enable/Disable Reuse of Control Connections on Client Side</H3>
! 37:
2.9 frystyk 38: The next two functions are for enabling and disabling reuse og control
39: connections on client side. Though, this is a temporary solution as the
40: library is going to be multi-threaded and then the control of open
41: connections changes. Reuse of control connections is mainly intended for use
42: when loading several files from the same server in the same directory, but
43: changing directory IS supported using FTP-commands CDUP and CWD.
44:
45: <PRE>
46: extern void HTFTP_enable_session NOPARAMS;
47: extern BOOL HTFTP_disable_session NOPARAMS;
48: </PRE>
49:
2.14 ! frystyk 50: <H2>Data Structures</H2>
! 51:
! 52: Both the data connection and the control connection has a separate data structure that contains all information so that the module is reentrant (for multi threading)
! 53:
2.9 frystyk 54: <PRE>
55: typedef enum _HTFTPServerType {
56: UNKNOWN = -1,
57: GENERIC_SERVER = 0,
58: MACHTEN_SERVER,
59: UNIX_SERVER,
60: VMS_SERVER,
61: CMS_SERVER,
62: DCTS_SERVER,
63: TCPC_SERVER,
64: PETER_LEWIS_SERVER,
2.13 frystyk 65: NCSA_SERVER,
66: WINDOWS_NT
2.9 frystyk 67: } HTFTPServerType;
68:
69: typedef enum _HTFTPMainState {
2.12 frystyk 70: FTP_ERROR = -2,
71: FTP_FAILURE = -1,
72: FTP_IDLE = 0,
73: FTP_BEGIN,
74: FTP_LOGGED_IN,
75: FTP_GOT_DATA_CON,
76: FTP_GOT_SERVER_INFO,
77: FTP_GOT_DATA
2.9 frystyk 78: } HTFTPState;
79:
80: typedef struct _user_info {
81: char * domain;
82: char * id;
83: char * passwd;
84: } user_info;
85:
86: typedef struct _ftp_ctrl_info {
87: u_long serv_node; /* IP address of server */
88: u_short serv_port; /* Port number on server */
89: int socket; /* Socket number for communication */
90: HTInputSocket * isoc; /* Input buffer */
91: char * location; /* Current escaped position */
92: user_info * user; /* Userid, passwd and domain */
93: HTChunk * welcome; /* The welcome message */
2.10 frystyk 94: HTChunk * reply; /* Last reply from server */
2.9 frystyk 95: HTFTPServerType server; /* Type of server */
96: BOOL unsure_type; /* Sure about the type? */
97: BOOL use_list; /* Can we use LIST */
98: HTFTPState state; /* State of the connection */
99: HTList * data_cons; /* The data connections */
100: } ftp_ctrl_info;
101:
102: /* We assume that the data connection is established between the same hosts
103: as the control connection */
104: typedef struct _ftp_data_info {
105: int socket; /* Socket number for communication */
106: HTFormat fileformat; /* File format of current file */
2.14 ! frystyk 107: char passive; /* Have we opened passively */
2.9 frystyk 108: BOOL directory; /* Yes if directory */
109: char * datatype; /* See rfc959 p.48, but NO SPACE! */
110: unsigned long b_trans; /* Number of bytes transferred */
111: ftp_ctrl_info * ctrl; /* Controlling connection */
112: } ftp_data_info;
113: </PRE>
114:
2.14 ! frystyk 115: <H3>Comments to the Data Structures</H3>
! 116: <DL>
! 117:
! 118: <DT> location
! 119: <DD> The current location on the FTP-site. This is kept up to date using CWD and CDUP, but as there is no garanty for a hierarchical file structure in FTP, it should be handled carefully.
! 120: <DT> passive
! 121: <DD> 0 means we are active, 1 means we are passive but haven't done any accept, 2 means we are passive AND have done the accept.
! 122: </DL>
! 123:
2.9 frystyk 124: <H2>Flags for FTP connections</H2>
125:
2.14 ! frystyk 126: Those are the flags for configuring the FTP client.
! 127:
! 128: <PRE>
! 129: extern BOOL HTFTPUserInfo;
! 130: extern long HTFTPTimeOut;
! 131: </PRE>
! 132:
! 133: If HTFTPUserInfo = YES (as pr default) then the users login name and password
! 134: is reused when conneting to the same host. It is, however, overwritten by any
! 135: userid and passwd speficied in the URL. This is only for the client side, as
! 136: server forks itself on any request. If this flag is not set, then anonymous
! 137: and username of the current proces is used. <P>
! 138:
! 139: In addition, the following defines are available in the module: <P>
2.9 frystyk 140:
2.6 timbl 141: <DL>
2.9 frystyk 142: <DT>LISTEN
143: <DD>This defines makes it possible to use PORT and hence do an passive
144: open for the data connection. Though, if defined, this is only used AFTER
145: an active open has been tried using PASV.
146: <DT>REPEAT_PORT
2.11 luotonen 147: <DD>If LISTEN is defined, then when we have found a passive port, then reuse
2.9 frystyk 148: it for the next time, else we ask the system to get a new one.
149: <DT>POLL_PORTS
2.11 luotonen 150: <DD>If the system doesn't support finding a new port, then let's try it
2.9 frystyk 151: ourselves.
2.6 timbl 152: </DL>
153:
2.9 frystyk 154:
155: <PRE>
2.8 luotonen 156: #endif
2.6 timbl 157: </PRE>
2.9 frystyk 158: end
159: </BODY>
160: </HTML>
2.1 timbl 161:
162:
Webmaster