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

📄 warsvrpath.h

📁 ftpserver very good sample
💻 H
字号:
/** */#ifndef WAR_SVR_PATH_H#define WAR_SVR_PATH_H/* SYSTEM INCLUDES */#ifndef WAR_LIST_INCLUDED#   define WAR_LIST_INCLUDED#   include <list>#endif#ifndef WAR_SET_INCLUDED#   define WAR_SET_INCLUDED#   include <set>#endif/* PROJECT INCLUDES */#ifndef WAR_TYPES_H#   include "WarTypes.h"#endif#ifndef WAR_FILE_ENUMS_H#   include "WarFileEnums.h"#endif#ifndef WAR_PATH_H#   include "WarPath.h"#endif#ifndef WAR_URL_H#   include "WarUrl.h"#endif#ifndef WAR_SVR_ENUMS_H#   include "WarSvrEnums.h"#endif#ifndef WAR_IP_ACCESS_LIST_H#   include "WarIpAccessList.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 WarSvrPath : public WarFileEnums,    public WarSvrEnums{public:    /// UTF8 path, as seen by the servers    typedef war_svrpath_t path_t;     // LIFECYCLE        /**    * Default constructor.    */    WarSvrPath(void);    /** Constructor */    WarSvrPath(const path_t& Alias,        const WarUrl& Url,        const war_uint32_t Perms,        const PathCmpTypeE CmpMode = PCMP_AUTO);    /** Constructor */    WarSvrPath(const war_ccstr_t utf8Alias,        const war_ccstr_t utf8Url,        const war_uint32_t Perms,        const PathCmpTypeE CmpMode = PCMP_AUTO);     /** Constructor (for lookup) */    WarSvrPath(const path_t& Alias,        const PathCmpTypeE CmpMode = PCMP_AUTO);        /**    * Copy constructor.    *    * @param from The value to copy to this object.    */    WarSvrPath(const WarSvrPath& from);        /**    * Destructor.    */    ~WarSvrPath(void);        // OPERATORS    ///    WarSvrPath& operator = (const WarSvrPath& from);    ///    bool operator == (const path_t& Alias) const;    ///    bool operator == (const WarSvrPath& from) const;    ///    bool operator < (const WarSvrPath& from) const;    ///    bool operator < (const path_t& Alias) const;    ///    void operator = (const PathCmpTypeE from)    {        mCmpMode = from;    }        // OPERATIONS       void Add(const path_t& from);    void Add(const WarPathE from);    void SetPerms(war_uint32_t newPerms)    {        mPerms = newPerms;    }    // Prepare for use    void Normalize()    {        mAlias.Normalize();        mUrl.Normalize();    }#if WAR_RFC2577    void SetIpAccessList(const WarIpAccessList& newList)    {        mIpAccessList = newList;    }#endif    // ACCESS    inline const path_t& GetAlias() const    {        return mAlias;    }    inline const WarUrl& GetUrl() const    {        return mUrl;    }    inline const war_syspath_t::path_ccstring_t GetPath() const    {        return mUrl.GetFilePath().GetPath();    }    inline const war_uint32_t GetPerms() const    {        return mPerms;    }    inline const PathCmpTypeE& GetCmpMode() const    {        return mCmpMode;    }#if WAR_RFC2577    const WarIpAccessList& GetIpAccessList()    {        return mIpAccessList;    }#endif    // INQUIRY    void VerifyHost(const struct in_addr& hostAddr) const        throw(WarException);    ///     inline bool IsInPath(const path_t& Alias) const    {        return mAlias.CmpPath(Alias, mCmpMode);    }    ///     inline bool IsPartOfPath(const path_t& Alias) const    {        return Alias.CmpPath(mAlias, mCmpMode);    }    /// Checks the permissiosn to see if the user can change directory to the dir.    void VerifyChdir() const throw(WarException);    void VerifyAccesss() const throw(WarException);    void VerifyList() const throw(WarException);    void VerifyRmd() const throw(WarException);    void VerifyMkd() const throw(WarException);    void VerifyDelete() const throw(WarException);    void VerifyRnfr() const throw(WarException);    void VerifyRnto() const throw(WarException);    void VerifyRnfrDir() const throw(WarException);    void VerifyRntoDir() const throw(WarException);    /** Checks the permissions that applies for the path. This        method is ment to be usd with WarFile flags, and assumes        that the path is to a file or is a link to a file. The        actual type is not looked up. The function ONLY perform        test to see if the open-flags are allowed by the permissions        properties.        User rights, such as "sysadmin", is not considered at all,        as we assume that the pernmissions properties is accurant        for the caller.        @param WarFileOpenFlags The exact flags that a file should be opened with        @exception WarException on error, or if access is denied.    */    void VerifyPermissions(war_uint32_t WarFileOpenFlags)         const throw(WarException);    /** strcmp()/stricmp() substitute, comparing the aliases       */    int PathCmp(const WarSvrPath& other) const;    inline bool IsSharedUpload() const    {        return (mPerms & SHARED_UPLOAD) == SHARED_UPLOAD;    }    protected:private:    /// Visual name    path_t mAlias;    /// Physical path    WarUrl mUrl;    /// \Ref{PropBitsE} permission bits    war_uint32_t mPerms;    /// Path compare mode    PathCmpTypeE mCmpMode;#if WAR_RFC2577    /// IP access list    WarIpAccessList mIpAccessList;#endif};/* INLINE METHODS *//* EXTERNAL REFERENCES */WarSvrPath& operator << (WarSvrPath& path, const war_svrpath_t& from);WarSvrPath& operator << (WarSvrPath& path, const WarPathE from);template <class charT>WarCollector<charT>& operator << (WarCollector<charT>& c,                            const WarSvrPath& val){    return c << val.GetUrl();}typedef std::list<WarSvrPath> war_svr_pathlist_t;typedef std::set<WarSvrPath> war_svr_pathset_t;/// Path type used internally by server apps. UTF8 format.#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WarSvrPath_h_ */

⌨️ 快捷键说明

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