Zephyr Project API  3.4.0
A Scalable Open Source RTOS
tftp.h File Reference

Zephyr TFTP Implementation. More...

#include <zephyr/kernel.h>
#include <zephyr/net/socket.h>

Go to the source code of this file.

Data Structures

struct  tftp_data_param
 Parameters for data event. More...
 
struct  tftp_error_param
 Parameters for error event. More...
 
union  tftp_evt_param
 Defines event parameters notified along with asynchronous events to the application. More...
 
struct  tftp_evt
 Defines TFTP asynchronous event notified to the application. More...
 
struct  tftpc
 TFTP client definition to maintain information relevant to the client. More...
 

Macros

#define TFTP_BLOCK_SIZE   512
 
#define TFTP_HEADER_SIZE   4
 
#define TFTPC_MAX_BUF_SIZE   (TFTP_BLOCK_SIZE + TFTP_HEADER_SIZE)
 
#define TFTPC_SUCCESS   0
 
#define TFTPC_DUPLICATE_DATA   -1
 
#define TFTPC_BUFFER_OVERFLOW   -2
 
#define TFTPC_UNKNOWN_FAILURE   -3
 
#define TFTPC_REMOTE_ERROR   -4
 
#define TFTPC_RETRIES_EXHAUSTED   -5
 

Typedefs

typedef void(* tftp_callback_t) (const struct tftp_evt *evt)
 TFTP event notification callback registered by the application. More...
 

Enumerations

enum  tftp_evt_type { TFTP_EVT_DATA , TFTP_EVT_ERROR }
 TFTP Asynchronous Events notified to the application from the module through the callback registered by the application. More...
 

Functions

int tftp_get (struct tftpc *client, const char *remote_file, const char *mode)
 
int tftp_put (struct tftpc *client, const char *remote_file, const char *mode, const uint8_t *user_buf, uint32_t user_buf_size)
 

Detailed Description

Zephyr TFTP Implementation.

Macro Definition Documentation

◆ TFTP_BLOCK_SIZE

#define TFTP_BLOCK_SIZE   512

RFC1350: the file is sent in fixed length blocks of 512 bytes. Each data packet contains one block of data, and must be acknowledged by an acknowledgment packet before the next packet can be sent. A data packet of less than 512 bytes signals termination of a transfer.

◆ TFTP_HEADER_SIZE

#define TFTP_HEADER_SIZE   4

RFC1350: For non-request TFTP message, the header contains 2-byte operation code plus 2-byte block number or error code.

◆ TFTPC_BUFFER_OVERFLOW

#define TFTPC_BUFFER_OVERFLOW   -2

◆ TFTPC_DUPLICATE_DATA

#define TFTPC_DUPLICATE_DATA   -1

◆ TFTPC_MAX_BUF_SIZE

#define TFTPC_MAX_BUF_SIZE   (TFTP_BLOCK_SIZE + TFTP_HEADER_SIZE)

◆ TFTPC_REMOTE_ERROR

#define TFTPC_REMOTE_ERROR   -4

◆ TFTPC_RETRIES_EXHAUSTED

#define TFTPC_RETRIES_EXHAUSTED   -5

◆ TFTPC_SUCCESS

#define TFTPC_SUCCESS   0

◆ TFTPC_UNKNOWN_FAILURE

#define TFTPC_UNKNOWN_FAILURE   -3

Typedef Documentation

◆ tftp_callback_t

tftp_callback_t

TFTP event notification callback registered by the application.

Parameters
[in]evtEvent description along with result and associated parameters (if any).

Enumeration Type Documentation

◆ tftp_evt_type

TFTP Asynchronous Events notified to the application from the module through the callback registered by the application.

Enumerator
TFTP_EVT_DATA 

DATA event when data is received from remote server.

   @note DATA event structure contains payload data and size.
TFTP_EVT_ERROR 

ERROR event when error is received from remote server.

   @note ERROR event structure contains error code and message.

Function Documentation

◆ tftp_get()

int tftp_get ( struct tftpc client,
const char *  remote_file,
const char *  mode 
)

◆ tftp_put()

int tftp_put ( struct tftpc client,
const char *  remote_file,
const char *  mode,
const uint8_t user_buf,
uint32_t  user_buf_size 
)