|
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_type | Request 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. |
data | Pointer 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_size | Size of the buffer pointed by the data parameter, in bytes.
|
tftp_result | Result 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_param | User-application specific parameter. It's set during the TFTP-client service initialization as part of fnet_tftp_cln_params. |
- 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
Definition at line 114 of file fnet_tftp_cln.h.
|