Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cFTPCfg.h
Go to the documentation of this file.
1 //
4 //
5 #ifndef _INC_cFTPCfg_H
6 #define _INC_cFTPCfg_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 
11 #include "GrayFTPInt.h"
14 
15 namespace GrayFTP
16 {
17  class cFTPAccount;
18  typedef cRefPtr<cFTPAccount> cFTPAccountPtr;
19  class cClientFTP;
20  class cFTPCfg;
21 
22  class cFTPCfgOpts // : public CCommandLineInfo
23  {
26 
27  public:
30 
33 
36 
39 
40 #ifdef USE_MAX_LIMITS
41  // MaxObjects
42  // MaxLevels
43  // MaxSize
44  cFTPGroupStats m_Max;
45 #endif
46 
47  // MAXCLIENTS - max simultaneous client allowed.
49 
50  // MAXCLIENTSPERIP - prevent flooding from a single IP.
52 
53  // PASVPORT - open a port to allow incoming passive data connections.
55 
56  // PASVIP = in case the external IP is different from sockets recorded IP.
58 
59 #ifdef USE_LOG_EVENTS
60  // LOGDIR - daily log file to this directory
62 
63  // LOGMASK - mask recording of some stuff to the log files.
64  DWORD m_dwLogMask;
65 #endif
66 
67 #ifdef USE_THROTTLE
68  // MAXUPLOADRATE - overall max upload rate allowed for the ftp server. (BytesPerSec)
69  DWORD m_dwMaxUploadRate;
70 
71  // MAXDOWNLOADRATE - overall max Download rate allowed for the ftp server. (BytesPerSec)
72  DWORD m_dwMaxDownloadRate;
73 #endif
74 
75 #ifdef USE_GUI
76  // GUISHOW = SW_SHOWNORMAL type flags for GUI window..
78 #endif
79 
80  // Use local time stamps.
82 
83  // UMASK
84  // DATAPORT20
85  // ALIAS
86  // RATIO
87  // QUIT_MSG
88  // ENABLE_SITE
89  // ALLOWCOMMAND_%s
90  // BIND_TO_ADDR
91  // XFER_BUFSIZE
92  // RESOLVE_CLIENT_IP
93  // MOTD_GLOBAL
94  // HELLO_STRING
95  // ADMIN_PASS
96  // LOG_WTMP
97  // INITIAL_CHROOT
98  // DENY_LOGIN
99  // ESOLVE_UIDS
100  // DO_CHROOT
101  // MOTD_USER
102  // AUTH
103  // PATH_FTPUSERS
104  // AUTH_ETCSHELLS
105  //
106 
107  public:
108  cFTPCfgOpts();
109  ~cFTPCfgOpts();
110 
111  bool LoadOptions(cFTPCfg& cfg);
112 
113  static const FILECHAR_t k_Opts_Section[];
114  };
115 
116  class cFTPCfg
117  {
120 
121  public:
123 
124  private:
125  HKEY m_hKeyBase;
126 
127  static const FILECHAR_t k_szRegRoot[];
128  static const cRegKeyInit k_RegKeyInit[];
129 
130  public:
131  cFTPCfg(void);
132  ~cFTPCfg(void);
133 
134  void InitCfg();
135  cFTPAccountPtr AccountFind(const char* pName, cClientFTP* pClient);
136 
137  UINT GetCfgInt(const FILECHAR_t* pszSection, const FILECHAR_t* pszKeyName, int nDefault);
138  StrLen_t GetCfgStringT(const FILECHAR_t* pszSection, const FILECHAR_t* pszKeyName, FILECHAR_t* lpReturnedString, DWORD nSize);
139 
140 #if USE_UNICODE_FN
141  StrLen_t GetCfgString(const FILECHAR_t* pszSection, const FILECHAR_t* pszKeyName, char* lpReturnedString, DWORD nSize);
142 #else
143  StrLen_t GetCfgString(const FILECHAR_t* pszSection, const FILECHAR_t* pszKeyName, char* lpReturnedString, DWORD nSize)
144  {
145  return GetCfgStringT(pszSection, pszKeyName, lpReturnedString, nSize);
146  }
147 #endif
148 
149  HRESULT CfgDelete();
151  };
152 }
153 #endif
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cClientFTP.h:86
Definition: cFTPCfg.h:23
NET_PORT_t m_wPasvPort
default = 20 ?, SOME SERVERS REFUSE PORT 20 as PASV!!!
Definition: cFTPCfg.h:54
int m_iMaxClients
Definition: cFTPCfg.h:48
NET_PORT_t m_wPort
PORT - port (if not 21)
Definition: cFTPCfg.h:32
cStringF m_sLogDir
daily log file to this directory. Linux path.
Definition: cFTPCfg.h:61
DWORD m_dwLogMask
What stuff to log to file ? LOG_ATTR2_SYS_ERR mask.
Definition: cFTPCfg.h:64
DWORD m_dwGUIShowFlags
Definition: cFTPCfg.h:77
cStringA m_sName
NAME - name of the FTP server.
Definition: cFTPCfg.h:29
int m_iMaxClientsPerIP
Definition: cFTPCfg.h:51
cStringA m_sGreet
GREET - default greeting message if the account does not have one.
Definition: cFTPCfg.h:38
TZ_TYPE m_nTZDisp
TZ_LOCAL = local = -1, minutes.
Definition: cFTPCfg.h:81
~cFTPCfgOpts()
Definition: cFTPCfg.cpp:264
cNetAddrName m_ipPasv
Definition: cFTPCfg.h:57
bool LoadOptions(cFTPCfg &cfg)
Definition: cFTPCfg.cpp:268
cFTPCfgOpts()
Definition: cFTPCfg.cpp:243
TIMESYSD_t m_dwCommandTimeout
CONTROL_TIMEOUT = (in seconds)
Definition: cFTPCfg.h:35
static const FILECHAR_t k_Opts_Section[]
Definition: cFTPCfg.h:113
Definition: cFTPCfg.h:117
StrLen_t GetCfgString(const FILECHAR_t *pszSection, const FILECHAR_t *pszKeyName, char *lpReturnedString, DWORD nSize)
Definition: cFTPCfg.h:143
UINT GetCfgInt(const FILECHAR_t *pszSection, const FILECHAR_t *pszKeyName, int nDefault)
Definition: cFTPCfg.cpp:120
cFTPAccountPtr AccountFind(const char *pName, cClientFTP *pClient)
Definition: cFTPCfg.cpp:80
HRESULT CfgSetInit()
Definition: cFTPCfg.cpp:208
~cFTPCfg(void)
Definition: cFTPCfg.cpp:44
cFTPCfg(void)
Definition: cFTPCfg.cpp:41
cFTPCfgOpts m_Opts
Definition: cFTPCfg.h:122
HRESULT CfgDelete()
Definition: cFTPCfg.cpp:196
StrLen_t GetCfgStringT(const FILECHAR_t *pszSection, const FILECHAR_t *pszKeyName, FILECHAR_t *lpReturnedString, DWORD nSize)
Definition: cFTPCfg.cpp:145
void InitCfg()
Definition: cFTPCfg.cpp:52
Definition: cNetAddrName.h:21
Definition: cFTPAccount.h:14
cRefPtr< cFTPAccount > cFTPAccountPtr
Definition: cFTPAccount.h:126
WORD NET_PORT_t
WinINet calls ports NET_PORT_t INTERNET_PORT = a service.
Definition: cNetPort.h:21
TZ_TYPE
Definition: cTimeUnits.h:29
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
INT32 TIMESYSD_t
Time delta. signed milli-Seconds Span. cTimeSys::k_DMAX, cTimeSys::k_INF = MAILSLOT_WAIT_FOREVER.
Definition: cTimeSys.h:28
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22