ftp_return_type Struct Reference

FTP server return structure. More...

#include <ftplib.h>

Data Fields

uint32_t reason
 
int32_t error_code
 
uint32_t offset
 
direntry_typefp
 

Detailed Description

The ftp_return_type structure contains detailed information about the last performed DELE, STOR or BOOT command.

The structure is defined in ftplib.h.

typedef struct
{
u_int32_t reason;
#define FTP_PASS_CMD 2
#define FTP_DELE_CMD 6
#define FTP_STOR_CMD 10
#define FTP_BOOT_CMD 31
int32_t error_code; // error code
u_int32_t offset;
direntry_type *fp; // pointer to current file information

Member:

  • reason => last performed FTP command
  • error_code => file system error code
  • offset => file offset
  • fp => file pointer (refer EFS)

Example FTP server handling:

ftp_ret = ftp_server ();
if ((u_int32_t)ftp_ret > FTP_NO_ERROR)
{
//**************************************************************************
// print result
//**************************************************************************
switch ( ftp_ret-> reason )
{
case FTP_STOR_CMD :
printf (" File upload... ");
break;
case FTP_BOOT_CMD :
printf (" Boot command... ");
bootload (ftp_ret->offset);
break;
case FTP_DELE_CMD :
printf (" Delete command... ");
break;
case FTP_PASS_CMD :
printf (" new connection\r\n");
return;
}
switch ( ftp_ret-> error_code )
{
printf (" Boot sector protection error\r\n");
break;
printf (" FTP checksum error\r\n");
break;
printf (" Intel Hex error\r\n");
break;
printf (" FLASH sector erase error\r\n");
break;
printf (" FLASH program error\r\n");
break;
printf (" Buffer under-run error\r\n");
break;
printf (" Out of memory error\r\n");
break;
printf (" Out of range error\r\n");
break;
default:
printf (" Unknown error\r\n");
break;
printf (" successful\r\n");
printf (" offset: 0x%08lx\r\n", ftp_ret-> offset);
printf (" file name: %s\r\n", ftp_ret-> fp -> name);
printf (" file size: %ld words\r\n", ftp_ret-> fp -> size);
break;
}
}
Examples:
FTPServer.c.

Field Documentation

uint32_t reason

Return code

int32_t error_code

error code

uint32_t offset

File location

Pointer to current file information