summaryrefslogtreecommitdiff
path: root/apps/netutils/ftpc/ftpc_internal.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-04 13:32:26 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-04 13:32:26 +0000
commit77a8ce12ae20be575adaf975d881da56f4b3b6dc (patch)
tree426040e8b9d76bcbdb8d5de1bd27eb1fc228c569 /apps/netutils/ftpc/ftpc_internal.h
parentad9530eeb839266cc6fa940624dce885f5693a2e (diff)
downloadnuttx-77a8ce12ae20be575adaf975d881da56f4b3b6dc.tar.gz
nuttx-77a8ce12ae20be575adaf975d881da56f4b3b6dc.tar.bz2
nuttx-77a8ce12ae20be575adaf975d881da56f4b3b6dc.zip
Fix FTP bug -- losing passive mode indication
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3667 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/netutils/ftpc/ftpc_internal.h')
-rw-r--r--apps/netutils/ftpc/ftpc_internal.h41
1 files changed, 26 insertions, 15 deletions
diff --git a/apps/netutils/ftpc/ftpc_internal.h b/apps/netutils/ftpc/ftpc_internal.h
index a59e4fdc1..6600b1220 100644
--- a/apps/netutils/ftpc/ftpc_internal.h
+++ b/apps/netutils/ftpc/ftpc_internal.h
@@ -73,24 +73,31 @@
/* Session flag bits ********************************************************/
-#define FTPC_FLAG_CONNECTED (1 << 0) /* Connected to host */
-#define FTPC_FLAG_LOGGEDIN (1 << 1) /* Logged in to host */
-#define FTPC_STATE_FLAGS (0x0003) /* State of connection */
+#define FTPC_FLAG_PASSIVE (1 << 0) /* Passive mode requested */
+#define FTPC_SESSION_FLAGS (0x0001) /* Persist throughout the session */
-#define FTPC_FLAG_MDTM (1 << 2) /* Host supports MDTM command */
-#define FTPC_FLAG_SIZE (1 << 3) /* Host supports SIZE command */
-#define FTPC_FLAG_PASV (1 << 4) /* Host supports PASV command */
-#define FTPC_FLAG_STOU (1 << 5) /* Host supports STOU command */
-#define FTPC_FLAG_CHMOD (1 << 6) /* Host supports SITE CHMOD command */
-#define FTPC_FLAG_IDLE (1 << 7) /* Host supports SITE IDLE command */
-#define FTPC_HOSTCAP_FLAGS (0x00fc) /* Host capabilities */
+#define FTPC_FLAG_CONNECTED (1 << 1) /* Connected to host */
+#define FTPC_FLAG_LOGGEDIN (1 << 2) /* Logged in to host */
+#define FTPC_STATE_FLAGS (0x0006) /* State of connection */
-#define FTPC_FLAG_INTERRUPT (1 << 8) /* Transfer interrupted */
-#define FTPC_FLAG_PUT (1 << 9) /* Transfer is a PUT operation (upload) */
-#define FTPC_FLAG_PASSIVE (1 << 10) /* Passive mode requested */
-#define FTPC_XFER_FLAGS (0x0700) /* Transfer related */
+#define FTPC_FLAG_MDTM (1 << 3) /* Host supports MDTM command */
+#define FTPC_FLAG_SIZE (1 << 4) /* Host supports SIZE command */
+#define FTPC_FLAG_PASV (1 << 5) /* Host supports PASV command */
+#define FTPC_FLAG_STOU (1 << 6) /* Host supports STOU command */
+#define FTPC_FLAG_CHMOD (1 << 7) /* Host supports SITE CHMOD command */
+#define FTPC_FLAG_IDLE (1 << 8) /* Host supports SITE IDLE command */
+#define FTPC_HOSTCAP_FLAGS (0x01f8) /* Host capabilities */
-#define FTPC_FLAGS_INIT FTPC_HOSTCAP_FLAGS
+#define FTPC_FLAG_INTERRUPT (1 << 9) /* Transfer interrupted */
+#define FTPC_FLAG_PUT (1 << 10) /* Transfer is a PUT operation (upload) */
+#define FTPC_XFER_FLAGS (0x0600) /* Transfer related */
+
+/* These are the bits to be set/cleared when the flags are reset */
+
+#define FTPC_FLAGS_CLEAR (FTPC_STATE_FLAGS | FTPC_XFER_FLAGS)
+#define FTPC_FLAGS_SET FTPC_HOSTCAP_FLAGS
+
+/* Macros to set bits */
#define FTPC_SET_CONNECTED(s) do { (s)->flags |= FTPC_FLAG_CONNECTED; } while (0)
#define FTPC_SET_LOGGEDIN(s) do { (s)->flags |= FTPC_FLAG_LOGGEDIN; } while (0)
@@ -104,6 +111,8 @@
#define FTPC_SET_PUT(s) do { (s)->flags |= FTPC_FLAG_PUT; } while (0)
#define FTPC_SET_PASSIVE(s) do { (s)->flags |= FTPC_FLAG_PASSIVE; } while (0)
+/* Macros to clear bits */
+
#define FTPC_CLR_CONNECTED(s) do { (s)->flags &= ~FTPC_FLAG_CONNECTED; } while (0)
#define FTPC_CLR_LOGGEDIN(s) do { (s)->flags &= ~FTPC_FLAG_LOGGEDIN; } while (0)
#define FTPC_CLR_MDTM(s) do { (s)->flags &= ~FTPC_FLAG_MDTM; } while (0)
@@ -116,6 +125,8 @@
#define FTPC_CLR_PUT(s) do { (s)->flags &= ~FTPC_FLAG_PUT; } while (0)
#define FTPC_CLR_PASSIVE(s) do { (s)->flags &= ~FTPC_FLAG_PASSIVE; } while (0)
+/* Macros to test bits */
+
#define FTPC_IS_CONNECTED(s) (((s)->flags & FTPC_FLAG_CONNECTED) != 0)
#define FTPC_IS_LOGGEDIN(s) (((s)->flags & FTPC_FLAG_LOGGEDIN) != 0)
#define FTPC_HAS_MDTM(s) (((s)->flags & FTPC_FLAG_MDTM) != 0)