TFTP Application Interface for Nordic's IPv6 stack

nRF5 SDK v15.0.0

Trivial File Transfer Protocol module provides implementation of TFTP Client. More...

Data Structures

struct iot_tftp_evt_err_t
TFTP error event structure. More...
struct iot_tftp_evt_data_received_t
TFTP data received event structure. More...
union iot_tftp_evt_param_t
TFTP event structure. More...
struct iot_tftp_evt_t
Asynchronous event type. More...
struct iot_tftp_trans_params_t
TFTP Transmission initialization structure (both GET and PUT). More...
struct iot_tftp_init_t
TFTP initialization structure. More...

Typedefs

typedef uint32_t iot_tftp_t
TFTP global instance number.
typedef void(* iot_tftp_callback_t )( iot_tftp_t *p_tftp, iot_tftp_evt_t *p_evt)
User callback from TFTP module. More...

Functions

uint32_t iot_tftp_init ( iot_tftp_t *p_tftp, iot_tftp_init_t *p_init_params)
Initializes TFTP client. More...
uint32_t iot_tftp_set_params ( iot_tftp_t *p_tftp, iot_tftp_trans_params_t *p_params)
Function used in order to change initial connection parameters. More...
uint32_t iot_tftp_get ( iot_tftp_t *p_tftp, iot_file_t *p_file, const char *p_path)
Retrieves file from remote server into p_file. More...
uint32_t iot_tftp_put ( iot_tftp_t *p_tftp, iot_file_t *p_file, const char *p_path)
Sends local file p_file to a remote server. More...
uint32_t iot_tftp_hold ( iot_tftp_t *p_tftp)
Holds transmission of ACK (use in order to slow transmission). More...
uint32_t iot_tftp_resume ( iot_tftp_t *p_tftp)
Resumes transmission. More...
uint32_t iot_tftp_abort ( iot_tftp_t *p_tftp)
Resets TFTP client instance, so it is possible to make another request after error. More...
uint32_t iot_tftp_uninit ( iot_tftp_t *p_tftp)
Frees assigned sockets. More...
void iot_tftp_timeout_process ( iot_timer_time_in_ms_t wall_clock_value)
Function for performing retransmissions of TFTP acknowledgments. More...

Detailed Description

Trivial File Transfer Protocol module provides implementation of TFTP Client.

Typedef Documentation

typedef void(* iot_tftp_callback_t)( iot_tftp_t *p_tftp, iot_tftp_evt_t *p_evt)

User callback from TFTP module.

Note
TFTP module user callback will be invoked even if user asks TFTP to abort (TFTP error event).
Parameters
[in] p_tftp Pointer to the TFTP instance.
[in] p_evt Pointer to the TFTP event structure, describing reason.
Return values
None.

Enumeration Type Documentation

TFTP module Events.

Enumerator
IOT_TFTP_EVT_ERROR

Event code indicating that an error occurred.

IOT_TFTP_EVT_TRANSFER_DATA_RECEIVED

Event code indicating that a data packet was received during read transfer.

IOT_TFTP_EVT_TRANSFER_GET_COMPLETE

Event code indicating that transfer read was completed.

IOT_TFTP_EVT_TRANSFER_PUT_COMPLETE

Event code indicating that transfer write was completed.

Function Documentation

uint32_t iot_tftp_abort ( iot_tftp_t * p_tftp )

Resets TFTP client instance, so it is possible to make another request after error.

Parameters
[in] p_tftp Pointer to the TFTP instance.
Return values
NRF_SUCCESS on successful execution of procedure, else an error code indicating reason for failure.
uint32_t iot_tftp_get ( iot_tftp_t * p_tftp ,
iot_file_t * p_file ,
const char * p_path
)

Retrieves file from remote server into p_file.

If p_file is a NULL pointer, the content of received file can be retrieved by handling IOT_TFTP_EVT_TRANSFER_DATA_RECEIVED event. This event is generated each time a data packet (containing a chunk of requested file) is received. IOT_TFTP_EVT_TRANSFER_GET_COMPLETE event is generated after download is complete.

Note
This function should not be called until previous download operation is completed.
Parameters
[in] p_tftp Pointer to the TFTP instance.
[in] p_file Reference to the file from which data should be read.
[in] p_path Path of the requested file on the remote server. Shall not be NULL.
Return values
NRF_SUCCESS on successful execution of procedure, else an error code indicating reason for failure.
uint32_t iot_tftp_hold ( iot_tftp_t * p_tftp )

Holds transmission of ACK (use in order to slow transmission).

Parameters
[in] p_tftp Pointer to the TFTP instance.
Return values
NRF_SUCCESS on successful execution of procedure, else an error code indicating reason for failure.
uint32_t iot_tftp_init ( iot_tftp_t * p_tftp ,
iot_tftp_init_t * p_init_params
)

Initializes TFTP client.

Parameters
[in] p_tftp Pointer to the TFTP instance. Should not be NULL.
[in] p_init_params Initialization structure for TFTP client. Should not be NULL.
Return values
NRF_SUCCESS on successful execution of procedure, else an error code indicating reason for failure.
uint32_t iot_tftp_put ( iot_tftp_t * p_tftp ,
iot_file_t * p_file ,
const char * p_path
)

Sends local file p_file to a remote server.

Parameters
[in] p_tftp Pointer to the TFTP instance.
[in] p_file Reference to the file to which data should be stored. Should not be NULL.
[in] p_path Path of the file on the remote server. Shall not be NULL.
Return values
NRF_SUCCESS on successful execution of procedure, else an error code indicating reason for failure.
uint32_t iot_tftp_resume ( iot_tftp_t * p_tftp )

Resumes transmission.

Parameters
[in] p_tftp Pointer to the TFTP instance.
Return values
NRF_SUCCESS on successful execution of procedure, else an error code indicating reason for failure.
uint32_t iot_tftp_set_params ( iot_tftp_t * p_tftp ,
iot_tftp_trans_params_t * p_params
)

Function used in order to change initial connection parameters.

Parameters
[in] p_tftp Reference to the TFTP instance.
[in] p_params Pointer to transmission parameters structure. Should not be NULL.
Return values
NRF_SUCCESS if parameters successfully set, else an error code indicating reason for failure.
void iot_tftp_timeout_process ( iot_timer_time_in_ms_t wall_clock_value )

Function for performing retransmissions of TFTP acknowledgments.

Note
TFTP module implements the retransmission mechanism by invoking this function periodically. So that method has to be added to IoT Timer client list and has to be called with minimum of TFTP_RETRANSMISSION_INTERVAL resolution.
Parameters
[in] wall_clock_value The value of the wall clock that triggered the callback.
Return values
None.
uint32_t iot_tftp_uninit ( iot_tftp_t * p_tftp )

Frees assigned sockets.

Parameters
[in] p_tftp Pointer to the TFTP instance.
Return values
NRF_SUCCESS on successful execution of procedure, else an error code indicating reason for failure.