RTEMS 6.1-rc1
tftp.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
15/*
16 * Copyright (C) 1998 W. Eric Norum <eric@norum.ca>
17 * Copyright (C) 2022 embedded brains GmbH & Co. KG
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
39 */
40
41#ifndef _RTEMS_TFTP_H
42#define _RTEMS_TFTP_H
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48#include <stdint.h>
49#include <rtems/fs.h>
50
60 const void *data
61);
62
137/*
138 * The functions below use of the TFTP client library standalone
139 * - i.e. without going through the file system.
140 */
141
146#define TFTP_RFC1350_BLOCK_SIZE 512
147
155#define TFTP_RFC1350_WINDOW_SIZE 1
156
161#define TFTP_DEFAULT_BLOCK_SIZE 1456
162
167#define TFTP_DEFAULT_WINDOW_SIZE 8
168
175typedef struct tftp_options {
188 uint16_t block_size;
189
204 uint16_t window_size;
206
213typedef struct tftp_net_config {
227
234 uint16_t server_port;
235
250 uint32_t timeout;
251
265
282
293);
294
345int tftp_open(
346 const char *hostname,
347 const char *path,
348 bool is_for_reading,
349 const tftp_net_config *config,
350 void **tftp_handle
351);
352
376ssize_t tftp_read(
377 void *tftp_handle,
378 void *buffer,
379 size_t count
380);
381
406ssize_t tftp_write(
407 void *tftp_handle,
408 const void *buffer,
409 size_t count
410);
411
434int tftp_close(
435 void *tftp_handle
436);
437
440#ifdef __cplusplus
441}
442#endif
443
444#endif
int tftp_close(void *tftp_handle)
Close a TFTP client connection.
Definition: tftpDriver.c:1430
ssize_t tftp_write(void *tftp_handle, const void *buffer, size_t count)
Write data to a TFTP server.
Definition: tftpDriver.c:1466
void tftp_initialize_net_config(tftp_net_config *config)
Set all members of a tftp_net_config structure to their default values.
Definition: tftpDriver.c:1237
struct tftp_net_config tftp_net_config
This structure represents configuration value used by the TFTP client.
ssize_t tftp_read(void *tftp_handle, void *buffer, size_t count)
Read data from a TFTP server.
Definition: tftpDriver.c:1316
int tftp_open(const char *hostname, const char *path, bool is_for_reading, const tftp_net_config *config, void **tftp_handle)
Opens and starts a TFTP client session to read or write a single file.
Definition: tftpDriver.c:1255
struct tftp_options tftp_options
This structure represents TFTP options negotiated between client and server.
int rtems_tftpfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)
Do not call directly, use mount().
Definition: tftpfs.c:150
Basic Filesystem Types.
Definition: deflate.c:114
Mount table entry.
Definition: libio.h:1621
This structure represents configuration value used by the TFTP client.
Definition: tftp.h:213
tftp_options options
This member represents the options to be sent to the server.
Definition: tftp.h:280
uint16_t server_port
This member defines the port on which the server is listening for incoming connections.
Definition: tftp.h:234
uint32_t timeout
This member defines the maximum time in milliseconds the client waits for an answer packet from the s...
Definition: tftp.h:250
uint32_t first_timeout
This member defines the maximum time in milliseconds the client waits for the first answer packet fro...
Definition: tftp.h:264
uint16_t retransmissions
This member defines how many attempts are made to send a network packet to the server.
Definition: tftp.h:226
This structure represents TFTP options negotiated between client and server.
Definition: tftp.h:175
uint16_t window_size
This member represents the desired size of a window.
Definition: tftp.h:204
uint16_t block_size
This member represents the desired size of a data block.
Definition: tftp.h:188