Embedded TCP/IP stack: fnet_tftp_srv_request_handler_t

FNET

typedef fnet_return_t(* fnet_tftp_srv_request_handler_t) (fnet_tftp_request_t request_type, const struct fnet_sockaddr *address, fnet_char_t *filename, fnet_char_t *mode, fnet_tftp_error_t *error_code, fnet_char_t **error_message, void *handler_param)

Prototype of the TFTP-server callback function that is called when the TFTP server has received a new read or write request from a remote TFTP client.

Parameters
request_typeRequest type (read or write) defined by fnet_tftp_request_t.
addressTFTP-client socket address that sent this request.
filenameRequested file name (null-terminated string).
modeData transfer mode (null-terminated string). It contains the string "netascii", "octet", or "mail" . According to RFC1350:
  • "Octet" mode is used to transfer a file that is in the 8-bit format of the machine from which the file is being transferred.
  • In "netascii" mode data a host must translate the data to its own format.
  • "Mail" mode uses the name of a mail recipient in place of the filename.
error_codePointer to the error code that will be sent to the remote TFTP client. Changing of this parameter is optional, by default the error code is set to FNET_TFTP_ERROR_NOT_DEFINED.
This parameter is used only when this callback function returns FNET_ERR.
error_messagePointer to a null-terminated error message string. Changing of this parameter is optional, by default the error string is set to "Not defined".
This parameter is used only when this callback function returns FNET_ERR.
handler_paramUser-application specific parameter. It's set during the TFTP-server service initialization as part of fnet_tftp_srv_params.
Returns
  • FNET_OK if the application accepts the receive request and there is no any other error.
  • FNET_ERR if the application cancels the receive request or an error occurs.
See also
fnet_tftp_srv_init(), fnet_tftp_srv_params

Definition at line 87 of file fnet_tftp_srv.h.


© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net