From 7ba69d875c687ef3b00f6267b5dbc5aa607e8da6 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Mon, 8 Oct 2018 11:41:51 +0200 Subject: [PATCH] Some TFTP cleanups --- src/Filelists.cmake | 2 +- src/Filelists.mk | 30 ++++++++++++------------- src/apps/tftp/{tftp_common.c => tftp.c} | 0 src/include/lwip/apps/tftp_client.h | 5 ++++- src/include/lwip/apps/tftp_common.h | 6 ++--- 5 files changed, 22 insertions(+), 21 deletions(-) rename src/apps/tftp/{tftp_common.c => tftp.c} (100%) diff --git a/src/Filelists.cmake b/src/Filelists.cmake index ef1687c7..5b773597 100644 --- a/src/Filelists.cmake +++ b/src/Filelists.cmake @@ -206,7 +206,7 @@ set(lwipnetbios_SRCS # TFTP server files set(lwiptftp_SRCS - ${LWIP_DIR}/src/apps/tftp/tftp_server.c + ${LWIP_DIR}/src/apps/tftp/tftp.c ) # MQTT client files diff --git a/src/Filelists.mk b/src/Filelists.mk index 5d20e57e..65ebda9e 100644 --- a/src/Filelists.mk +++ b/src/Filelists.mk @@ -1,8 +1,8 @@ # # Copyright (c) 2001, 2002 Swedish Institute of Computer Science. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, @@ -11,21 +11,21 @@ # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. +# derived from this software without specific prior written permission. # -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +# SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY # OF SUCH DAMAGE. # # This file is part of the lwIP TCP/IP stack. -# +# # Author: Adam Dunkels # @@ -183,7 +183,7 @@ MDNSFILES=$(LWIPDIR)/apps/mdns/mdns.c NETBIOSNSFILES=$(LWIPDIR)/apps/netbiosns/netbiosns.c # TFTPFILES: TFTP client/server files -TFTPFILES=$(LWIPDIR)/apps/tftp/tftp_common.c +TFTPFILES=$(LWIPDIR)/apps/tftp/tftp.c # MQTTFILES: MQTT client files MQTTFILES=$(LWIPDIR)/apps/mqtt/mqtt.c diff --git a/src/apps/tftp/tftp_common.c b/src/apps/tftp/tftp.c similarity index 100% rename from src/apps/tftp/tftp_common.c rename to src/apps/tftp/tftp.c diff --git a/src/include/lwip/apps/tftp_client.h b/src/include/lwip/apps/tftp_client.h index c241ddba..6f5df748 100644 --- a/src/include/lwip/apps/tftp_client.h +++ b/src/include/lwip/apps/tftp_client.h @@ -5,7 +5,7 @@ * */ -/* +/* * Redistribution and use in source and binary forms, with or without * modification,are permitted provided that the following conditions are met: * @@ -37,4 +37,7 @@ #include "lwip/apps/tftp_common.h" +err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, const char* mode); +err_t tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, const char* mode); + #endif /* LWIP_HDR_APPS_TFTP_CLIENT_H */ diff --git a/src/include/lwip/apps/tftp_common.h b/src/include/lwip/apps/tftp_common.h index 36653f26..a942852d 100644 --- a/src/include/lwip/apps/tftp_common.h +++ b/src/include/lwip/apps/tftp_common.h @@ -11,7 +11,7 @@ * */ -/* +/* * Redistribution and use in source and binary forms, with or without * modification,are permitted provided that the following conditions are met: * @@ -68,7 +68,7 @@ struct tftp_context { */ void (*close)(void* handle); /** - * Read from file + * Read from file * @param handle File handle returned by open() * @param buf Target buffer to copy read data to * @param bytes Number of bytes to copy to buf @@ -96,8 +96,6 @@ struct tftp_context { err_t tftp_init(const struct tftp_context* ctx); void tftp_cleanup(void); -err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, const char* mode); -err_t tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, const char* mode); #ifdef __cplusplus }