Embedded TCP/IP stack  4.7.0

◆ fnet_tftp_cln_handler_t

typedef fnet_int32_t(* fnet_tftp_cln_handler_t) (fnet_tftp_request_t request_type, fnet_uint8_t *data, fnet_size_t data_size, fnet_return_t tftp_result, void *handler_param)

TFTP-client event handler callback function prototype, that is called when the TFTP client has received a new data packet (request_type equals to FNET_TFTP_REQUEST_READ), when the TFTP client is ready to send a new data packet to the TFTP server (request_type equals to FNET_TFTP_REQUEST_WRITE), or when an error occurs (tftp_result equals to FNET_ERR).

Parameters
request_typeRequest type (read or write) defined by fnet_tftp_request_t. It's set during the TFTP-client service initialization as part of the fnet_tftp_cln_params_t.
dataPointer to the data buffer which content defined by request_type:
  • If request_type equals to FNET_TFTP_REQUEST_READ,
    this parameter points to the data buffer that contains data received from the TFTP server.
  • If request_type equals to FNET_TFTP_REQUEST_WRITE,
    this parameter points to the data buffer which should be filled by the application with a data that will be sent to the remote TFTP server. If the written data size is less than data_size (FNET_TFTP_DATA_SIZE_MAX), it will mean that this data packet is the last one.
  • If the tftp_result parameter is equal to FNET_ERR,
    this parameter points to an error message string (null-terminated).
data_sizeSize of the buffer pointed by the data parameter, in bytes.
tftp_resultResult code returned by the TFTP-client service:
  • FNET_OK = No error.
  • FNET_ERR = There is an error. The TFTP-client service is released automatically.
handler_paramUser-application specific parameter. It's set during the TFTP-client service initialization as part of fnet_tftp_cln_params_t.
Returns
  • If request_type equals to FNET_TFTP_REQUEST_READ,
    this function should return FNET_OK if no errors.
  • If request_type equals to FNET_TFTP_REQUEST_WRITE,
    this function should return number of bytes written to the buffer pointed by data. If this number is less than FNET_TFTP_DATA_SIZE_MAX, it will mean that this data packet is the last one (the TFTP-client service is released automatically after the last packet is acknowledged by the remote server).
  • This function should return FNET_ERR if an error occurs. The TFTP-client service will be released automatically.
See also
fnet_tftp_cln_params_t

Definition at line 113 of file fnet_tftp_cln.h.


© 2005-2020 by Andrej Butok. http://fnet.sourceforge.net