OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [ftpclient/] [current/] [include/] [ftpclient.h] - Blame information for rev 838

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_NET_FTPCLIENT_FTPCLIENT_H
2
#define CYGONCE_NET_FTPCLIENT_FTPCLIENT_H
3
 
4
//==========================================================================
5
//
6
//      ftpclient.h
7
//
8
//      A simple FTP client
9
//
10
//==========================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
12
// -------------------------------------------                              
13
// This file is part of eCos, the Embedded Configurable Operating System.   
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under    
17
// the terms of the GNU General Public License as published by the Free     
18
// Software Foundation; either version 2 or (at your option) any later      
19
// version.                                                                 
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT      
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
24
// for more details.                                                        
25
//
26
// You should have received a copy of the GNU General Public License        
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
29
//
30
// As a special exception, if other files instantiate templates or use      
31
// macros or inline functions from this file, or you compile this file      
32
// and link it with other works to produce a work based on this file,       
33
// this file does not by itself cause the resulting work to be covered by   
34
// the GNU General Public License. However the source code for this file    
35
// must still be made available in accordance with section (3) of the GNU   
36
// General Public License v2.                                               
37
//
38
// This exception does not invalidate any other reasons why a work based    
39
// on this file might be covered by the GNU General Public License.         
40
// -------------------------------------------                              
41
// ####ECOSGPLCOPYRIGHTEND####                                              
42
//==========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):    andrew.lunn@ascom.ch
46
// Contributors: andrew.lunn@ascom.ch
47
// Date:         2001-11-4
48
// Purpose:      
49
// Description:  
50
//              
51
//####DESCRIPTIONEND####
52
//
53
//==========================================================================
54
 
55
// User-defined function for printing diagnostic messages
56
typedef void (*ftp_printf_t)(unsigned error, const char *, ...);
57
// User-defined function used to provide data
58
typedef int (*ftp_read_t)(char *buf, int bufsize, void *priv);
59
// User-defined function used to process data
60
typedef int (*ftp_write_t)(char *buf, int bufsize, void *priv);
61
 
62
/* Use the FTP protocol to retrieve a file from a server. Only binary
63
   mode is supported. The filename can include a directory name. Only
64
   use unix style / not M$'s \. The file is placed into buf. buf has
65
   maximum size buf_size. If the file is bigger than this, the
66
   transfer fails and FTP_TOOBIG is returned. Other error codes as
67
   listed below can also be returned. If the transfer is succseful the
68
   number of bytes received is returned. */
69
 
70
int ftp_get(char * hostname,
71
            char * username,
72
            char * passwd,
73
            char * filename,
74
            char * buf,
75
            unsigned buf_size,
76
            ftp_printf_t ftp_printf);
77
 
78
//
79
// Just like 'ftp_get()' except that the "write()" function is called
80
// as data arrives instead of using a fixed buffer.  Returns the total
81
// amount of data read, or an error indication (negative codes)
82
//
83
int ftp_get_var(char *hostname,
84
                char *username,
85
                char *passwd,
86
                char *filename,
87
                ftp_write_t ftp_write,
88
                void *ftp_write_priv,
89
                ftp_printf_t ftp_printf);
90
 
91
/*Use the FTP protocol to send a file from a server. Only binary mode
92
  is supported. The filename can include a directory name. Only use
93
  unix style / not M$'s \. The contents of buf is placed into the file
94
  on the server. If an error occurs one of the codes as listed below
95
  will be returned. If the transfer is succseful zero is returned.*/
96
 
97
int ftp_put(char * hostname,
98
            char * username,
99
            char * passwd,
100
            char * filename,
101
            char * buf,
102
            unsigned buf_size,
103
            ftp_printf_t ftp_printf);
104
 
105
//
106
// Just like 'ftp_put()' except that the "read()" function is called
107
// to fetch the data to write instead of using a fixed buffer.  Returns 
108
// the total amount of data written, or an error indication (negative codes)
109
//
110
int ftp_put_var(char *hostname,
111
                char *username,
112
                char *passwd,
113
                char *filename,
114
                ftp_read_t ftp_read,
115
                void *ftp_read_priv,
116
                ftp_printf_t ftp_printf);
117
 
118
/*ftp_get() and ftp_put take the name of a function to call to print
119
  out diagnostic and error messages. This is a sample implementation
120
  which can be used if you don't want to implement the function
121
  yourself. error will be true when the message to print is an error
122
  message. Otherwise the message is diagnostic, eg the commands sent
123
  and received from the server.*/
124
 
125
void ftpclient_printf(unsigned error, const char *fmt, ...);
126
 
127
/* Error codes */
128
 
129
#define FTP_BAD         -2 /* Catch all, socket errors etc. */
130
#define FTP_NOSUCHHOST  -3 /* The server does not exist. */
131
#define FTP_BADUSER     -4 /* Username/Password failed */
132
#define FTP_TOOBIG      -5 /* Out of buffer space or disk space */ 
133
#define FTP_BADFILENAME -6 /* The file does not exist */
134
#define FTP_NOMEMORY    -7 /* Unable to allocate memory for internal buffers */
135
 
136
#endif // CYGONCE_NET_FTPCLIENT_FTPCLIENT
137
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.