Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
tftp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 InnBlue
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_NET_TFTP_H_
13#define ZEPHYR_INCLUDE_NET_TFTP_H_
14
15#include <zephyr.h>
16#include <net/socket.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22struct tftpc {
25};
26
27/* TFTP Client Error codes. */
28#define TFTPC_SUCCESS 0
29#define TFTPC_DUPLICATE_DATA -1
30#define TFTPC_BUFFER_OVERFLOW -2
31#define TFTPC_UNKNOWN_FAILURE -3
32#define TFTPC_REMOTE_ERROR -4
33#define TFTPC_RETRIES_EXHAUSTED -5
34
35/* @brief This function gets "file" from the remote server.
36 *
37 * If the file is successfully received its size will be returned in
38 * `client->user_buf_size` parameter.
39 *
40 * @param server Control Block that represents the remote server.
41 * @param client Client Buffer Information.
42 * @param remote_file Name of the remote file to get.
43 * @param mode TFTP Client "mode" setting
44 *
45 * @return TFTPC_SUCCESS if the operation completed successfully.
46 * TFTPC_BUFFER_OVERFLOW if the file is larger than the user buffer.
47 * TFTPC_REMOTE_ERROR if the server failed to process our request.
48 * TFTPC_RETRIES_EXHAUSTED if the client timed out waiting for server.
49 */
50int tftp_get(struct sockaddr *server, struct tftpc *client,
51 const char *remote_file, const char *mode);
52
53#endif /* ZEPHYR_INCLUDE_NET_TFTP_H_ */
struct k_thread client
Definition: main.c:31
BSD Sockets compatible API definitions.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
Definition: net_ip.h:335
Definition: tftp.h:22
uint32_t user_buf_size
Definition: tftp.h:24
uint8_t * user_buf
Definition: tftp.h:23
int tftp_get(struct sockaddr *server, struct tftpc *client, const char *remote_file, const char *mode)