TFTP Support Library¶
Add’s support for TFTP protocol parsing.
-
enum
tftp_action_t
¶ - TFTP_READ
- TFTP_WRITE
-
enum
tftp_mode_t
¶ - TTM_ASCII
- TTM_OCTET
- TTM_MAIL
-
enum
tftp_event_t
¶ - TFTP_SUCCESS
- The transfer was successful.
- TFTP_PEER_ERROR
- The peer send the given error.
- TFTP_INTERN_ERROR
- There was an internal error.
-
bool(*
tftp_start_cb_t
()¶ callback define which is called when a new server request is placed or when an client read request is made and the data length option is received
Parameters
action: The action the transfer want to perform mode: The data mode of the transfer file_name: The filename of the file being transfered [in/out]: data_len When a read action is performed, the application must give the total transfer size of the data. When a write action is performed the total transfer size will be given.
-
int(*
tftp_data_cb_t
()¶ callback define which is called to get or set data from/to the user application
-
void(*
tftp_stop_cb_t
()¶ callback define which is called when an transfer is stopped
-
int
gnrc_tftp_server
(tftp.h::tftp_data_cb_t
data_cb,tftp.h::tftp_start_cb_t
start_cb,tftp.h::tftp_stop_cb_t
stop_cb, bool use_options)¶ Start the TFTP server.
Parameters
data_cb: called for each read data block start_cb: called if a new client connection is requested stop_cb: called if the transfer has finished use_options: when set the client uses the option extensions Return values
- 1 on success
- -1 on failure
-
int
gnrc_tftp_server_stop
(void)¶ Stop the TFTP server.
Return values
- 1 on success
- -1 on failure
-
int
gnrc_tftp_client_read
(ipv6_addr_t * addr, const char * file_name,tftp.h::tftp_mode_t
mode,tftp.h::tftp_data_cb_t
data_cb,tftp.h::tftp_start_cb_t
start_cb,tftp.h::tftp_stop_cb_t
stop_cb, bool use_option)¶ Start an TFTP client read action from the given destination.
Parameters
addr: the address of the server file_name: the filename of the file to get mode: the transfer mode data_cb: called for each read data block start_cb: called if the server returns the transfer_size option stop_cb: called if the transfer has finished use_option: when set the client uses the option extensions Return values
- 1 on success
- -1 on failure
-
int
gnrc_tftp_client_write
(ipv6_addr_t * addr, const char * file_name,tftp.h::tftp_mode_t
mode,tftp.h::tftp_data_cb_t
data_cb,msp430_types.h::size_t
total_size,tftp.h::tftp_stop_cb_t
stop_cb, bool use_option)¶ Start an TFTP client write action to the given destination.
Parameters
addr: the address of the server file_name: the filename of the file to write mode: the transfer mode data_cb: called to store the received block total_size: the total size of the transfer stop_cb: called if the server returns the transfer_size option use_option: when set the client uses the option extensions Return values
- 1 on success
- -1 on failure
-
GNRC_TFTP_MAX_FILENAME_LEN
¶ The maximum allowed length of the transfer filename.
1
(64)
-
GNRC_TFTP_DEFAULT_SRC_PORT
¶ The base source port to be used by TFTP.
1
(10690)
-
GNRC_TFTP_DEFAULT_DST_PORT
¶ The default destination port of the TFTP server.
1
(69)
-
GNRC_TFTP_MAX_TRANSFER_UNIT
¶ The maximum allowed data bytes in the data packet.
1
(512)
-
GNRC_TFTP_MAX_RETRIES
¶ The number of retries that must be made before stopping a transfer.
1
(5)
-
GNRC_TFTP_DEFAULT_TIMEOUT
¶ The default timeout of a data packet.
1
(1 * US_PER_SEC)