Скачать презентацию FTP Server API Implementing the FTP Server Registering Скачать презентацию FTP Server API Implementing the FTP Server Registering

649d757e99a17f43f895de245d80ba1a.ppt

  • Количество слайдов: 11

FTP Server API Implementing the FTP Server Registering FTP Command Callbacks Data and Control FTP Server API Implementing the FTP Server Registering FTP Command Callbacks Data and Control Port Close Callbacks Other Server Calls

Integrating an FTP Server Application Entry FSInitialize(int numusers) Register Callback Routines For… • RETRieve Integrating an FTP Server Application Entry FSInitialize(int numusers) Register Callback Routines For… • RETRieve • RMDir • STORe • DELEte • LIST • MKDir • CWD • others FSStart. Server(void)

FTP Server Sample Code #include fservapi. h FTP Server Sample Code #include fservapi. h

Registering Command Callbacks • • • int FSRegister. RETR (int (*app_RETRp)(char *, unsigned long)); Registering Command Callbacks • • • int FSRegister. RETR (int (*app_RETRp)(char *, unsigned long)); int FSRegister. STOR (int (*app_STORp)(char *, int, char *, unsigned long)); int FSRegister. SYST (int (*app_SYSTp)(char *, unsigned long)); int FSRegister. LIST (int (*app_LISTp)(char *, unsigned long)); int FSRegister. NLST (int (*app_NLSTp)(char *, unsigned long)); int FSRegister. CWD (int (*app_CWDp)(char *, unsigned long)); int FSRegister. MKD (int (*app_MKDp)(char *, unsigned long)); int FSRegister. RMD (int (*app_RMDp)(char *, unsigned long)); int FSRegister. DELE (int (*app_DELEp)(char *, unsigned long));

Registering Other Callbacks • int FSRegister. Control. Close (int (*app_c. Resetp)(char *, unsigned long)); Registering Other Callbacks • int FSRegister. Control. Close (int (*app_c. Resetp)(char *, unsigned long)); // called when control connection terminated • int FSRegister. Data. Close (int (*app_d. Resetp)(char *, unsigned long)); // called when data connection terminated

Other FTP Server API Calls • int FSHandle. To. Socket(unsigned long handle); // identifies Other FTP Server API Calls • int FSHandle. To. Socket(unsigned long handle); // identifies socket used for the request • void FSProperties (char *tnamep, int priority, int sysstack, int usrstack, int mode, int flags); // allows changing task properties – not recommended • int FSSequence. Number (unsigned long handle); // returns the sequence number of the data socket • char *FSUser. Name (unsigned long handle); // points to current session user name • int FSTimeout(unsigned long); // changes the inactivity timeout

FTP Server Summary • Register handlers for each FTP command • Identify logged on FTP Server Summary • Register handlers for each FTP command • Identify logged on user with FSUser. Name • Clean up by registering callbacks for control and data socket close events

Net+Os v 6. 0 Enhancements File System Net+Os v 6. 0 Enhancements File System

FTP Server (File System) • • Allow FTP client to login and access the FTP Server (File System) • • Allow FTP client to login and access the file system Store files Retrieve files Delete files Rename files Display the current working directory (pwd) Change the current working directory – To change to different volume, use slash ‘/’ before volume’s name • List a directory (dir or ls) • Remove a directory

File system permission • Depends on the user’s access value defined during login • File system permission • Depends on the user’s access value defined during login • User with multiple group ID – Use the same ID group as directory where a file/directory was created – Use smaller group ID when creating a file/directory in ROOT directory (group 1 -8)

FTP Server (File System) • FSInstall. File. System – Setup the File System for FTP Server (File System) • FSInstall. File. System – Setup the File System for the FTP Server – Setup the directory when FTP client logs in.