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

📄 warsvrenums.h

📁 ftpserver very good sample
💻 H
字号:
/** */#ifndef WAR_SVR_ENUMS_H#define WAR_SVR_ENUMS_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES */#ifndef WAR_TYPES_H#   include "WarTypes.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarSvrEnums {public:    ///    enum WarLoginResultE     {        LF_OK, ///        LF_CALLER_NOT_AUTHENTICATED, ///         LF_ACCESS_DENIED, ///        LF_UNKNOWN_SVRTYPE, ///         LF_SERVER_NOT_KNOWN, ///        LF_ILLEGAL_NAME, ///        LF_USER_NOT_FOUND, ///        LF_USER_NOT_READY, ///        LF_USER_NOT_PERMITTED_TO_SERVICE, ///        LF_TOO_LONG_USERNAME, ///        LF_TOO_LONG_PASSWORD, ///        LF_TOO_LONG_HOSTNAME, ///        LF_BAD_PASSWORD, ///        LF_NEED_EMAIL_AS_PWD, ///        LF_NEED_PASSWORD, ///        LF_TOO_MANY_CONNECTIONS, ///        LF_TOO_MANY_CONNECTIONS_FROM_IP, ///        LF_TOO_MANY_CONNECTIONS_TOTAL, ///        LF_INTERNAL_ERROR, ///        LF_THROW_USER_OFF, ///        LF_TOO_MANY_FAILED_LOGINS, ///        LF_TIME_OF_DAY_DENIAL, ///        LF_IP_SHITLISTED, ///        LF_IP_MARKED_AS_HACKER, ///        LF_SYSTEM_SHUTDOWN, ///        LF_NO_ANONYMOUS_USERS, ///        LF_CONFIGURATION_ERROR, ///        LF_INVALID ///    };     ///    enum DirectionE    {        SENDING, ///        RECEIVING ///    };    /// Limits to avoid buffer overflow in system library    enum WarAuthLimitsE    {        MAX_USERNAME_LEN = 32, ///        MAX_PASSWORD_LEN = 64, ///        MAX_HOST_LEN = 128 ///    };    /// Permissions    enum PropBitsE    {        /// No symlinks        SYMLINK_NONE =      0,        /// Follow symlinks within ths path        SYMLINK_THIS =      1,        /// Follow symlink within the defined paths        SYMLINK_TREE =      2,        /// Follow symlinks anywhere (dangerous!)        SYMLINK_ALL =       3,        /// Allow readning of files        ALLOW_READ =        (1 << 3),        /// Allow creatioin of and writing to files        ALLOW_WRITE =       (1 << 4),        /// Allow appending to files        ALLOW_APPEND =      (1 << 5),        /// Allow execution of programs (typicalkly CGI-BIN's)        ALLOW_EXEC =        (1 << 6),        /// Allow dir-listings        ALLOW_LIST =        (1 << 7),        /// Allow deletion of files        ALLOW_DELETE =      (1 << 8),        /// Allow CWD command to dir        ALLOW_CWD =         (1 << 9),        /// Allow users to create symlinks        ALLOW_SYMLINK =     (1 << 10),        // Hide other users files        //HIDE_OTHERS =       0x00000100,        /// Hide all files        HIDE_ALL =          (1 << 11),        /// Apply permissioins to subdirectories        RECURSIVE =         (1 << 12),        /// Deny all access - overrides all other settings        DENY_ALL =          (1 << 13),        /// No ratio on systems that enforse such        SHARE_FREE =        (1 << 14),        /// Allow creation of directories        ALLOW_DIR_CREATE =  (1 << 15),        /// Allow deletion of directories        ALLOW_DIR_DELETE =  (1 << 16),        /** Shared upload folder. Only show the users own           * files. Allow deletion of own files          */        SHARED_UPLOAD =     (1 << 17),        /// Treat symlinks as hardlinks        MAP_SYMLINK =       (1 << 18),        /// Default permissions        DEFAULT_PERMS = (ALLOW_READ|ALLOW_LIST|ALLOW_CWD|RECURSIVE|SHARE_FREE|SYMLINK_TREE)    };    bool IsPermissionSet(int perm, int flag)    {        return ((perm & flag) == flag);    }    static bool IsSymlink(int perms)    {        return ((perms & SYMLINK_ALL) != 0);    }    static bool IsSymlinkThis(int perms)    {        return ((perms & SYMLINK_ALL) == SYMLINK_THIS);    }    static bool IsSymlinkThree(int perms)    {        return ((perms & SYMLINK_ALL) == SYMLINK_TREE);    }        static bool IsSymlinkAll(int perms)    {        return ((perms & SYMLINK_ALL) == SYMLINK_ALL);    }    static war_uint32_t GetSanePerms(war_uint32_t perms)    {        if (!(perms & DENY_ALL))            perms &= ~HIDE_ALL;        if (perms & SHARED_UPLOAD)        {            perms |= ALLOW_WRITE                 | ALLOW_APPEND                 | ALLOW_DELETE                | ALLOW_DIR_DELETE;                        perms &= ~(ALLOW_READ                | SYMLINK_ALL                | ALLOW_EXEC);        }                return perms;    }    ///    enum ConnectionStatesE    {        ///        PRELOGIN,        ///        IDLE,        /// Upload (STOR)        GETFILE,        /// Download (RETR)        PUTFILE,        ///        QUITTING,        ///        STATE_INVALID    };protected:private:};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WAR_SVR_ENUMS_H_ */

⌨️ 快捷键说明

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