19 #include "filesystem/IFile.h"    20 #include "threads/CriticalSection.h"    22 #define NT_STATUS_CONNECTION_REFUSED long(0xC0000000 | 0x0236)    23 #define NT_STATUS_INVALID_HANDLE long(0xC0000000 | 0x0008)    24 #define NT_STATUS_ACCESS_DENIED long(0xC0000000 | 0x0022)    25 #define NT_STATUS_OBJECT_NAME_NOT_FOUND long(0xC0000000 | 0x0034)    26 #define NT_STATUS_INVALID_COMPUTER_NAME long(0xC0000000 | 0x0122)    29 typedef _SMBCCTX SMBCCTX;
    31 class CSMB : 
public CCriticalSection
    39   bool IsSmbValid()
 const { 
return m_context != 
nullptr; }
    41   void SetActivityTime();
    42   void AddActiveConnection();
    43   void AddIdleConnection();
    44   std::string URLEncode(
const std::string &value);
    45   std::string URLEncode(
const CURL &url);
    47   DWORD ConvertUnixToNT(
int error);
    48   static CURL GetResolvedUrl(
const CURL& url);
    52   int m_OpenConnections;
    53   unsigned int m_IdleTimeout;
    54   static bool IsFirstInit;
    65   int OpenFile(
const CURL &url, std::string& strAuth);
    67   void Close() 
override;
    68   int64_t Seek(int64_t iFilePosition, 
int iWhence = SEEK_SET) 
override;
    69   ssize_t Read(
void* lpBuf, 
size_t uiBufSize) 
override;
    70   bool Open(
const CURL& url) 
override;
    71   bool Exists(
const CURL& url) 
override;
    72   int Stat(
const CURL& url, 
struct __stat64* buffer) 
override;
    73   int Stat(
struct __stat64* buffer) 
override;
    74   int Truncate(int64_t size) 
override;
    75   int64_t GetLength() 
override;
    76   int64_t GetPosition() 
override;
    77   ssize_t Write(
const void* lpBuf, 
size_t uiBufSize) 
override;
    79   bool OpenForWrite(
const CURL& url, 
bool bOverWrite = 
false) 
override;
    80   bool Delete(
const CURL& url) 
override;
    81   bool Rename(
const CURL& url, 
const CURL& urlnew) 
override;
    82   int GetChunkSize() 
override;
    83   int IoControl(EIoControl request, 
void* param) 
override;
    87   bool IsValidFile(
const std::string& strFileName);
    88   std::string GetAuthenticatedPath(
const CURL &url);