⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpleftp.h

📁 嵌入式linux下面的ftp程序
💻 H
字号:
/*    simple ftp client implemention ,	wrrten by xudz*/#ifndef SIMPLEFTP_H#define SIMPLEFTP_H#include <sys/types.h>#include <sys/ioctl.h>#include <sys/time.h>#include <sys/stat.h>#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <getopt.h>#include <stdio.h>#include <stdlib.h>#include <signal.h>#include <string.h>#include <unistd.h>#include <netinet/in.h>#include <netdb.h>#include <sys/socket.h>#include <arpa/inet.h>#include <assert.h>#define FTP_DEFAULT_PORT 21#define verbose_flag 1#ifndef STDIN_FILENO#define STDIN_FILENO 0#endif#if BUFSIZ < 4096#undef BUFSIZ#define BUFSIZ 4096#endif#define RESERVE_CONFIG_BUFFER(buffer,len)           char buffer[len]#define RELEASE_CONFIG_BUFFER(buffer)      ((void)0)#define FALSE 0#define TRUE 1//extern "C" int connect(int ,const struct sockaddr,socklen_t);typedef struct SimpleFTP{ struct sockaddr_in s_in; FILE *control_stream; char reply[64]; char error[64];}SimpleFTP;   int SimpleFTP_init(SimpleFTP **sftp);   void SimpleFTP_free(SimpleFTP *sftp);   int ftpConnect(SimpleFTP *sftp ,char *user ,char *pass ,char *host ,int port  );   void ftpDisconnect(SimpleFTP *sftp );   char * pwd(SimpleFTP *sftp);   // caller need to free the memory !!   int cwd(SimpleFTP *sftp,char * dir);   int stor(SimpleFTP *sftp ,char * localPath);   int get(SimpleFTP *sftp ,const char *local_path ,char * server_path);  //  path is file path ,example: /root/test.c   int bin(SimpleFTP *sftp);   int ascii(SimpleFTP *sftp);   char * getLastReply(SimpleFTP *sftp);   char * getError(SimpleFTP *sftp) ;#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -