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 OmniWheels by
tftp_server.h
00001 /****************************************************************//** 00002 * 00003 * @file tftp_server.h 00004 * 00005 * @author Logan Gunthorpe <logang@deltatee.com> 00006 * 00007 * @brief Trivial File Transfer Protocol (RFC 1350) 00008 * 00009 * Copyright (c) Deltatee Enterprises Ltd. 2013 00010 * All rights reserved. 00011 * 00012 ********************************************************************/ 00013 00014 /* 00015 * Redistribution and use in source and binary forms, with or without 00016 * modification,are permitted provided that the following conditions are met: 00017 * 00018 * 1. Redistributions of source code must retain the above copyright notice, 00019 * this list of conditions and the following disclaimer. 00020 * 2. Redistributions in binary form must reproduce the above copyright notice, 00021 * this list of conditions and the following disclaimer in the documentation 00022 * and/or other materials provided with the distribution. 00023 * 3. The name of the author may not be used to endorse or promote products 00024 * derived from this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00027 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00028 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 00029 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00030 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00031 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 * 00037 * Author: Logan Gunthorpe <logang@deltatee.com> 00038 * 00039 */ 00040 00041 #ifndef LWIP_HDR_APPS_TFTP_SERVER_H 00042 #define LWIP_HDR_APPS_TFTP_SERVER_H 00043 00044 #include "lwip/apps/tftp_opts.h" 00045 #include "lwip/err.h" 00046 #include "lwip/pbuf.h" 00047 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif 00051 00052 /** @ingroup tftp 00053 * TFTP context containing callback functions for TFTP transfers 00054 */ 00055 struct tftp_context { 00056 /** 00057 * Open file for read/write. 00058 * @param fname Filename 00059 * @param mode Mode string from TFTP RFC 1350 (netascii, octet, mail) 00060 * @param write Flag indicating read (0) or write (!= 0) access 00061 * @returns File handle supplied to other functions 00062 */ 00063 void* (*open)(const char* fname, const char* mode, u8_t write); 00064 /** 00065 * Close file handle 00066 * @param handle File handle returned by open() 00067 */ 00068 void (*close)(void* handle); 00069 /** 00070 * Read from file 00071 * @param handle File handle returned by open() 00072 * @param buf Target buffer to copy read data to 00073 * @param bytes Number of bytes to copy to buf 00074 * @returns >= 0: Success; < 0: Error 00075 */ 00076 int (*read)(void* handle, void* buf, int bytes); 00077 /** 00078 * Write to file 00079 * @param handle File handle returned by open() 00080 * @param pbuf PBUF adjusted such that payload pointer points 00081 * to the beginning of write data. In other words, 00082 * TFTP headers are stripped off. 00083 * @returns >= 0: Success; < 0: Error 00084 */ 00085 int (*write)(void* handle, struct pbuf* p); 00086 }; 00087 00088 err_t tftp_init(const struct tftp_context* ctx); 00089 00090 #ifdef __cplusplus 00091 } 00092 #endif 00093 00094 #endif /* LWIP_HDR_APPS_TFTP_SERVER_H */
Generated on Fri Jul 22 2022 04:54:02 by
