Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TFTPServer by
Revision 2:f7c0fbc8c5aa, committed 2018-03-20
- Comitter:
- hudakz
- Date:
- Tue Mar 20 17:31:42 2018 +0000
- Parent:
- 1:9c973065a97e
- Commit message:
- Updated.
Changed in this revision
TFTPServer.cpp | Show annotated file Show diff for this revision Revisions of this file |
TFTPServer.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/TFTPServer.cpp Fri Mar 16 19:22:10 2018 +0000 +++ b/TFTPServer.cpp Tue Mar 20 17:31:42 2018 +0000 @@ -3,7 +3,7 @@ * Simple TFTP server * * Copyright (c) 2011 Jaap Vermaas - * Modified for MBED-OS5 by Zoltan Hudak 2018 + * Modified by Zoltan Hudak 2018 for MBED-OS5 * * This file is part of the LaOS project (see: http://wiki.laoslaser.org) * @@ -20,6 +20,12 @@ * You should have received a copy of the GNU General Public License * along with LaOS. If not, see <http://www.gnu.org/licenses/>. * + * Minimal TFTP Server + * * Receive and send files via TFTP + * * Server handles only one transfer at a time + * * Supports only octet (raw 8 bit bytes) mode transfers + * * fixed block size: 512 bytes + * */ #include "TFTPServer.h" #include "EthernetInterface.h" @@ -33,7 +39,7 @@ * @param port A port to listen on (defaults to 69). * @retval */ -TFTPServer::TFTPServer(EthernetInterface* net, uint16_t myPort /* = 69 */) +TFTPServer::TFTPServer(EthernetInterface* net, uint16_t myPort /* = 69 */ ) { port = myPort; #ifdef TFTP_DEBUG @@ -335,12 +341,9 @@ } case ERROR: - { } - case SUSPENDED: - { } - case DELETED: + default: { } } // state } @@ -371,7 +374,7 @@ * @brief Creates a new connection reading a file from server. * @note Sends the file to the remote client. * Sends en error message to the remote client in case of failure. - * @param buff A char array for passing input data. + * @param buff A char array to pass data. * @retval */ void TFTPServer::connectRead(char* buff) @@ -423,7 +426,7 @@ * @brief Creates a new connection for writing a file to the server. * @note Sends the file to the TFTP server. * Sends error message to the remote client in case of failure. - * @param buff A char array for passing input data. + * @param buff A char array to pass data. * @retval */ void TFTPServer::connectWrite(char* buff) @@ -544,9 +547,9 @@ int len = 4 + strlen(&errorBuff[4]) + 1; socket->sendto(socketAddr, errorBuff, len); - #ifdef TFTP_DEBUG - printf("Error: %s\r\n", msg); - #endif +#ifdef TFTP_DEBUG + printf("Error: %s\r\n", msg); +#endif } /**
--- a/TFTPServer.h Fri Mar 16 19:22:10 2018 +0000 +++ b/TFTPServer.h Tue Mar 20 17:31:42 2018 +0000 @@ -3,7 +3,7 @@ * Simple TFTP server * * Copyright (c) 2011 Jaap Vermaas - * Modified for MBED-OS5 by Zoltan Hudak 2018 + * Modified by Zoltan Hudak 2018 for MBED-OS5 * * This file is part of the LaOS project (see: http://wiki.laoslaser.org * @@ -23,16 +23,16 @@ * Minimal TFTP Server * * Receive and send files via TFTP * * Server handles only one transfer at a time - * * Supports only binary mode transfers, no (net)ascii + * * Supports only octet (raw 8 bit bytes) mode transfers * * fixed block size: 512 bytes * * http://spectral.mscs.mu.edu/RFC/rfc1350.html * * Example: * @code - * TFTPServer *srv; + * TFTPServer *server; * ... - * srv = new TFTPServer(); + * server = new TFTPServer(); * ... * @endcode *