| Print dvi | usdvi |
| Download tgz |


Christophe Deleuze

1  What is FTPlib

FTPlib is a C library providing communication facilities implementing the client side of the Internet File Transfer Protocol (FTP). Thus, it allows applications to interact with FTP servers. It is heavily based on the source code of NetKit-ftp [1], a popular FTP client program for Unix machines.

FTPlib is written in C, but bindings for a large subset of the API are also provided for the Objective Caml language.

2  Library API

Briefly, you have all classic high level FTP commands for connecting, listing, changing, creating, and deleting directories, renaming, deleting, and transfering files.

The library supports “FTP gateways”: if the environment variable FTP_GATEWAY is set, ftp_open will try to open the connection to this host, providing login@server as login.

Low level functions are also provided, that allow to:

Have a look at the ftplib.h file for details. An example toy application is provided in example.c.

3  Caml bindings

All high level C functions are mapped to Caml ones, but low level functions are not available (they may be in the future, if I figure out how to copy arbitrary blocks of bytes from C to Caml).

Have a look at the ftp.ml file for details.

4  Installation

$ tar xvzf ftplib.tgz
$ cd ftplib

If you don’t want the caml bindings, uncomment the appropriate line in the Makefile, then make libftp.a. Type make example to compile the toy example.

If you want the caml bindings, make sure the appropriate line is not uncommented in the makefile, and set the appropriate value to the Makefile CAMLH_DIR variable. Do make libftp.a ftp.cmxa ftp.cma. ftp.cmxa is a native code caml library, ftp.cma a bytecode caml library. You may want to build only one of these. make ocamlftp builds a Caml toplevel containing FTPlib. You can then use this toplevel as a primitive FTP client!

5  Various notes

This documentation is awfully short and incomplete.

The library is usable but a bit incomplete as well. It hasn’t been tested extensively so far, but I guess NetKit-ftp base code is pretty stable. It is currently used in the wsync application (A Caml application, that uses only a small subset of the API).

Send bug reports, comments, suggestions, whatever to elviok AT free DOT fr.

The File Transfer Protocol specification, a bit confused, is described in [2, 3]. For a synthetic, commented, description of the protocol, see [4].

Other FTP related specifications are [5, 6, 7].


David A. Holland. Netkit-ftp. Unix FTP client program. [ url ]
J. Postel and J. Reynolds. File Transfer Protocol (FTP). RFC 959, IETF, October 1985. [ url ]
R. Braden. Requirements for Internet Hosts – Application and Support. RFC 1123, IETF, October 1989. [ url ]
D. J. Bernstein. FTP: File transfer protocol. web site. [ url ]
M. Horowitz. FTP Security Extensions. RFC 2228, IETF, October 1997. [ url ]
B. Curtin. Internationalization of the File Transfer Protocol. RFC 2640, IETF, July 1999. [ url ]
R. Housley. Encryption using KEA and SKIPJACK. RFC 2773, IETF, February 2000. [ url ]

http://christophe.deleuze.free.fr/D/ftplib.html  –  Page generated on  ,