<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- permission is obtained from the copyright holder. -->
|
<!-- permission is obtained from the copyright holder. -->
|
<HTML
|
<HTML
|
><HEAD
|
><HEAD
|
><TITLE
|
><TITLE
|
>FTP Client Features</TITLE
|
>FTP Client Features</TITLE
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
<META
|
<META
|
NAME="GENERATOR"
|
NAME="GENERATOR"
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
"><LINK
|
"><LINK
|
REL="HOME"
|
REL="HOME"
|
TITLE="eCos Reference Manual"
|
TITLE="eCos Reference Manual"
|
HREF="ecos-ref.html"><LINK
|
HREF="ecos-ref.html"><LINK
|
REL="UP"
|
REL="UP"
|
TITLE="FTP Client for eCos TCP/IP Stack"
|
TITLE="FTP Client for eCos TCP/IP Stack"
|
HREF="net-ftpclient.html"><LINK
|
HREF="net-ftpclient.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="FTP Client for eCos TCP/IP Stack"
|
TITLE="FTP Client for eCos TCP/IP Stack"
|
HREF="net-ftpclient.html"><LINK
|
HREF="net-ftpclient.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="CRC Algorithms"
|
TITLE="CRC Algorithms"
|
HREF="services-crc.html"></HEAD
|
HREF="services-crc.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="CHAPTER"
|
CLASS="CHAPTER"
|
BGCOLOR="#FFFFFF"
|
BGCOLOR="#FFFFFF"
|
TEXT="#000000"
|
TEXT="#000000"
|
LINK="#0000FF"
|
LINK="#0000FF"
|
VLINK="#840084"
|
VLINK="#840084"
|
ALINK="#0000FF"
|
ALINK="#0000FF"
|
><DIV
|
><DIV
|
CLASS="NAVHEADER"
|
CLASS="NAVHEADER"
|
><TABLE
|
><TABLE
|
SUMMARY="Header navigation table"
|
SUMMARY="Header navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TH
|
><TH
|
COLSPAN="3"
|
COLSPAN="3"
|
ALIGN="center"
|
ALIGN="center"
|
>eCos Reference Manual</TH
|
>eCos Reference Manual</TH
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="net-ftpclient.html"
|
HREF="net-ftpclient.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="80%"
|
WIDTH="80%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="services-crc.html"
|
HREF="services-crc.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"></DIV
|
WIDTH="100%"></DIV
|
><DIV
|
><DIV
|
CLASS="CHAPTER"
|
CLASS="CHAPTER"
|
><H1
|
><H1
|
><A
|
><A
|
NAME="NET-FTPCLIENT-FEATURES">Chapter 49. FTP Client Features</H1
|
NAME="NET-FTPCLIENT-FEATURES">Chapter 49. FTP Client Features</H1
|
><DIV
|
><DIV
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><H1
|
><H1
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><A
|
><A
|
NAME="NET-FTPCLIENT-FEATURES-API">FTP Client API</H1
|
NAME="NET-FTPCLIENT-FEATURES-API">FTP Client API</H1
|
><P
|
><P
|
>This package implements an FTP client. The API is in include file
|
>This package implements an FTP client. The API is in include file
|
<TT
|
<TT
|
CLASS="FILENAME"
|
CLASS="FILENAME"
|
>install/include/ftpclient.h</TT
|
>install/include/ftpclient.h</TT
|
> and it can be used thus:
|
> and it can be used thus:
|
<TABLE
|
<TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>#include <network.h>
|
>#include <network.h>
|
#include <ftpclient.h></PRE
|
#include <ftpclient.h></PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
>
|
>
|
It looks like this:</P
|
It looks like this:</P
|
><DIV
|
><DIV
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><H2
|
><H2
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><A
|
><A
|
NAME="NET-FTPCLIENT-FEATURES-API-GET">ftp_get</H2
|
NAME="NET-FTPCLIENT-FEATURES-API-GET">ftp_get</H2
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>int ftp_get(char * hostname,
|
>int ftp_get(char * hostname,
|
char * username,
|
char * username,
|
char * passwd,
|
char * passwd,
|
char * filename,
|
char * filename,
|
char * buf,
|
char * buf,
|
unsigned buf_size,
|
unsigned buf_size,
|
ftp_printf_t ftp_printf);</PRE
|
ftp_printf_t ftp_printf);</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>Use the FTP protocol to retrieve a file from a server. Only binary
|
>Use the FTP protocol to retrieve a file from a server. Only binary
|
mode is supported. The filename can include a directory name. Only
|
mode is supported. The filename can include a directory name. Only
|
use unix style ‘/’ file separators,
|
use unix style ‘/’ file separators,
|
not ‘\’.
|
not ‘\’.
|
The file is placed into <TT
|
The file is placed into <TT
|
CLASS="PARAMETER"
|
CLASS="PARAMETER"
|
><I
|
><I
|
>buf</I
|
>buf</I
|
></TT
|
></TT
|
>.
|
>.
|
<TT
|
<TT
|
CLASS="PARAMETER"
|
CLASS="PARAMETER"
|
><I
|
><I
|
>buf</I
|
>buf</I
|
></TT
|
></TT
|
> has maximum size <TT
|
> has maximum size <TT
|
CLASS="PARAMETER"
|
CLASS="PARAMETER"
|
><I
|
><I
|
>buf_size</I
|
>buf_size</I
|
></TT
|
></TT
|
>.
|
>.
|
If the file is bigger than this, the
|
If the file is bigger than this, the
|
transfer fails and <SPAN
|
transfer fails and <SPAN
|
CLASS="ERRORCODE"
|
CLASS="ERRORCODE"
|
>FTP_TOOBIG</SPAN
|
>FTP_TOOBIG</SPAN
|
> is returned.
|
> is returned.
|
Other error codes listed in the header can also be returned.
|
Other error codes listed in the header can also be returned.
|
If the transfer is successful the number of bytes received is returned.</P
|
If the transfer is successful the number of bytes received is returned.</P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><H2
|
><H2
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><A
|
><A
|
NAME="NET-FTPCLIENT-FEATURES-API-PUT">ftp_put</H2
|
NAME="NET-FTPCLIENT-FEATURES-API-PUT">ftp_put</H2
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>int ftp_put(char * hostname,
|
>int ftp_put(char * hostname,
|
char * username,
|
char * username,
|
char * passwd,
|
char * passwd,
|
char * filename,
|
char * filename,
|
char * buf,
|
char * buf,
|
unsigned buf_size,
|
unsigned buf_size,
|
ftp_printf_t ftp_printf);</PRE
|
ftp_printf_t ftp_printf);</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
>Use the FTP protocol to send a file to a server.
|
>Use the FTP protocol to send a file to a server.
|
Only binary
|
Only binary
|
mode is supported. The filename can include a directory name. Only
|
mode is supported. The filename can include a directory name. Only
|
use unix style ‘/’ file separators,
|
use unix style ‘/’ file separators,
|
not ‘\’.
|
not ‘\’.
|
The contents of <TT
|
The contents of <TT
|
CLASS="PARAMETER"
|
CLASS="PARAMETER"
|
><I
|
><I
|
>buf</I
|
>buf</I
|
></TT
|
></TT
|
> are placed into the file on the
|
> are placed into the file on the
|
server. If an error occurs one of the codes listed will be returned. If the
|
server. If an error occurs one of the codes listed will be returned. If the
|
transfer is successful zero is returned.</P
|
transfer is successful zero is returned.</P
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><H2
|
><H2
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><A
|
><A
|
NAME="NET-FTPCLIENT-FEATURES-API-PRINTF">ftpclient_printf</H2
|
NAME="NET-FTPCLIENT-FEATURES-API-PRINTF">ftpclient_printf</H2
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
>void ftpclient_printf(unsigned error, const char *fmt, ...);</PRE
|
>void ftpclient_printf(unsigned error, const char *fmt, ...);</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><P
|
><P
|
><TT
|
><TT
|
CLASS="FUNCTION"
|
CLASS="FUNCTION"
|
>ftp_get()</TT
|
>ftp_get()</TT
|
> and <TT
|
> and <TT
|
CLASS="FUNCTION"
|
CLASS="FUNCTION"
|
>ftp_put</TT
|
>ftp_put</TT
|
>
|
>
|
take a pointer to a function to use for printing
|
take a pointer to a function to use for printing
|
out diagnostic and error messages. This is a sample implementation
|
out diagnostic and error messages. This is a sample implementation
|
which can be used if you don't want to implement the function
|
which can be used if you don't want to implement the function
|
yourself.
|
yourself.
|
<TT
|
<TT
|
CLASS="PARAMETER"
|
CLASS="PARAMETER"
|
><I
|
><I
|
>error</I
|
>error</I
|
></TT
|
></TT
|
> will be true when the message to print is an
|
> will be true when the message to print is an
|
error message. Otherwise the message is diagnostic, eg. the commands sent
|
error message. Otherwise the message is diagnostic, eg. the commands sent
|
and received from the server.</P
|
and received from the server.</P
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="NAVFOOTER"
|
CLASS="NAVFOOTER"
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"><TABLE
|
WIDTH="100%"><TABLE
|
SUMMARY="Footer navigation table"
|
SUMMARY="Footer navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-ftpclient.html"
|
HREF="net-ftpclient.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ecos-ref.html"
|
HREF="ecos-ref.html"
|
ACCESSKEY="H"
|
ACCESSKEY="H"
|
>Home</A
|
>Home</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="services-crc.html"
|
HREF="services-crc.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
>FTP Client for eCos TCP/IP Stack</TD
|
>FTP Client for eCos TCP/IP Stack</TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-ftpclient.html"
|
HREF="net-ftpclient.html"
|
ACCESSKEY="U"
|
ACCESSKEY="U"
|
>Up</A
|
>Up</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
>CRC Algorithms</TD
|
>CRC Algorithms</TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|