VirtualBox

Changeset 82687 in vbox for trunk/include


Ignore:
Timestamp:
Jan 9, 2020 10:45:36 AM (5 years ago)
Author:
vboxsync
Message:

IPRT/FTP: More protocol handling and callback work. bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/ftp.h

    r82673 r82687  
    133133
    134134/**
     135 * Structure for maintaining a FTP server client state.
     136 */
     137typedef struct RTFTPSERVERCLIENTSTATE
     138{
     139    /** Timestamp (in ms) of last command issued by the client. */
     140    uint64_t      tsLastCmdMs;
     141} RTFTPSERVERCLIENTSTATE;
     142/** Pointer to a FTP server client state. */
     143typedef RTFTPSERVERCLIENTSTATE *PRTFTPSERVERCLIENTSTATE;
     144
     145/**
     146 * Structure for storing FTP server callback data.
     147 */
     148typedef struct RTFTPCALLBACKDATA
     149{
     150    /** Pointer to the client state. */
     151    PRTFTPSERVERCLIENTSTATE  pClient;
     152    /** Saved user pointer. */
     153    void                    *pvUser;
     154    /** Size (in bytes) of data at user pointer. */
     155    size_t                   cbUser;
     156} RTFTPCALLBACKDATA;
     157/** Pointer to FTP server callback data. */
     158typedef RTFTPCALLBACKDATA *PRTFTPCALLBACKDATA;
     159
     160/**
     161 * Function callback table for the FTP server implementation.
     162 *
     163 * All callbacks are optional and therefore can be NULL.
     164 */
     165typedef struct RTFTPSERVERCALLBACKS
     166{
     167    /** User pointer to data. Optional and can be NULL. */
     168    void  *pvUser;
     169    /** Size (in bytes) of user data pointing at. Optional and can be 0. */
     170    size_t cbUser;
     171    DECLCALLBACKMEMBER(int,  pfnOnUserConnect)(PRTFTPCALLBACKDATA pData, const char *pcszUser);
     172    DECLCALLBACKMEMBER(int,  pfnOnUserAuthenticate)(PRTFTPCALLBACKDATA pData, const char *pcszUser, const char *pcszPassword);
     173    DECLCALLBACKMEMBER(int,  pfnOnUserDisconnect)(PRTFTPCALLBACKDATA pData);
     174    DECLCALLBACKMEMBER(int,  pfnOnPathSetCurrent)(PRTFTPCALLBACKDATA pData, const char *pcszCWD);
     175    DECLCALLBACKMEMBER(int,  pfnOnPathGetCurrent)(PRTFTPCALLBACKDATA pData, char *pszPWD, size_t cbPWD);
     176    DECLCALLBACKMEMBER(int,  pfnOnList)(PRTFTPCALLBACKDATA pData, void **ppvData, size_t *pcbData);
     177} RTFTPSERVERCALLBACKS, *PRTFTPSERVERCALLBACKS;
     178/** Pointer to a FTP server callback data table. */
     179typedef RTFTPSERVERCALLBACKS *PRTFTPSERVERCALLBACKS;
     180
     181/**
    135182 * Creates a FTP server instance.
    136183 *
     
    140187 *                              If NULL or empty string the server is bound to all interfaces.
    141188 * @param   uPort               The port for creating a listening socket.
    142  * @param   pcszPathRoot        Root path of the FTP server serving.
     189 * @param   pCallbacks          Callback table to use.
    143190 */
    144191RTR3DECL(int) RTFTPServerCreate(PRTFTPSERVER phFTPServer, const char *pcszAddress, uint16_t uPort,
    145                                 const char *pcszPathRoot);
     192                                PRTFTPSERVERCALLBACKS pCallbacks);
    146193
    147194/**
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette