Add [15_m1284p_WIZNET_FTPD_FATFS] project

This commit is contained in:
maxxir_w
2019-01-18 15:27:04 +04:00
parent d8d905adc3
commit 9aad70f01b
28 changed files with 15749 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,156 @@
#ifndef _FTPD_H_
#define _FTPD_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* Wiznet.
* (c) Copyright 2002, Wiznet.
*
* Filename : ftpd.h
* Version : 1.0
* Programmer(s) :
* Created : 2003/01/28
* Description : Header file of FTP daemon. (AVR-GCC Compiler)
*/
#include <stdint.h>
#include "../../globals.h" //add AVR specific useful headers
#define F_FILESYSTEM // If your target support a file system, you have to activate this feature and implement.
#if defined(F_FILESYSTEM)
#include "ff.h"
#endif
#define F_APP_FTP
#define _FTP_DEBUG_
#define LINELEN 100
//#define DATA_BUF_SIZE 100
#if !defined(F_FILESYSTEM)
#define _MAX_SS 512
#endif
#define CTRL_SOCK 2
#define DATA_SOCK 3
#define IPPORT_FTPD 20 /* FTP Data port */
#define IPPORT_FTP 21 /* FTP Control port */
#define HOSTNAME "iinChip"
#define VERSION "1.0"
#define FILENAME "a.txt"
/* FTP commands */
enum ftp_cmd {
USER_CMD,
ACCT_CMD,
PASS_CMD,
TYPE_CMD,
LIST_CMD,
CWD_CMD,
DELE_CMD,
NAME_CMD,
QUIT_CMD,
RETR_CMD,
STOR_CMD,
PORT_CMD,
NLST_CMD,
PWD_CMD,
XPWD_CMD,
MKD_CMD,
XMKD_CMD,
XRMD_CMD,
RMD_CMD,
STRU_CMD,
MODE_CMD,
SYST_CMD,
XMD5_CMD,
XCWD_CMD,
FEAT_CMD,
PASV_CMD,
SIZE_CMD,
MLSD_CMD,
APPE_CMD,
NO_CMD,
};
enum ftp_type {
ASCII_TYPE,
IMAGE_TYPE,
LOGICAL_TYPE
};
enum ftp_state {
FTPS_NOT_LOGIN,
FTPS_LOGIN
};
enum datasock_state{
DATASOCK_IDLE,
DATASOCK_READY,
DATASOCK_START
};
enum datasock_mode{
PASSIVE_MODE,
ACTIVE_MODE
};
struct ftpd {
uint8_t control; /* Control stream */
uint8_t data; /* Data stream */
enum ftp_type type; /* Transfer type */
enum ftp_state state;
enum ftp_cmd current_cmd;
enum datasock_state dsock_state;
enum datasock_mode dsock_mode;
char username[LINELEN]; /* Arg to USER command */
char workingdir[LINELEN];
char filename[LINELEN];
#if defined(F_FILESYSTEM)
FIL fil; // FatFs File objects
FRESULT fr; // FatFs function common result code
#endif
};
#ifndef un_I2cval
typedef union _un_l2cval {
uint32_t lVal;
uint8_t cVal[4];
}un_l2cval;
#endif
void ftpd_init(uint8_t * src_ip);
uint8_t ftpd_run(uint8_t * dbuf);
char proc_ftpd(char * buf);
char ftplogin(char * pass);
int pport(char * arg);
int sendit(char * command);
int recvit(char * command);
long sendfile(uint8_t s, char * command);
long recvfile(uint8_t s);
#if defined(F_FILESYSTEM)
void print_filedsc(FIL *fil);
#endif
#ifdef __cplusplus
}
#endif
#endif // _FTPD_H_

View File

@@ -0,0 +1,75 @@
/* Copyright (c) 2002, Joerg Wunsch
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/* $Id: stdio_private.h,v 1.6 2003/01/07 22:17:24 joerg_wunsch Exp $ */
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdio.h>
//struct __file {
// char *buf; /* buffer pointer */
// unsigned char unget; /* ungetc() buffer */
// uint8_t flags; /* flags, see below */
//#define __SRD 0x0001 /* OK to read */
//#define __SWR 0x0002 /* OK to write */
//#define __SSTR 0x0004 /* this is an sprintf/snprintf string */
//#define __SPGM 0x0008 /* fmt string is in progmem */
//#define __SERR 0x0010 /* found error */
//#define __SEOF 0x0020 /* found EOF */
//#define __SUNGET 0x040 /* ungetc() happened */
//#if 0
///* possible future extensions, will require uint16_t flags */
//#define __SRW 0x0080 /* open for reading & writing */
//#define __SLBF 0x0100 /* line buffered */
//#define __SNBF 0x0200 /* unbuffered */
//#define __SMBF 0x0400 /* buf is from malloc */
//#endif
// int size; /* size of buffer */
// int len; /* characters read or written so far */
// int (*put)(char); /* function to write one char to device */
// int (*get)(void); /* function to read one char from device */
//};
/* values for PRINTF_LEVEL */
#define PRINTF_MIN 1
#define PRINTF_STD 2
#define PRINTF_FLT 3
/* values for SCANF_LEVEL */
#define SCANF_MIN 1
#define SCANF_STD 2
#define SCANF_FLT 3
#ifdef __cplusplus
}
#endif