8 #ifndef FTP_USE_NAMESPACE
9 #define FTP_USE_NAMESPACE true
12 #ifndef FTP_ABORT_DELAY_MS
13 #define FTP_ABORT_DELAY_MS 300
16 #ifndef FTP_COMMAND_BUFFER_SIZE
17 #define FTP_COMMAND_BUFFER_SIZE 300
20 #ifndef FTP_RESULT_BUFFER_SIZE
21 #define FTP_RESULT_BUFFER_SIZE 300
24 #ifndef FTP_COMMAND_PORT
25 #define FTP_COMMAND_PORT 21
28 #ifndef FTP_MAX_SESSIONS
29 #define FTP_MAX_SESSIONS 10
32 namespace ftp_client {
35 enum FileMode { READ_MODE, WRITE_MODE, WRITE_APPEND_MODE };
36 enum CurrentOperation { READ_OP, WRITE_OP, LS_OP, NOP, IS_EOF };
37 enum LogLevel { LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR };
38 enum ObjectType { TypeFile, TypeDirectory, TypeUndefined };
48 static int findNthInStr(
char *str,
char ch,
int n) {
52 for (
unsigned int i = 0; i < strlen(str); i++) {
56 if (occur == n)
return i;
61 static int readln(Stream &stream,
char *str,
int maxLen) {
63 if (maxLen > stream.available()) {
64 maxLen = stream.available();
66 for (
int j = 0; j < maxLen; j++) {
68 char c = stream.read();
69 if (c == 0 || c ==
'\n') {
74 memset(str + len, 0, maxLen - len);
82 using namespace ftp_client;
CStringFunctions We implemented some missing C based string functions for character arrays.
Definition: FTPCommon.h:46