ftpd.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __FTPD_H
  2. #define __FTPD_H
  3. #include "avltree.h"
  4. #include "includes.h"
  5. #include "os_cpu.h"
  6. #include "tcpip.h"
  7. #include <sys/_intsup.h>
  8. #define FTP_STR2ID(str) ((*(int *)(str)) & 0xDFDFDFDF)
  9. #define msg200 "220 lwIP FTP Server ready.\r\n"
  10. #define msg230 "230 User logged in, proceed.\r\n"
  11. #define msg331 "331 User name okay, need password.\r\n"
  12. #define msg250 "250 Operation successful\r\n"
  13. #define msg450 "450 Operation error\r\n"
  14. #define msg501 "501 Syntax error in parameters or arguments."
  15. #define msg503 "503 Bad sequence of commands.\r\n"
  16. typedef struct
  17. {
  18. int cmd_socket;
  19. char *arg;
  20. INT8U arglen;
  21. char event;
  22. #define FTP_LIST 1U
  23. #define FTP_SEND_FILE_DATA 2U
  24. #define FTP_RECV_FILE 3U
  25. char current_dir[128];
  26. } ftp_mbox_t;
  27. typedef void (*ftp_cmd_func)(ftp_mbox_t *pmbox);
  28. typedef struct
  29. {
  30. uint32_t index; // 命令标识码
  31. ftp_cmd_func func; // 记录命令函数指针
  32. struct avl_node cmd_node; // avl树节点
  33. } ftp_cmd_t;
  34. ftp_cmd_t *ftp_search_command(int i_ctrl_cmd);
  35. int ftp_insert_command(ftp_cmd_t *p_cmd);
  36. char *data_port_list_file(ftp_mbox_t *msgbox);
  37. // char *data_port_recv_file(ftp_mbox_t *msgbox);
  38. #endif