summaryrefslogtreecommitdiff
path: root/nuttx/netutils/tftpc
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-05 22:47:42 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-05 22:47:42 +0000
commit1b20fc500d738afac1cc8960b4e533b94758e4c2 (patch)
tree9615ef49ed5e048b3788f0405849c04731713121 /nuttx/netutils/tftpc
parent505e4b457e81471ed08cf847a248a7ad09b34860 (diff)
downloadpx4-nuttx-1b20fc500d738afac1cc8960b4e533b94758e4c2.tar.gz
px4-nuttx-1b20fc500d738afac1cc8960b4e533b94758e4c2.tar.bz2
px4-nuttx-1b20fc500d738afac1cc8960b4e533b94758e4c2.zip
Added basic TFTP client support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@879 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/netutils/tftpc')
-rw-r--r--nuttx/netutils/tftpc/tftpc_get.c2
-rw-r--r--nuttx/netutils/tftpc/tftpc_internal.h4
-rw-r--r--nuttx/netutils/tftpc/tftpc_packets.c4
-rw-r--r--nuttx/netutils/tftpc/tftpc_put.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/nuttx/netutils/tftpc/tftpc_get.c b/nuttx/netutils/tftpc/tftpc_get.c
index dfbcef851..49c39a2cb 100644
--- a/nuttx/netutils/tftpc/tftpc_get.c
+++ b/nuttx/netutils/tftpc/tftpc_get.c
@@ -120,7 +120,7 @@ static inline int tftp_parsedatapacket(const ubyte *packet,
*blockno = (uint16)packet[2] << 8 | (uint16)packet[3];
return OK;
}
-#if CONFIG_DEBUG
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
else if (*opcode == TFTP_ERR)
{
(void)tftp_parseerrpacket(packet);
diff --git a/nuttx/netutils/tftpc/tftpc_internal.h b/nuttx/netutils/tftpc/tftpc_internal.h
index 4030aa8ba..801165204 100644
--- a/nuttx/netutils/tftpc/tftpc_internal.h
+++ b/nuttx/netutils/tftpc/tftpc_internal.h
@@ -142,7 +142,7 @@
* Public Data
****************************************************************************/
-#if CONFIG_DEBUG
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
extern const char g_tftpcallfailed[];
extern const char g_tftpcalltimedout[];
extern const char g_tftpnomemory[];
@@ -161,7 +161,7 @@ extern int tftp_sockinit(struct sockaddr_in *server, in_addr_t addr);
extern int tftp_mkreqpacket(ubyte *buffer, int opcode, const char *path, boolean binary);
extern int tftp_mkackpacket(ubyte *buffer, uint16 blockno);
extern int tftp_mkerrpacket(ubyte *buffer, uint16 errorcode, const char *errormsg);
-#if CONFIG_DEBUG
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
extern int tftp_parseerrpacket(const ubyte *packet);
#endif
diff --git a/nuttx/netutils/tftpc/tftpc_packets.c b/nuttx/netutils/tftpc/tftpc_packets.c
index bbdd0b613..d3da57544 100644
--- a/nuttx/netutils/tftpc/tftpc_packets.c
+++ b/nuttx/netutils/tftpc/tftpc_packets.c
@@ -70,7 +70,7 @@
* Public Data
****************************************************************************/
-#if CONFIG_DEBUG
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
const char g_tftpcallfailed[] = "%s failed: %d\n";
const char g_tftpcalltimedout[] = "%s timed out\n";
const char g_tftpnomemory[] = "%s memory allocation failure\n";
@@ -217,7 +217,7 @@ int tftp_mkerrpacket(ubyte *buffer, uint16 errorcode, const char *errormsg)
*
****************************************************************************/
-#ifdef CONFIG_DEBUG
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
int tftp_parseerrpacket(const ubyte *buffer)
{
uint16 opcode = (uint16)buffer[0] << 8 | (uint16)buffer[1];
diff --git a/nuttx/netutils/tftpc/tftpc_put.c b/nuttx/netutils/tftpc/tftpc_put.c
index cdf878b42..73004bdbc 100644
--- a/nuttx/netutils/tftpc/tftpc_put.c
+++ b/nuttx/netutils/tftpc/tftpc_put.c
@@ -269,7 +269,7 @@ static int tftp_rcvack(int sd, ubyte *packet, struct sockaddr_in *server,
if (opcode != TFTP_ACK)
{
nvdbg("Bad opcode%d\n");
-#if CONFIG_DEBUG
+#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET)
if (opcode == TFTP_ERR)
{
(void)tftp_parseerrpacket(packet);
@@ -330,7 +330,6 @@ int tftpput(const char *local, const char *remote, in_addr_t addr, boolean binar
int sd; /* Socket descriptor for socket I/O */
int fd; /* File descriptor for file I/O */
int result = ERROR; /* Assume failure */
- int tmp; /* For temporary usage */
int ret; /* Generic return status */
#if CONFIG_NETUTILS_TFTP_ACKPACKETS > 1
@@ -338,6 +337,7 @@ int tftpput(const char *local, const char *remote, in_addr_t addr, boolean binar
int head; /* Head index into offsets[] */
int tail; /* Tail index into offsets[] */
int hblockno; /* Block number at the head of offsets[] */
+ int tmp; /* For temporary usage */
#else
off_t offset; /* Offset into source file */
off_t next; /* Offset to the next block */